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_PROVIDER_HOST_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ |
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 // case it will observe resource loads made directly by the service worker. | 45 // case it will observe resource loads made directly by the service worker. |
46 class CONTENT_EXPORT ServiceWorkerProviderHost | 46 class CONTENT_EXPORT ServiceWorkerProviderHost |
47 : public NON_EXPORTED_BASE(ServiceWorkerRegistration::Listener), | 47 : public NON_EXPORTED_BASE(ServiceWorkerRegistration::Listener), |
48 public base::SupportsWeakPtr<ServiceWorkerProviderHost> { | 48 public base::SupportsWeakPtr<ServiceWorkerProviderHost> { |
49 public: | 49 public: |
50 using GetClientInfoCallback = | 50 using GetClientInfoCallback = |
51 base::Callback<void(const ServiceWorkerClientInfo&)>; | 51 base::Callback<void(const ServiceWorkerClientInfo&)>; |
52 using GetRegistrationForReadyCallback = | 52 using GetRegistrationForReadyCallback = |
53 base::Callback<void(ServiceWorkerRegistration* reigstration)>; | 53 base::Callback<void(ServiceWorkerRegistration* reigstration)>; |
54 | 54 |
| 55 // PlzNavigate |
| 56 // Used to pre-create a ServiceWorkerProviderHost for a navigation. The |
| 57 // ServiceWorkerNetworkProvider will later be created in the renderer, should |
| 58 // the navigation succeed. |
| 59 static scoped_ptr<ServiceWorkerProviderHost> PreCreateNavigationHost( |
| 60 base::WeakPtr<ServiceWorkerContextCore> context); |
| 61 |
55 // When this provider host is for a Service Worker context, |route_id| is | 62 // When this provider host is for a Service Worker context, |route_id| is |
56 // MSG_ROUTING_NONE. When this provider host is for a Document, | 63 // MSG_ROUTING_NONE. When this provider host is for a Document, |
57 // |route_id| is the frame ID of the Document. When this provider host is for | 64 // |route_id| is the frame ID of the Document. When this provider host is for |
58 // a Shared Worker, |route_id| is the Shared Worker route ID. | 65 // a Shared Worker, |route_id| is the Shared Worker route ID. |
59 // |provider_type| gives additional information whether the provider is | 66 // |provider_type| gives additional information whether the provider is |
60 // created for controller (ServiceWorker) or controllee (Document or | 67 // created for controller (ServiceWorker) or controllee (Document or |
61 // SharedWorker). | 68 // SharedWorker). |
62 ServiceWorkerProviderHost(int render_process_id, | 69 ServiceWorkerProviderHost(int render_process_id, |
63 int route_id, | 70 int route_id, |
64 int provider_id, | 71 int provider_id, |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 void CompleteCrossSiteTransfer( | 202 void CompleteCrossSiteTransfer( |
196 int new_process_id, | 203 int new_process_id, |
197 int new_frame_id, | 204 int new_frame_id, |
198 int new_provider_id, | 205 int new_provider_id, |
199 ServiceWorkerProviderType new_provider_type, | 206 ServiceWorkerProviderType new_provider_type, |
200 ServiceWorkerDispatcherHost* dispatcher_host); | 207 ServiceWorkerDispatcherHost* dispatcher_host); |
201 ServiceWorkerDispatcherHost* dispatcher_host() const { | 208 ServiceWorkerDispatcherHost* dispatcher_host() const { |
202 return dispatcher_host_; | 209 return dispatcher_host_; |
203 } | 210 } |
204 | 211 |
| 212 // PlzNavigate |
| 213 // Completes initialization of provider hosts used for navigation requests. |
| 214 void CompleteNavigationInitialized( |
| 215 int process_id, |
| 216 int frame_routing_id, |
| 217 ServiceWorkerDispatcherHost* dispatcher_host); |
| 218 |
205 // Sends event messages to the renderer. Events for the worker are queued up | 219 // Sends event messages to the renderer. Events for the worker are queued up |
206 // until the worker thread id is known via SetReadyToSendMessagesToWorker(). | 220 // until the worker thread id is known via SetReadyToSendMessagesToWorker(). |
207 void SendUpdateFoundMessage( | 221 void SendUpdateFoundMessage( |
208 int registration_handle_id); | 222 int registration_handle_id); |
209 void SendSetVersionAttributesMessage( | 223 void SendSetVersionAttributesMessage( |
210 int registration_handle_id, | 224 int registration_handle_id, |
211 ChangedVersionAttributesMask changed_mask, | 225 ChangedVersionAttributesMask changed_mask, |
212 ServiceWorkerVersion* installing_version, | 226 ServiceWorkerVersion* installing_version, |
213 ServiceWorkerVersion* waiting_version, | 227 ServiceWorkerVersion* waiting_version, |
214 ServiceWorkerVersion* active_version); | 228 ServiceWorkerVersion* active_version); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 | 296 |
283 // Increase/decrease this host's process reference for |pattern|. | 297 // Increase/decrease this host's process reference for |pattern|. |
284 void IncreaseProcessReference(const GURL& pattern); | 298 void IncreaseProcessReference(const GURL& pattern); |
285 void DecreaseProcessReference(const GURL& pattern); | 299 void DecreaseProcessReference(const GURL& pattern); |
286 | 300 |
287 void ReturnRegistrationForReadyIfNeeded(); | 301 void ReturnRegistrationForReadyIfNeeded(); |
288 | 302 |
289 bool IsReadyToSendMessages() const; | 303 bool IsReadyToSendMessages() const; |
290 void Send(IPC::Message* message) const; | 304 void Send(IPC::Message* message) const; |
291 | 305 |
| 306 // Finalizes cross-site transfers and navigation-initalized hosts. |
| 307 void FinalizeInitialization(int process_id, |
| 308 int frame_routing_id, |
| 309 ServiceWorkerDispatcherHost* dispatcher_host); |
| 310 |
292 std::string client_uuid_; | 311 std::string client_uuid_; |
293 int render_process_id_; | 312 int render_process_id_; |
294 int route_id_; | 313 int route_id_; |
295 int render_thread_id_; | 314 int render_thread_id_; |
296 int provider_id_; | 315 int provider_id_; |
297 ServiceWorkerProviderType provider_type_; | 316 ServiceWorkerProviderType provider_type_; |
298 GURL document_url_; | 317 GURL document_url_; |
299 GURL topmost_frame_url_; | 318 GURL topmost_frame_url_; |
300 | 319 |
301 std::vector<GURL> associated_patterns_; | 320 std::vector<GURL> associated_patterns_; |
(...skipping 14 matching lines...) Expand all Loading... |
316 bool allow_association_; | 335 bool allow_association_; |
317 | 336 |
318 std::vector<base::Closure> queued_events_; | 337 std::vector<base::Closure> queued_events_; |
319 | 338 |
320 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderHost); | 339 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderHost); |
321 }; | 340 }; |
322 | 341 |
323 } // namespace content | 342 } // namespace content |
324 | 343 |
325 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ | 344 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ |
OLD | NEW |