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 // This value is used for the render_process_id for browser-initiated | |
57 // navigations. | |
58 static int kVirtualProcessIDForBrowserRequest; | |
michaeln
2015/10/01 23:11:12
please move this const to service_worker_types.h a
Fabrice (no longer in Chrome)
2015/10/02 16:37:34
Done.
| |
59 | |
55 // When this provider host is for a Service Worker context, |route_id| is | 60 // 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, | 61 // 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 | 62 // |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. | 63 // a Shared Worker, |route_id| is the Shared Worker route ID. |
59 // |provider_type| gives additional information whether the provider is | 64 // |provider_type| gives additional information whether the provider is |
60 // created for controller (ServiceWorker) or controllee (Document or | 65 // created for controller (ServiceWorker) or controllee (Document or |
61 // SharedWorker). | 66 // SharedWorker). |
62 ServiceWorkerProviderHost(int render_process_id, | 67 ServiceWorkerProviderHost(int render_process_id, |
63 int route_id, | 68 int route_id, |
64 int provider_id, | 69 int provider_id, |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
195 void CompleteCrossSiteTransfer( | 200 void CompleteCrossSiteTransfer( |
196 int new_process_id, | 201 int new_process_id, |
197 int new_frame_id, | 202 int new_frame_id, |
198 int new_provider_id, | 203 int new_provider_id, |
199 ServiceWorkerProviderType new_provider_type, | 204 ServiceWorkerProviderType new_provider_type, |
200 ServiceWorkerDispatcherHost* dispatcher_host); | 205 ServiceWorkerDispatcherHost* dispatcher_host); |
201 ServiceWorkerDispatcherHost* dispatcher_host() const { | 206 ServiceWorkerDispatcherHost* dispatcher_host() const { |
202 return dispatcher_host_; | 207 return dispatcher_host_; |
203 } | 208 } |
204 | 209 |
210 // PlzNavigate | |
211 // Completes initialization of provider hosts used for navigation requests. | |
212 void CompleteNavigationInitialized( | |
213 int process_id, | |
214 int route_id, | |
215 ServiceWorkerDispatcherHost* dispatcher_host); | |
216 | |
205 // Sends event messages to the renderer. Events for the worker are queued up | 217 // Sends event messages to the renderer. Events for the worker are queued up |
206 // until the worker thread id is known via SetReadyToSendMessagesToWorker(). | 218 // until the worker thread id is known via SetReadyToSendMessagesToWorker(). |
207 void SendUpdateFoundMessage( | 219 void SendUpdateFoundMessage( |
208 int registration_handle_id); | 220 int registration_handle_id); |
209 void SendSetVersionAttributesMessage( | 221 void SendSetVersionAttributesMessage( |
210 int registration_handle_id, | 222 int registration_handle_id, |
211 ChangedVersionAttributesMask changed_mask, | 223 ChangedVersionAttributesMask changed_mask, |
212 ServiceWorkerVersion* installing_version, | 224 ServiceWorkerVersion* installing_version, |
213 ServiceWorkerVersion* waiting_version, | 225 ServiceWorkerVersion* waiting_version, |
214 ServiceWorkerVersion* active_version); | 226 ServiceWorkerVersion* active_version); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
282 | 294 |
283 // Increase/decrease this host's process reference for |pattern|. | 295 // Increase/decrease this host's process reference for |pattern|. |
284 void IncreaseProcessReference(const GURL& pattern); | 296 void IncreaseProcessReference(const GURL& pattern); |
285 void DecreaseProcessReference(const GURL& pattern); | 297 void DecreaseProcessReference(const GURL& pattern); |
286 | 298 |
287 void ReturnRegistrationForReadyIfNeeded(); | 299 void ReturnRegistrationForReadyIfNeeded(); |
288 | 300 |
289 bool IsReadyToSendMessages() const; | 301 bool IsReadyToSendMessages() const; |
290 void Send(IPC::Message* message) const; | 302 void Send(IPC::Message* message) const; |
291 | 303 |
304 // Finalizes cross-site transfers and navigation-initalized hosts. | |
305 void FinalizeInitialization(int process_id, | |
306 int frame_id, | |
307 ServiceWorkerDispatcherHost* dispatcher_host); | |
308 | |
292 std::string client_uuid_; | 309 std::string client_uuid_; |
293 int render_process_id_; | 310 int render_process_id_; |
294 int route_id_; | 311 int route_id_; |
295 int render_thread_id_; | 312 int render_thread_id_; |
296 int provider_id_; | 313 int provider_id_; |
297 ServiceWorkerProviderType provider_type_; | 314 ServiceWorkerProviderType provider_type_; |
298 GURL document_url_; | 315 GURL document_url_; |
299 GURL topmost_frame_url_; | 316 GURL topmost_frame_url_; |
300 | 317 |
301 std::vector<GURL> associated_patterns_; | 318 std::vector<GURL> associated_patterns_; |
(...skipping 14 matching lines...) Expand all Loading... | |
316 bool allow_association_; | 333 bool allow_association_; |
317 | 334 |
318 std::vector<base::Closure> queued_events_; | 335 std::vector<base::Closure> queued_events_; |
319 | 336 |
320 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderHost); | 337 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderHost); |
321 }; | 338 }; |
322 | 339 |
323 } // namespace content | 340 } // namespace content |
324 | 341 |
325 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ | 342 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ |
OLD | NEW |