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_DISPATCHER_HOST_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_ |
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/id_map.h" | 10 #include "base/id_map.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
13 #include "content/browser/service_worker/service_worker_registration_status.h" | 13 #include "content/browser/service_worker/service_worker_registration_status.h" |
14 #include "content/public/browser/browser_message_filter.h" | 14 #include "content/public/browser/browser_message_filter.h" |
15 | 15 |
16 class GURL; | 16 class GURL; |
17 struct EmbeddedWorkerHostMsg_ReportConsoleMessage_Params; | 17 struct EmbeddedWorkerHostMsg_ReportConsoleMessage_Params; |
18 | 18 |
19 namespace content { | 19 namespace content { |
20 | 20 |
21 class MessagePortMessageFilter; | 21 class MessagePortMessageFilter; |
22 class ServiceWorkerContextCore; | 22 class ServiceWorkerContextCore; |
23 class ServiceWorkerContextWrapper; | 23 class ServiceWorkerContextWrapper; |
24 class ServiceWorkerHandle; | 24 class ServiceWorkerHandle; |
25 class ServiceWorkerProviderHost; | 25 class ServiceWorkerProviderHost; |
26 class ServiceWorkerRegistration; | 26 class ServiceWorkerRegistration; |
27 class ServiceWorkerRegistrationHandle; | 27 class ServiceWorkerRegistrationHandle; |
| 28 struct ServiceWorkerRegistrationObjectInfo; |
| 29 struct ServiceWorkerVersionAttributes; |
28 | 30 |
29 class CONTENT_EXPORT ServiceWorkerDispatcherHost : public BrowserMessageFilter { | 31 class CONTENT_EXPORT ServiceWorkerDispatcherHost : public BrowserMessageFilter { |
30 public: | 32 public: |
31 ServiceWorkerDispatcherHost( | 33 ServiceWorkerDispatcherHost( |
32 int render_process_id, | 34 int render_process_id, |
33 MessagePortMessageFilter* message_port_message_filter); | 35 MessagePortMessageFilter* message_port_message_filter); |
34 | 36 |
35 void Init(ServiceWorkerContextWrapper* context_wrapper); | 37 void Init(ServiceWorkerContextWrapper* context_wrapper); |
36 | 38 |
37 // BrowserMessageFilter implementation | 39 // BrowserMessageFilter implementation |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 // IPC Message handlers | 74 // IPC Message handlers |
73 void OnRegisterServiceWorker(int thread_id, | 75 void OnRegisterServiceWorker(int thread_id, |
74 int request_id, | 76 int request_id, |
75 int provider_id, | 77 int provider_id, |
76 const GURL& pattern, | 78 const GURL& pattern, |
77 const GURL& script_url); | 79 const GURL& script_url); |
78 void OnUnregisterServiceWorker(int thread_id, | 80 void OnUnregisterServiceWorker(int thread_id, |
79 int request_id, | 81 int request_id, |
80 int provider_id, | 82 int provider_id, |
81 const GURL& pattern); | 83 const GURL& pattern); |
| 84 void OnGetRegistration(int thread_id, |
| 85 int request_id, |
| 86 int provider_id, |
| 87 const GURL& document_url); |
82 void OnProviderCreated(int provider_id); | 88 void OnProviderCreated(int provider_id); |
83 void OnProviderDestroyed(int provider_id); | 89 void OnProviderDestroyed(int provider_id); |
84 void OnSetHostedVersionId(int provider_id, int64 version_id); | 90 void OnSetHostedVersionId(int provider_id, int64 version_id); |
85 void OnWorkerReadyForInspection(int embedded_worker_id); | 91 void OnWorkerReadyForInspection(int embedded_worker_id); |
86 void OnWorkerScriptLoaded(int embedded_worker_id, int thread_id); | 92 void OnWorkerScriptLoaded(int embedded_worker_id, int thread_id); |
87 void OnWorkerScriptLoadFailed(int embedded_worker_id); | 93 void OnWorkerScriptLoadFailed(int embedded_worker_id); |
88 void OnWorkerStarted(int embedded_worker_id); | 94 void OnWorkerStarted(int embedded_worker_id); |
89 void OnWorkerStopped(int embedded_worker_id); | 95 void OnWorkerStopped(int embedded_worker_id); |
90 void OnPausedAfterDownload(int embedded_worker_id); | 96 void OnPausedAfterDownload(int embedded_worker_id); |
91 void OnReportException(int embedded_worker_id, | 97 void OnReportException(int embedded_worker_id, |
(...skipping 13 matching lines...) Expand all Loading... |
105 void OnDecrementRegistrationRefCount(int registration_handle_id); | 111 void OnDecrementRegistrationRefCount(int registration_handle_id); |
106 void OnPostMessageToWorker(int handle_id, | 112 void OnPostMessageToWorker(int handle_id, |
107 const base::string16& message, | 113 const base::string16& message, |
108 const std::vector<int>& sent_message_port_ids); | 114 const std::vector<int>& sent_message_port_ids); |
109 void OnServiceWorkerObjectDestroyed(int handle_id); | 115 void OnServiceWorkerObjectDestroyed(int handle_id); |
110 | 116 |
111 ServiceWorkerRegistrationHandle* FindRegistrationHandle( | 117 ServiceWorkerRegistrationHandle* FindRegistrationHandle( |
112 int provider_id, | 118 int provider_id, |
113 int64 registration_id); | 119 int64 registration_id); |
114 | 120 |
| 121 void GetRegistrationObjectInfoAndVersionAttributes( |
| 122 int provider_id, |
| 123 ServiceWorkerRegistration* registration, |
| 124 ServiceWorkerRegistrationObjectInfo* info, |
| 125 ServiceWorkerVersionAttributes* attrs); |
| 126 |
115 // Callbacks from ServiceWorkerContextCore | 127 // Callbacks from ServiceWorkerContextCore |
116 void RegistrationComplete(int thread_id, | 128 void RegistrationComplete(int thread_id, |
117 int provider_id, | 129 int provider_id, |
118 int request_id, | 130 int request_id, |
119 ServiceWorkerStatusCode status, | 131 ServiceWorkerStatusCode status, |
120 int64 registration_id, | 132 int64 registration_id, |
121 int64 version_id); | 133 int64 version_id); |
122 | 134 |
123 void UnregistrationComplete(int thread_id, | 135 void UnregistrationComplete(int thread_id, |
124 int request_id, | 136 int request_id, |
125 ServiceWorkerStatusCode status); | 137 ServiceWorkerStatusCode status); |
126 | 138 |
| 139 void GetRegistrationComplete( |
| 140 int thread_id, |
| 141 int provider_id, |
| 142 int request_id, |
| 143 ServiceWorkerStatusCode status, |
| 144 const scoped_refptr<ServiceWorkerRegistration>& registration); |
| 145 |
127 void SendRegistrationError(int thread_id, | 146 void SendRegistrationError(int thread_id, |
128 int request_id, | 147 int request_id, |
129 ServiceWorkerStatusCode status); | 148 ServiceWorkerStatusCode status); |
130 | 149 |
131 void SendUnregistrationError(int thread_id, | 150 void SendUnregistrationError(int thread_id, |
132 int request_id, | 151 int request_id, |
133 ServiceWorkerStatusCode status); | 152 ServiceWorkerStatusCode status); |
134 | 153 |
| 154 void SendGetRegistrationError(int thread_id, |
| 155 int request_id, |
| 156 ServiceWorkerStatusCode status); |
| 157 |
135 ServiceWorkerContextCore* GetContext(); | 158 ServiceWorkerContextCore* GetContext(); |
136 | 159 |
137 int render_process_id_; | 160 int render_process_id_; |
138 MessagePortMessageFilter* const message_port_message_filter_; | 161 MessagePortMessageFilter* const message_port_message_filter_; |
139 scoped_refptr<ServiceWorkerContextWrapper> context_wrapper_; | 162 scoped_refptr<ServiceWorkerContextWrapper> context_wrapper_; |
140 | 163 |
141 IDMap<ServiceWorkerHandle, IDMapOwnPointer> handles_; | 164 IDMap<ServiceWorkerHandle, IDMapOwnPointer> handles_; |
142 IDMap<ServiceWorkerRegistrationHandle, IDMapOwnPointer> registration_handles_; | 165 IDMap<ServiceWorkerRegistrationHandle, IDMapOwnPointer> registration_handles_; |
143 | 166 |
144 bool channel_ready_; // True after BrowserMessageFilter::sender_ != NULL. | 167 bool channel_ready_; // True after BrowserMessageFilter::sender_ != NULL. |
145 ScopedVector<IPC::Message> pending_messages_; | 168 ScopedVector<IPC::Message> pending_messages_; |
146 | 169 |
147 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcherHost); | 170 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcherHost); |
148 }; | 171 }; |
149 | 172 |
150 } // namespace content | 173 } // namespace content |
151 | 174 |
152 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_ | 175 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_ |
OLD | NEW |