| 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_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_ | 5 #ifndef CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_ |
| 6 #define CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_ | 6 #define CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/id_map.h" | 11 #include "base/id_map.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
| 14 #include "content/child/worker_task_runner.h" | 14 #include "content/child/worker_task_runner.h" |
| 15 #include "third_party/WebKit/public/platform/WebServiceWorkerError.h" | 15 #include "third_party/WebKit/public/platform/WebServiceWorkerError.h" |
| 16 #include "third_party/WebKit/public/platform/WebServiceWorkerProvider.h" | 16 #include "third_party/WebKit/public/platform/WebServiceWorkerProvider.h" |
| 17 #include "third_party/WebKit/public/platform/WebServiceWorkerState.h" | 17 #include "third_party/WebKit/public/platform/WebServiceWorkerState.h" |
| 18 | 18 |
| 19 class GURL; | 19 class GURL; |
| 20 | 20 |
| 21 namespace blink { | 21 namespace blink { |
| 22 class WebURL; | 22 class WebURL; |
| 23 } | 23 } |
| 24 | 24 |
| 25 namespace IPC { | 25 namespace IPC { |
| 26 class Message; | 26 class Message; |
| 27 } | 27 } |
| 28 | 28 |
| 29 struct ServiceWorkerMsg_MessageToDocument_Params; |
| 30 |
| 29 namespace content { | 31 namespace content { |
| 30 | 32 |
| 31 class ServiceWorkerMessageFilter; | 33 class ServiceWorkerMessageFilter; |
| 32 class ServiceWorkerProviderContext; | 34 class ServiceWorkerProviderContext; |
| 33 class ThreadSafeSender; | 35 class ThreadSafeSender; |
| 34 class WebServiceWorkerImpl; | 36 class WebServiceWorkerImpl; |
| 35 class WebServiceWorkerRegistrationImpl; | 37 class WebServiceWorkerRegistrationImpl; |
| 36 struct ServiceWorkerObjectInfo; | 38 struct ServiceWorkerObjectInfo; |
| 37 struct ServiceWorkerRegistrationObjectInfo; | 39 struct ServiceWorkerRegistrationObjectInfo; |
| 38 struct ServiceWorkerVersionAttributes; | 40 struct ServiceWorkerVersionAttributes; |
| 39 struct TransferredMessagePort; | |
| 40 | 41 |
| 41 // This class manages communication with the browser process about | 42 // This class manages communication with the browser process about |
| 42 // registration of the service worker, exposed to renderer and worker | 43 // registration of the service worker, exposed to renderer and worker |
| 43 // scripts through methods like navigator.registerServiceWorker(). | 44 // scripts through methods like navigator.registerServiceWorker(). |
| 44 class CONTENT_EXPORT ServiceWorkerDispatcher | 45 class CONTENT_EXPORT ServiceWorkerDispatcher |
| 45 : public WorkerTaskRunner::Observer { | 46 : public WorkerTaskRunner::Observer { |
| 46 public: | 47 public: |
| 47 typedef blink::WebServiceWorkerProvider::WebServiceWorkerRegistrationCallbacks | 48 typedef blink::WebServiceWorkerProvider::WebServiceWorkerRegistrationCallbacks |
| 48 WebServiceWorkerRegistrationCallbacks; | 49 WebServiceWorkerRegistrationCallbacks; |
| 49 typedef blink::WebCallbacks<bool, blink::WebServiceWorkerError> | 50 typedef blink::WebCallbacks<bool, blink::WebServiceWorkerError> |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 int provider_id, | 223 int provider_id, |
| 223 int registration_handle_id, | 224 int registration_handle_id, |
| 224 int changed_mask, | 225 int changed_mask, |
| 225 const ServiceWorkerVersionAttributes& attributes); | 226 const ServiceWorkerVersionAttributes& attributes); |
| 226 void OnUpdateFound(int thread_id, | 227 void OnUpdateFound(int thread_id, |
| 227 int registration_handle_id); | 228 int registration_handle_id); |
| 228 void OnSetControllerServiceWorker(int thread_id, | 229 void OnSetControllerServiceWorker(int thread_id, |
| 229 int provider_id, | 230 int provider_id, |
| 230 const ServiceWorkerObjectInfo& info, | 231 const ServiceWorkerObjectInfo& info, |
| 231 bool should_notify_controllerchange); | 232 bool should_notify_controllerchange); |
| 232 void OnPostMessage( | 233 void OnPostMessage(const ServiceWorkerMsg_MessageToDocument_Params& params); |
| 233 int thread_id, | |
| 234 int provider_id, | |
| 235 const base::string16& message, | |
| 236 const std::vector<TransferredMessagePort>& sent_message_ports, | |
| 237 const std::vector<int>& new_routing_ids); | |
| 238 | 234 |
| 239 // Keeps map from handle_id to ServiceWorker object. | 235 // Keeps map from handle_id to ServiceWorker object. |
| 240 void AddServiceWorker(int handle_id, WebServiceWorkerImpl* worker); | 236 void AddServiceWorker(int handle_id, WebServiceWorkerImpl* worker); |
| 241 void RemoveServiceWorker(int handle_id); | 237 void RemoveServiceWorker(int handle_id); |
| 242 | 238 |
| 243 // Keeps map from registration_handle_id to ServiceWorkerRegistration object. | 239 // Keeps map from registration_handle_id to ServiceWorkerRegistration object. |
| 244 void AddServiceWorkerRegistration( | 240 void AddServiceWorkerRegistration( |
| 245 int registration_handle_id, | 241 int registration_handle_id, |
| 246 WebServiceWorkerRegistrationImpl* registration); | 242 WebServiceWorkerRegistrationImpl* registration); |
| 247 void RemoveServiceWorkerRegistration( | 243 void RemoveServiceWorkerRegistration( |
| (...skipping 25 matching lines...) Expand all Loading... |
| 273 WorkerToProviderMap worker_to_provider_; | 269 WorkerToProviderMap worker_to_provider_; |
| 274 | 270 |
| 275 scoped_refptr<ThreadSafeSender> thread_safe_sender_; | 271 scoped_refptr<ThreadSafeSender> thread_safe_sender_; |
| 276 | 272 |
| 277 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcher); | 273 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcher); |
| 278 }; | 274 }; |
| 279 | 275 |
| 280 } // namespace content | 276 } // namespace content |
| 281 | 277 |
| 282 #endif // CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_ | 278 #endif // CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_ |
| OLD | NEW |