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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 ServiceWorkerRegistration* registration); | 81 ServiceWorkerRegistration* registration); |
82 | 82 |
83 protected: | 83 protected: |
84 ~ServiceWorkerDispatcherHost() override; | 84 ~ServiceWorkerDispatcherHost() override; |
85 | 85 |
86 private: | 86 private: |
87 friend class BrowserThread; | 87 friend class BrowserThread; |
88 friend class base::DeleteHelper<ServiceWorkerDispatcherHost>; | 88 friend class base::DeleteHelper<ServiceWorkerDispatcherHost>; |
89 friend class ServiceWorkerDispatcherHostTest; | 89 friend class ServiceWorkerDispatcherHostTest; |
90 friend class TestingServiceWorkerDispatcherHost; | 90 friend class TestingServiceWorkerDispatcherHost; |
| 91 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDispatcherHostTest, |
| 92 ProviderCreatedAndDestroyed); |
| 93 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDispatcherHostTest, |
| 94 CleanupOnRendererCrash); |
91 | 95 |
92 using StatusCallback = base::Callback<void(ServiceWorkerStatusCode status)>; | 96 using StatusCallback = base::Callback<void(ServiceWorkerStatusCode status)>; |
93 enum class ProviderStatus { OK, NO_CONTEXT, DEAD_HOST, NO_HOST, NO_URL }; | 97 enum class ProviderStatus { OK, NO_CONTEXT, DEAD_HOST, NO_HOST, NO_URL }; |
94 | 98 |
95 // Called when mojom::ServiceWorkerDispatcherHostPtr is created on the | 99 // Called when mojom::ServiceWorkerDispatcherHostPtr is created on the |
96 // renderer-side. | 100 // renderer-side. |
97 void AddMojoBinding(mojo::ScopedInterfaceEndpointHandle handle); | 101 void AddMojoBinding(mojo::ScopedInterfaceEndpointHandle handle); |
98 | 102 |
99 // mojom::ServiceWorkerDispatcherHost implementation | 103 // mojom::ServiceWorkerDispatcherHost implementation |
100 void OnProviderCreated(int provider_id, | 104 void OnProviderCreated(ServiceWorkerProviderHostInfo info) override; |
101 int route_id, | |
102 ServiceWorkerProviderType provider_type, | |
103 bool is_parent_frame_secure) override; | |
104 void OnProviderDestroyed(int provider_id) override; | 105 void OnProviderDestroyed(int provider_id) override; |
105 void OnSetHostedVersionId(int provider_id, | 106 void OnSetHostedVersionId(int provider_id, |
106 int64_t version_id, | 107 int64_t version_id, |
107 int embedded_worker_id) override; | 108 int embedded_worker_id) override; |
108 | 109 |
109 // IPC Message handlers | 110 // IPC Message handlers |
110 void OnRegisterServiceWorker(int thread_id, | 111 void OnRegisterServiceWorker(int thread_id, |
111 int request_id, | 112 int request_id, |
112 int provider_id, | 113 int provider_id, |
113 const GURL& pattern, | 114 const GURL& pattern, |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 mojo::AssociatedBindingSet<mojom::ServiceWorkerDispatcherHost> bindings_; | 287 mojo::AssociatedBindingSet<mojom::ServiceWorkerDispatcherHost> bindings_; |
287 | 288 |
288 base::WeakPtrFactory<ServiceWorkerDispatcherHost> weak_factory_; | 289 base::WeakPtrFactory<ServiceWorkerDispatcherHost> weak_factory_; |
289 | 290 |
290 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcherHost); | 291 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcherHost); |
291 }; | 292 }; |
292 | 293 |
293 } // namespace content | 294 } // namespace content |
294 | 295 |
295 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_ | 296 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_ |
OLD | NEW |