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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 // case it will observe resource loads made directly by the service worker. | 44 // case it will observe resource loads made directly by the service worker. |
45 class CONTENT_EXPORT ServiceWorkerProviderHost | 45 class CONTENT_EXPORT ServiceWorkerProviderHost |
46 : public NON_EXPORTED_BASE(ServiceWorkerRegistration::Listener), | 46 : public NON_EXPORTED_BASE(ServiceWorkerRegistration::Listener), |
47 public base::SupportsWeakPtr<ServiceWorkerProviderHost> { | 47 public base::SupportsWeakPtr<ServiceWorkerProviderHost> { |
48 public: | 48 public: |
49 using GetClientInfoCallback = | 49 using GetClientInfoCallback = |
50 base::Callback<void(const ServiceWorkerClientInfo&)>; | 50 base::Callback<void(const ServiceWorkerClientInfo&)>; |
51 using GetRegistrationForReadyCallback = | 51 using GetRegistrationForReadyCallback = |
52 base::Callback<void(ServiceWorkerRegistration* reigstration)>; | 52 base::Callback<void(ServiceWorkerRegistration* reigstration)>; |
53 | 53 |
54 // If |render_frame_id| is MSG_ROUTING_NONE, this provider host works for the | 54 // When the provider is created for ServiceWorker, both |render_frame_id| and |
55 // worker context, i.e. ServiceWorker or SharedWorker. | 55 // |shared_worker_route_id| are MSG_ROUTING_NONE. When the provider is created |
56 // |provider_type| gives additional information whether the provider is | 56 // for Document context, |render_frame_id| is not MSG_ROUTING_NONE. When the |
57 // created for controller (ServiceWorker) or controllee (Document or | 57 // provider is created for SharedWorker context, |shared_worker_route_id| is |
58 // SharedWorker). | 58 // not MSG_ROUTING_NONE. |
59 ServiceWorkerProviderHost(int render_process_id, | 59 ServiceWorkerProviderHost(int render_process_id, |
60 int render_frame_id, | 60 int render_frame_id, |
| 61 int shared_worker_route_id, |
61 int provider_id, | 62 int provider_id, |
62 ServiceWorkerProviderType provider_type, | |
63 base::WeakPtr<ServiceWorkerContextCore> context, | 63 base::WeakPtr<ServiceWorkerContextCore> context, |
64 ServiceWorkerDispatcherHost* dispatcher_host); | 64 ServiceWorkerDispatcherHost* dispatcher_host); |
65 virtual ~ServiceWorkerProviderHost(); | 65 virtual ~ServiceWorkerProviderHost(); |
66 | 66 |
67 const std::string& client_uuid() const { return client_uuid_; } | 67 const std::string& client_uuid() const { return client_uuid_; } |
68 int process_id() const { return render_process_id_; } | 68 int process_id() const { return render_process_id_; } |
69 int provider_id() const { return provider_id_; } | 69 int provider_id() const { return provider_id_; } |
70 int frame_id() const { return render_frame_id_; } | 70 int frame_id() const { return render_frame_id_; } |
| 71 int shared_worker_route_id() const { return shared_worker_route_id_; } |
71 | 72 |
72 bool IsHostToRunningServiceWorker() { | 73 bool IsHostToRunningServiceWorker() { |
73 return running_hosted_version_.get() != NULL; | 74 return running_hosted_version_.get() != NULL; |
74 } | 75 } |
75 | 76 |
76 ServiceWorkerVersion* controlling_version() const { | 77 ServiceWorkerVersion* controlling_version() const { |
77 return controlling_version_.get(); | 78 return controlling_version_.get(); |
78 } | 79 } |
79 ServiceWorkerVersion* active_version() const { | 80 ServiceWorkerVersion* active_version() const { |
80 return associated_registration_.get() ? | 81 return associated_registration_.get() ? |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 void DecreaseProcessReference(const GURL& pattern); | 277 void DecreaseProcessReference(const GURL& pattern); |
277 | 278 |
278 void ReturnRegistrationForReadyIfNeeded(); | 279 void ReturnRegistrationForReadyIfNeeded(); |
279 | 280 |
280 bool IsReadyToSendMessages() const; | 281 bool IsReadyToSendMessages() const; |
281 void Send(IPC::Message* message) const; | 282 void Send(IPC::Message* message) const; |
282 | 283 |
283 std::string client_uuid_; | 284 std::string client_uuid_; |
284 int render_process_id_; | 285 int render_process_id_; |
285 int render_frame_id_; | 286 int render_frame_id_; |
| 287 int shared_worker_route_id_; |
286 int render_thread_id_; | 288 int render_thread_id_; |
287 int provider_id_; | 289 int provider_id_; |
288 ServiceWorkerProviderType provider_type_; | 290 ServiceWorkerProviderType provider_type_; |
289 GURL document_url_; | 291 GURL document_url_; |
290 GURL topmost_frame_url_; | 292 GURL topmost_frame_url_; |
291 | 293 |
292 std::vector<GURL> associated_patterns_; | 294 std::vector<GURL> associated_patterns_; |
293 scoped_refptr<ServiceWorkerRegistration> associated_registration_; | 295 scoped_refptr<ServiceWorkerRegistration> associated_registration_; |
294 | 296 |
295 // Keyed by registration scope URL length. | 297 // Keyed by registration scope URL length. |
(...skipping 11 matching lines...) Expand all Loading... |
307 bool allow_association_; | 309 bool allow_association_; |
308 | 310 |
309 std::vector<base::Closure> queued_events_; | 311 std::vector<base::Closure> queued_events_; |
310 | 312 |
311 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderHost); | 313 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderHost); |
312 }; | 314 }; |
313 | 315 |
314 } // namespace content | 316 } // namespace content |
315 | 317 |
316 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ | 318 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ |
OLD | NEW |