| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_ |
| 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 } | 86 } |
| 87 | 87 |
| 88 protected: | 88 protected: |
| 89 ~ServiceWorkerDispatcherHost() override; | 89 ~ServiceWorkerDispatcherHost() override; |
| 90 | 90 |
| 91 private: | 91 private: |
| 92 friend class BrowserThread; | 92 friend class BrowserThread; |
| 93 friend class base::DeleteHelper<ServiceWorkerDispatcherHost>; | 93 friend class base::DeleteHelper<ServiceWorkerDispatcherHost>; |
| 94 friend class ServiceWorkerDispatcherHostTest; | 94 friend class ServiceWorkerDispatcherHostTest; |
| 95 friend class TestingServiceWorkerDispatcherHost; | 95 friend class TestingServiceWorkerDispatcherHost; |
| 96 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDispatcherHostTest, |
| 97 ProviderCreatedAndDestroyed); |
| 98 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDispatcherHostTest, |
| 99 CleanupOnRendererCrash); |
| 96 | 100 |
| 97 using StatusCallback = base::Callback<void(ServiceWorkerStatusCode status)>; | 101 using StatusCallback = base::Callback<void(ServiceWorkerStatusCode status)>; |
| 98 enum class ProviderStatus { OK, NO_CONTEXT, DEAD_HOST, NO_HOST, NO_URL }; | 102 enum class ProviderStatus { OK, NO_CONTEXT, DEAD_HOST, NO_HOST, NO_URL }; |
| 99 | 103 |
| 100 // Called when mojom::ServiceWorkerDispatcherHostPtr is created on the | 104 // Called when mojom::ServiceWorkerDispatcherHostPtr is created on the |
| 101 // renderer-side. | 105 // renderer-side. |
| 102 void AddMojoBinding(mojo::ScopedInterfaceEndpointHandle handle); | 106 void AddMojoBinding(mojo::ScopedInterfaceEndpointHandle handle); |
| 103 | 107 |
| 104 // mojom::ServiceWorkerDispatcherHost implementation | 108 // mojom::ServiceWorkerDispatcherHost implementation |
| 105 void OnProviderCreated(int provider_id, | 109 void OnProviderCreated(ServiceWorkerProviderHostInfo info) override; |
| 106 int route_id, | |
| 107 ServiceWorkerProviderType provider_type, | |
| 108 bool is_parent_frame_secure) override; | |
| 109 void OnProviderDestroyed(int provider_id) override; | 110 void OnProviderDestroyed(int provider_id) override; |
| 110 void OnSetHostedVersionId(int provider_id, | 111 void OnSetHostedVersionId(int provider_id, |
| 111 int64_t version_id, | 112 int64_t version_id, |
| 112 int embedded_worker_id) override; | 113 int embedded_worker_id) override; |
| 113 | 114 |
| 114 // IPC Message handlers | 115 // IPC Message handlers |
| 115 void OnRegisterServiceWorker(int thread_id, | 116 void OnRegisterServiceWorker(int thread_id, |
| 116 int request_id, | 117 int request_id, |
| 117 int provider_id, | 118 int provider_id, |
| 118 const GURL& pattern, | 119 const GURL& pattern, |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 mojo::AssociatedBindingSet<mojom::ServiceWorkerDispatcherHost> bindings_; | 291 mojo::AssociatedBindingSet<mojom::ServiceWorkerDispatcherHost> bindings_; |
| 291 | 292 |
| 292 base::WeakPtrFactory<ServiceWorkerDispatcherHost> weak_factory_; | 293 base::WeakPtrFactory<ServiceWorkerDispatcherHost> weak_factory_; |
| 293 | 294 |
| 294 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcherHost); | 295 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcherHost); |
| 295 }; | 296 }; |
| 296 | 297 |
| 297 } // namespace content | 298 } // namespace content |
| 298 | 299 |
| 299 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_ | 300 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_ |
| OLD | NEW |