Chromium Code Reviews| Index: content/browser/service_worker/service_worker_dispatcher_host.h |
| diff --git a/content/browser/service_worker/service_worker_dispatcher_host.h b/content/browser/service_worker/service_worker_dispatcher_host.h |
| index bcd1dd8f721a5095ed15489af6fc605000cc6662..34c16df7efd422c6e33f3750958e7a0d20374054 100644 |
| --- a/content/browser/service_worker/service_worker_dispatcher_host.h |
| +++ b/content/browser/service_worker/service_worker_dispatcher_host.h |
| @@ -15,8 +15,10 @@ |
| #include "base/memory/weak_ptr.h" |
| #include "base/strings/string16.h" |
| #include "content/browser/service_worker/service_worker_registration_status.h" |
| +#include "content/common/service_worker/service_worker.mojom.h" |
| #include "content/common/service_worker/service_worker_types.h" |
| #include "content/public/browser/browser_message_filter.h" |
| +#include "mojo/public/cpp/bindings/associated_binding_set.h" |
| class GURL; |
| struct EmbeddedWorkerHostMsg_ReportConsoleMessage_Params; |
| @@ -41,7 +43,9 @@ struct ServiceWorkerRegistrationInfo; |
| struct ServiceWorkerRegistrationObjectInfo; |
| struct ServiceWorkerVersionAttributes; |
| -class CONTENT_EXPORT ServiceWorkerDispatcherHost : public BrowserMessageFilter { |
| +class CONTENT_EXPORT ServiceWorkerDispatcherHost |
| + : public mojom::ServiceWorkerDispatcherHost, |
|
horo
2016/10/07 07:39:29
I think you can use BrowserAssociatedInterface.
shimazu
2016/10/14 08:15:03
BrowserAssociatedInterface assume that the object
|
| + public BrowserMessageFilter { |
| public: |
| ServiceWorkerDispatcherHost( |
| int render_process_id, |
| @@ -56,6 +60,10 @@ class CONTENT_EXPORT ServiceWorkerDispatcherHost : public BrowserMessageFilter { |
| void OnDestruct() const override; |
| bool OnMessageReceived(const IPC::Message& message) override; |
| + // Called when mojom::ServiceWorkerDispatcherHostPtr is created on the |
| + // renderer-side. |
| + void AddMojoBinding(mojo::ScopedInterfaceEndpointHandle handle); |
|
horo
2016/10/07 07:39:29
Move to private.
shimazu
2016/10/14 08:15:03
Done.
|
| + |
| // IPC::Sender implementation |
| // Send() queues the message until the underlying sender is ready. This |
| @@ -81,6 +89,10 @@ class CONTENT_EXPORT ServiceWorkerDispatcherHost : public BrowserMessageFilter { |
| return message_port_message_filter_; |
| } |
| + base::WeakPtr<ServiceWorkerDispatcherHost> GetWeakPtr() { |
| + return weak_factory_.GetWeakPtr(); |
| + } |
| + |
| protected: |
| ~ServiceWorkerDispatcherHost() override; |
| @@ -92,6 +104,12 @@ class CONTENT_EXPORT ServiceWorkerDispatcherHost : public BrowserMessageFilter { |
| using StatusCallback = base::Callback<void(ServiceWorkerStatusCode status)>; |
| + // mojom::ServiceWorkerDispatcherHost implementation |
| + void OnProviderCreated(int provider_id, |
| + int route_id, |
| + ServiceWorkerProviderType provider_type, |
| + bool is_parent_frame_secure) override; |
| + |
| // IPC Message handlers |
| void OnRegisterServiceWorker(int thread_id, |
| int request_id, |
| @@ -114,10 +132,6 @@ class CONTENT_EXPORT ServiceWorkerDispatcherHost : public BrowserMessageFilter { |
| void OnGetRegistrationForReady(int thread_id, |
| int request_id, |
| int provider_id); |
| - void OnProviderCreated(int provider_id, |
| - int route_id, |
| - ServiceWorkerProviderType provider_type, |
| - bool is_parent_frame_secure); |
| void OnProviderDestroyed(int provider_id); |
| void OnSetHostedVersionId(int provider_id, |
| int64_t version_id, |
| @@ -243,6 +257,10 @@ class CONTENT_EXPORT ServiceWorkerDispatcherHost : public BrowserMessageFilter { |
| bool channel_ready_; // True after BrowserMessageFilter::sender_ != NULL. |
| std::vector<std::unique_ptr<IPC::Message>> pending_messages_; |
| + mojo::AssociatedBindingSet<mojom::ServiceWorkerDispatcherHost> bindings_; |
| + |
| + base::WeakPtrFactory<ServiceWorkerDispatcherHost> weak_factory_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcherHost); |
| }; |