| // 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/WebKit/common/service_worker/service_worker_state.mojom"; |
| import "url/mojom/url.mojom"; |
| |
| const int32 kInvalidServiceWorkerHandleId = -1; |
| const int64 kInvalidServiceWorkerVersionId = -1; |
| |
| // Describes a ServiceWorker object: |
| // https://w3c.github.io/ServiceWorker/#serviceworker-interface |
| struct ServiceWorkerObjectInfo { |
| // |handle_id| and |version_id| are internal state not exposed to the web. |
| // |handle_id| is used for interprocess reference counting to keep the |
| // content::ServiceWorkerVersion in the browser process alive while an object |
| // refers to it; it will be removed when Mojofication is complete. |
| // |version_id| identifies the service worker. |
| int32 handle_id = kInvalidServiceWorkerHandleId; |
| int64 version_id = kInvalidServiceWorkerVersionId; |
| |
| // ServiceWorker#state |
| ServiceWorkerState state = ServiceWorkerState.kUnknown; |
| |
| // ServiceWorker#scriptURL |
| url.mojom.Url url; |
| |
| // This object's host in the browser process. |
| associated ServiceWorkerObjectHost host_ptr_info; |
| }; |
| |
| // The browser-side host of one ServiceWorker JavaScript object. The renderer |
| // uses this interface to ask the browser process to do operations needed to |
| // implement ServiceWorker methods. |
| interface ServiceWorkerObjectHost { |
| // TODO(leonhsl): Implement all methods. |
| // Replace ServiceWorkerHostMsg_PostMessageToWorker. |
| // PostMessage(string message, url.mojom.Origin source_origin, |
| // array<handle<message_pipe>> sent_message_ports); |
| |
| // Replace ServiceWorkerHostMsg_TerminateWorker. |
| // Terminate(); |
| }; |