| // Copyright 2017 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| module blink.mojom; |
| |
| import "third_party/blink/public/mojom/loader/fetch_client_settings_object.mojom"; |
| import "third_party/blink/public/mojom/service_worker/navigation_preload_state.mojom"; |
| import "third_party/blink/public/mojom/service_worker/service_worker_database.mojom"; |
| import "third_party/blink/public/mojom/service_worker/service_worker_error_type.mojom"; |
| import "third_party/blink/public/mojom/service_worker/service_worker_object.mojom"; |
| import "third_party/blink/public/mojom/service_worker/service_worker_registration_options.mojom"; |
| import "url/mojom/url.mojom"; |
| |
| struct ChangedServiceWorkerObjectsMask { |
| bool installing; |
| bool waiting; |
| bool active; |
| }; |
| |
| // Describes a ServiceWorkerRegistration: |
| // https://w3c.github.io/ServiceWorker/#serviceworkerregistration-interface |
| struct ServiceWorkerRegistrationObjectInfo { |
| // The globally unique identifier of a service worker registration entity. |
| int64 registration_id = kInvalidServiceWorkerRegistrationId; |
| |
| // Corresponds to ServiceWorkerRegistration#scope. |
| url.mojom.Url scope; |
| // Corresponds to ServiceWorkerRegistration#updateViaCache. |
| ServiceWorkerUpdateViaCache update_via_cache; |
| |
| // Holds one mojo connection to browser process, acts as a reference count to |
| // control lifetime of ServiceWorkerRegistration in the browser process. |
| pending_associated_remote<ServiceWorkerRegistrationObjectHost> host_remote; |
| |
| // |receiver| is expected to be bound in the renderer process. The other end |
| // point of this Mojo connection is held by the browser process. |
| pending_associated_receiver<ServiceWorkerRegistrationObject> receiver; |
| |
| // Corresponds to ServiceWorkerRegistration#{installing,waiting,active}. |
| // Null value means the corresponding object does not exist. |
| ServiceWorkerObjectInfo? installing; |
| ServiceWorkerObjectInfo? waiting; |
| ServiceWorkerObjectInfo? active; |
| }; |
| |
| // This interface lives in the browser process, it corresponds to one |
| // ServiceWorkerRegistration JavaScript object. The renderer uses it to ask the |
| // browser to do operations needed to implement ServiceWorkerRegistration |
| // methods. |
| interface ServiceWorkerRegistrationObjectHost { |
| // Corresponds to ServiceWorkerRegistration#update(). |
| // On success, |error| is kNone without |error_msg| set. |
| // Otherwise, |error| and |error_msg| describe the failure. |
| Update(FetchClientSettingsObject outside_fetch_client_settings_object) |
| => (ServiceWorkerErrorType error, string? error_msg); |
| |
| // Corresponds to ServiceWorkerRegistration#unregister(). |
| // On success, |error| is kNone without |error_msg| set. |
| // Otherwise, |error| and |error_msg| describe the failure. |
| Unregister() => (ServiceWorkerErrorType error, string? error_msg); |
| |
| // Corresponds to NavigationPreloadManager#enable()/disable(). |
| // On success, |error| is kNone without |error_msg| set. |
| // Otherwise, |error| and |error_msg| describe the failure. |
| EnableNavigationPreload(bool enable) |
| => (ServiceWorkerErrorType error, string? error_msg); |
| |
| // Corresponds to NavigationPreloadManager#getState(). |
| // On success, |error| is kNone with |state| set. |
| // Otherwise, |error| and |error_msg| describe the failure. |
| GetNavigationPreloadState() |
| => (ServiceWorkerErrorType error, |
| string? error_msg, |
| blink.mojom.NavigationPreloadState? state); |
| |
| // Corresponds to NavigationPreloadManager#setHeaderValue(). |
| // On success, |error| is kNone without |error_msg| set. |
| // Otherwise, |error| and |error_msg| describe the failure. |
| SetNavigationPreloadHeader(string value) |
| => (ServiceWorkerErrorType error, string? error_msg); |
| }; |
| |
| // This interface lives in the renderer process, it corresponds to one |
| // ServiceWorkerRegistration JavaScript object. The browser uses it to talk with |
| // the corresponding impl of ServiceWorkerRegistration in the renderer. |
| interface ServiceWorkerRegistrationObject { |
| // Sets changed service worker objects for this registration object. |
| // |changed_mask| indicates which objects of {|installing|,|waiting|,|active|} |
| // have changed. |
| // Changed objects may be null to indicate that the object does not exist |
| // anymore. Unchanged ones are always null. |
| SetServiceWorkerObjects(ChangedServiceWorkerObjectsMask changed_mask, |
| ServiceWorkerObjectInfo? installing, |
| ServiceWorkerObjectInfo? waiting, |
| ServiceWorkerObjectInfo? active); |
| |
| // Sets ServiceWorkerRegistration#updateViaCache. |
| SetUpdateViaCache(ServiceWorkerUpdateViaCache update_via_cache); |
| |
| // Corresponds to ServiceWorkerRegistration#onupdatefound. |
| UpdateFound(); |
| }; |