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 |
(...skipping 28 matching lines...) Expand all Loading... |
39 struct TransferredMessagePort; | 39 struct TransferredMessagePort; |
40 | 40 |
41 // This class manages communication with the browser process about | 41 // This class manages communication with the browser process about |
42 // registration of the service worker, exposed to renderer and worker | 42 // registration of the service worker, exposed to renderer and worker |
43 // scripts through methods like navigator.registerServiceWorker(). | 43 // scripts through methods like navigator.registerServiceWorker(). |
44 class CONTENT_EXPORT ServiceWorkerDispatcher | 44 class CONTENT_EXPORT ServiceWorkerDispatcher |
45 : public WorkerTaskRunner::Observer { | 45 : public WorkerTaskRunner::Observer { |
46 public: | 46 public: |
47 typedef blink::WebServiceWorkerProvider::WebServiceWorkerRegistrationCallbacks | 47 typedef blink::WebServiceWorkerProvider::WebServiceWorkerRegistrationCallbacks |
48 WebServiceWorkerRegistrationCallbacks; | 48 WebServiceWorkerRegistrationCallbacks; |
49 typedef | 49 typedef blink::WebCallbacks<bool, blink::WebServiceWorkerError> |
50 blink::WebServiceWorkerProvider::WebServiceWorkerUnregistrationCallbacks | |
51 WebServiceWorkerUnregistrationCallbacks; | 50 WebServiceWorkerUnregistrationCallbacks; |
52 typedef | 51 typedef |
53 blink::WebServiceWorkerProvider::WebServiceWorkerGetRegistrationCallbacks | 52 blink::WebServiceWorkerProvider::WebServiceWorkerGetRegistrationCallbacks |
54 WebServiceWorkerGetRegistrationCallbacks; | 53 WebServiceWorkerGetRegistrationCallbacks; |
55 typedef | 54 typedef |
56 blink::WebServiceWorkerProvider::WebServiceWorkerGetRegistrationsCallbacks | 55 blink::WebServiceWorkerProvider::WebServiceWorkerGetRegistrationsCallbacks |
57 WebServiceWorkerGetRegistrationsCallbacks; | 56 WebServiceWorkerGetRegistrationsCallbacks; |
58 typedef blink::WebServiceWorkerProvider:: | 57 typedef blink::WebServiceWorkerProvider:: |
59 WebServiceWorkerGetRegistrationForReadyCallbacks | 58 WebServiceWorkerGetRegistrationForReadyCallbacks |
60 WebServiceWorkerGetRegistrationForReadyCallbacks; | 59 WebServiceWorkerGetRegistrationForReadyCallbacks; |
61 | 60 |
62 explicit ServiceWorkerDispatcher(ThreadSafeSender* thread_safe_sender); | 61 explicit ServiceWorkerDispatcher(ThreadSafeSender* thread_safe_sender); |
63 ~ServiceWorkerDispatcher() override; | 62 ~ServiceWorkerDispatcher() override; |
64 | 63 |
65 void OnMessageReceived(const IPC::Message& msg); | 64 void OnMessageReceived(const IPC::Message& msg); |
66 bool Send(IPC::Message* msg); | 65 bool Send(IPC::Message* msg); |
67 | 66 |
68 // Corresponds to navigator.serviceWorker.register(). | 67 // Corresponds to navigator.serviceWorker.register(). |
69 void RegisterServiceWorker( | 68 void RegisterServiceWorker( |
70 int provider_id, | 69 int provider_id, |
71 const GURL& pattern, | 70 const GURL& pattern, |
72 const GURL& script_url, | 71 const GURL& script_url, |
73 WebServiceWorkerRegistrationCallbacks* callbacks); | 72 WebServiceWorkerRegistrationCallbacks* callbacks); |
74 // Corresponds to ServiceWorkerRegistration.update(). | 73 // Corresponds to ServiceWorkerRegistration.update(). |
75 void UpdateServiceWorker(int provider_id, int64 registration_id); | 74 void UpdateServiceWorker(int provider_id, int64 registration_id); |
76 // Corresponds to ServiceWorkerRegistration.unregister(). | 75 // Corresponds to ServiceWorkerRegistration.unregister(). |
| 76 // TODO(nhiroki): Remove a deprecated version after http://crbug.com/500404 is |
| 77 // fixed. |
| 78 void DeprecatedUnregisterServiceWorker( |
| 79 int provider_id, |
| 80 const GURL& pattern, |
| 81 WebServiceWorkerUnregistrationCallbacks* callbacks); |
77 void UnregisterServiceWorker( | 82 void UnregisterServiceWorker( |
78 int provider_id, | 83 int provider_id, |
79 const GURL& pattern, | 84 int64 registration_id, |
80 WebServiceWorkerUnregistrationCallbacks* callbacks); | 85 WebServiceWorkerUnregistrationCallbacks* callbacks); |
81 // Corresponds to navigator.serviceWorker.getRegistration(). | 86 // Corresponds to navigator.serviceWorker.getRegistration(). |
82 void GetRegistration( | 87 void GetRegistration( |
83 int provider_id, | 88 int provider_id, |
84 const GURL& document_url, | 89 const GURL& document_url, |
85 WebServiceWorkerRegistrationCallbacks* callbacks); | 90 WebServiceWorkerRegistrationCallbacks* callbacks); |
86 // Corresponds to navigator.serviceWorker.getRegistrations(). | 91 // Corresponds to navigator.serviceWorker.getRegistrations(). |
87 void GetRegistrations( | 92 void GetRegistrations( |
88 int provider_id, | 93 int provider_id, |
89 WebServiceWorkerGetRegistrationsCallbacks* callbacks); | 94 WebServiceWorkerGetRegistrationsCallbacks* callbacks); |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 WorkerToProviderMap worker_to_provider_; | 279 WorkerToProviderMap worker_to_provider_; |
275 | 280 |
276 scoped_refptr<ThreadSafeSender> thread_safe_sender_; | 281 scoped_refptr<ThreadSafeSender> thread_safe_sender_; |
277 | 282 |
278 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcher); | 283 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcher); |
279 }; | 284 }; |
280 | 285 |
281 } // namespace content | 286 } // namespace content |
282 | 287 |
283 #endif // CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_ | 288 #endif // CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_ |
OLD | NEW |