OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ | 5 #ifndef CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ |
6 #define CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ | 6 #define CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <map> | 11 #include <map> |
12 #include <memory> | 12 #include <memory> |
13 #include <string> | 13 #include <string> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "base/callback.h" | 16 #include "base/callback.h" |
17 #include "base/id_map.h" | 17 #include "base/id_map.h" |
18 #include "base/macros.h" | 18 #include "base/macros.h" |
19 #include "base/memory/ref_counted.h" | 19 #include "base/memory/ref_counted.h" |
20 #include "base/strings/string16.h" | 20 #include "base/strings/string16.h" |
21 #include "base/time/time.h" | 21 #include "base/time/time.h" |
22 #include "content/child/webmessageportchannel_impl.h" | 22 #include "content/child/webmessageportchannel_impl.h" |
23 #include "content/common/service_worker/service_worker_status_code.h" | 23 #include "content/common/service_worker/service_worker_status_code.h" |
24 #include "content/common/service_worker/service_worker_types.h" | 24 #include "content/common/service_worker/service_worker_types.h" |
25 #include "ipc/ipc_listener.h" | 25 #include "ipc/ipc_listener.h" |
26 #include "services/service_manager/public/interfaces/interface_provider.mojom.h" | 26 #include "services/service_manager/public/interfaces/interface_provider.mojom.h" |
27 #include "third_party/WebKit/public/platform/WebMessagePortChannel.h" | 27 #include "third_party/WebKit/public/platform/WebMessagePortChannel.h" |
28 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor kerError.h" | 28 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor kerError.h" |
29 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor kerPreloadResponseCallbacks.h" | |
29 #include "third_party/WebKit/public/platform/modules/serviceworker/service_worke r_event_status.mojom.h" | 30 #include "third_party/WebKit/public/platform/modules/serviceworker/service_worke r_event_status.mojom.h" |
30 #include "third_party/WebKit/public/web/modules/serviceworker/WebServiceWorkerCo ntextClient.h" | 31 #include "third_party/WebKit/public/web/modules/serviceworker/WebServiceWorkerCo ntextClient.h" |
31 #include "third_party/WebKit/public/web/modules/serviceworker/WebServiceWorkerCo ntextProxy.h" | 32 #include "third_party/WebKit/public/web/modules/serviceworker/WebServiceWorkerCo ntextProxy.h" |
32 #include "v8/include/v8.h" | 33 #include "v8/include/v8.h" |
33 | 34 |
34 struct ServiceWorkerMsg_ExtendableMessageEvent_Params; | 35 struct ServiceWorkerMsg_ExtendableMessageEvent_Params; |
35 | 36 |
36 namespace base { | 37 namespace base { |
37 class SingleThreadTaskRunner; | 38 class SingleThreadTaskRunner; |
38 class TaskRunner; | 39 class TaskRunner; |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
186 blink::WebServiceWorkerClientCallbacks*) override; | 187 blink::WebServiceWorkerClientCallbacks*) override; |
187 void navigate(const blink::WebString& uuid, | 188 void navigate(const blink::WebString& uuid, |
188 const blink::WebURL&, | 189 const blink::WebURL&, |
189 blink::WebServiceWorkerClientCallbacks*) override; | 190 blink::WebServiceWorkerClientCallbacks*) override; |
190 void skipWaiting( | 191 void skipWaiting( |
191 blink::WebServiceWorkerSkipWaitingCallbacks* callbacks) override; | 192 blink::WebServiceWorkerSkipWaitingCallbacks* callbacks) override; |
192 void claim(blink::WebServiceWorkerClientsClaimCallbacks* callbacks) override; | 193 void claim(blink::WebServiceWorkerClientsClaimCallbacks* callbacks) override; |
193 void registerForeignFetchScopes( | 194 void registerForeignFetchScopes( |
194 const blink::WebVector<blink::WebURL>& sub_scopes, | 195 const blink::WebVector<blink::WebURL>& sub_scopes, |
195 const blink::WebVector<blink::WebSecurityOrigin>& origins) override; | 196 const blink::WebVector<blink::WebSecurityOrigin>& origins) override; |
197 void registerPreloadResponseCallback( | |
198 int eventID, | |
dcheng
2016/10/21 06:44:23
Nit: event_id
horo
2016/10/21 10:56:40
Done.
| |
199 std::unique_ptr<blink::WebServiceWorkerPreloadResponseCallbacks>) | |
200 override; | |
196 | 201 |
197 virtual void DispatchSyncEvent( | 202 virtual void DispatchSyncEvent( |
198 const std::string& tag, | 203 const std::string& tag, |
199 blink::WebServiceWorkerContextProxy::LastChanceOption last_chance, | 204 blink::WebServiceWorkerContextProxy::LastChanceOption last_chance, |
200 const SyncCallback& callback); | 205 const SyncCallback& callback); |
201 | 206 |
202 private: | 207 private: |
203 struct WorkerContextData; | 208 struct WorkerContextData; |
204 class FetchEventDispatcherImpl; | 209 class FetchEventDispatcherImpl; |
210 class NavigationPreloadRequest; | |
205 | 211 |
206 // Get routing_id for sending message to the ServiceWorkerVersion | 212 // Get routing_id for sending message to the ServiceWorkerVersion |
207 // in the browser process. | 213 // in the browser process. |
208 int GetRoutingID() const { return embedded_worker_id_; } | 214 int GetRoutingID() const { return embedded_worker_id_; } |
209 | 215 |
210 void Send(IPC::Message* message); | 216 void Send(IPC::Message* message); |
211 void SendWorkerStarted(); | 217 void SendWorkerStarted(); |
212 void SetRegistrationInServiceWorkerGlobalScope( | 218 void SetRegistrationInServiceWorkerGlobalScope( |
213 const ServiceWorkerRegistrationObjectInfo& info, | 219 const ServiceWorkerRegistrationObjectInfo& info, |
214 const ServiceWorkerVersionAttributes& attrs); | 220 const ServiceWorkerVersionAttributes& attrs); |
215 | 221 |
216 void OnActivateEvent(int request_id); | 222 void OnActivateEvent(int request_id); |
217 void OnExtendableMessageEvent( | 223 void OnExtendableMessageEvent( |
218 int request_id, | 224 int request_id, |
219 const ServiceWorkerMsg_ExtendableMessageEvent_Params& params); | 225 const ServiceWorkerMsg_ExtendableMessageEvent_Params& params); |
220 void OnInstallEvent(int request_id); | 226 void OnInstallEvent(int request_id); |
221 void DispatchFetchEvent(int fetch_event_id, | 227 void DispatchFetchEvent( |
222 const ServiceWorkerFetchRequest& request, | 228 int fetch_event_id, |
223 const FetchCallback& callback); | 229 const ServiceWorkerFetchRequest& request, |
230 std::unique_ptr<NavigationPreloadRequest> preload_request, | |
231 const FetchCallback& callback); | |
224 void OnNotificationClickEvent( | 232 void OnNotificationClickEvent( |
225 int request_id, | 233 int request_id, |
226 const std::string& notification_id, | 234 const std::string& notification_id, |
227 const PlatformNotificationData& notification_data, | 235 const PlatformNotificationData& notification_data, |
228 int action_index, | 236 int action_index, |
229 const base::NullableString16& reply); | 237 const base::NullableString16& reply); |
230 void OnPushEvent(int request_id, const PushEventPayload& payload); | 238 void OnPushEvent(int request_id, const PushEventPayload& payload); |
231 void OnNotificationCloseEvent( | 239 void OnNotificationCloseEvent( |
232 int request_id, | 240 int request_id, |
233 const std::string& notification_id, | 241 const std::string& notification_id, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
273 // Initialized on the worker thread in workerContextStarted and | 281 // Initialized on the worker thread in workerContextStarted and |
274 // destructed on the worker thread in willDestroyWorkerContext. | 282 // destructed on the worker thread in willDestroyWorkerContext. |
275 std::unique_ptr<WorkerContextData> context_; | 283 std::unique_ptr<WorkerContextData> context_; |
276 | 284 |
277 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextClient); | 285 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextClient); |
278 }; | 286 }; |
279 | 287 |
280 } // namespace content | 288 } // namespace content |
281 | 289 |
282 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ | 290 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ |
OLD | NEW |