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 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 class EmbeddedWorkerInstanceClientImpl; | 62 class EmbeddedWorkerInstanceClientImpl; |
63 | 63 |
64 // This class provides access to/from an ServiceWorker's WorkerGlobalScope. | 64 // This class provides access to/from an ServiceWorker's WorkerGlobalScope. |
65 // Unless otherwise noted, all methods are called on the worker thread. | 65 // Unless otherwise noted, all methods are called on the worker thread. |
66 class ServiceWorkerContextClient : public blink::WebServiceWorkerContextClient, | 66 class ServiceWorkerContextClient : public blink::WebServiceWorkerContextClient, |
67 public mojom::ServiceWorkerEventDispatcher { | 67 public mojom::ServiceWorkerEventDispatcher { |
68 public: | 68 public: |
69 using SyncCallback = | 69 using SyncCallback = |
70 base::Callback<void(ServiceWorkerStatusCode, | 70 base::Callback<void(ServiceWorkerStatusCode, |
71 base::Time /* dispatch_event_time */)>; | 71 base::Time /* dispatch_event_time */)>; |
72 using PaymentRequestEventCallback = | |
73 base::Callback<void(ServiceWorkerStatusCode, | |
74 base::Time /* dispatch_event_time */)>; | |
75 using FetchCallback = | 72 using FetchCallback = |
76 base::Callback<void(ServiceWorkerStatusCode, | 73 base::Callback<void(ServiceWorkerStatusCode, |
77 base::Time /* dispatch_event_time */)>; | 74 base::Time /* dispatch_event_time */)>; |
78 | 75 |
79 // Returns a thread-specific client instance. This does NOT create a | 76 // Returns a thread-specific client instance. This does NOT create a |
80 // new instance. | 77 // new instance. |
81 static ServiceWorkerContextClient* ThreadSpecificInstance(); | 78 static ServiceWorkerContextClient* ThreadSpecificInstance(); |
82 | 79 |
83 // Called on the main thread. | 80 // Called on the main thread. |
84 ServiceWorkerContextClient( | 81 ServiceWorkerContextClient( |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 void didHandleNotificationCloseEvent( | 160 void didHandleNotificationCloseEvent( |
164 int request_id, | 161 int request_id, |
165 blink::WebServiceWorkerEventResult result, | 162 blink::WebServiceWorkerEventResult result, |
166 double dispatch_event_time) override; | 163 double dispatch_event_time) override; |
167 void didHandlePushEvent(int request_id, | 164 void didHandlePushEvent(int request_id, |
168 blink::WebServiceWorkerEventResult result, | 165 blink::WebServiceWorkerEventResult result, |
169 double dispatch_event_time) override; | 166 double dispatch_event_time) override; |
170 void didHandleSyncEvent(int request_id, | 167 void didHandleSyncEvent(int request_id, |
171 blink::WebServiceWorkerEventResult result, | 168 blink::WebServiceWorkerEventResult result, |
172 double dispatch_event_time) override; | 169 double dispatch_event_time) override; |
173 void didHandlePaymentRequestEvent(int request_id, | 170 void respondToPaymentRequestEvent( |
| 171 int payment_request_id, |
| 172 const blink::WebPaymentAppResponse& response, |
| 173 double dispatch_event_time) override; |
| 174 void didHandlePaymentRequestEvent(int payment_request_id, |
174 blink::WebServiceWorkerEventResult result, | 175 blink::WebServiceWorkerEventResult result, |
175 double dispatch_event_time) override; | 176 double dispatch_event_time) override; |
176 | 177 |
177 // Called on the main thread. | 178 // Called on the main thread. |
178 blink::WebServiceWorkerNetworkProvider* createServiceWorkerNetworkProvider() | 179 blink::WebServiceWorkerNetworkProvider* createServiceWorkerNetworkProvider() |
179 override; | 180 override; |
180 blink::WebServiceWorkerProvider* createServiceWorkerProvider() override; | 181 blink::WebServiceWorkerProvider* createServiceWorkerProvider() override; |
181 | 182 |
182 void postMessageToClient(const blink::WebString& uuid, | 183 void postMessageToClient(const blink::WebString& uuid, |
183 const blink::WebString& message, | 184 const blink::WebString& message, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 const std::string& notification_id, | 231 const std::string& notification_id, |
231 const PlatformNotificationData& notification_data, | 232 const PlatformNotificationData& notification_data, |
232 const DispatchNotificationCloseEventCallback& callback) override; | 233 const DispatchNotificationCloseEventCallback& callback) override; |
233 void DispatchPushEvent(const PushEventPayload& payload, | 234 void DispatchPushEvent(const PushEventPayload& payload, |
234 const DispatchPushEventCallback& callback) override; | 235 const DispatchPushEventCallback& callback) override; |
235 void DispatchSyncEvent( | 236 void DispatchSyncEvent( |
236 const std::string& tag, | 237 const std::string& tag, |
237 blink::mojom::BackgroundSyncEventLastChance last_chance, | 238 blink::mojom::BackgroundSyncEventLastChance last_chance, |
238 const DispatchSyncEventCallback& callback) override; | 239 const DispatchSyncEventCallback& callback) override; |
239 void DispatchPaymentRequestEvent( | 240 void DispatchPaymentRequestEvent( |
| 241 int payment_request_id, |
240 payments::mojom::PaymentAppRequestPtr app_request, | 242 payments::mojom::PaymentAppRequestPtr app_request, |
| 243 payments::mojom::PaymentAppResponseCallbackPtr response_callback, |
241 const DispatchPaymentRequestEventCallback& callback) override; | 244 const DispatchPaymentRequestEventCallback& callback) override; |
242 | 245 |
243 void OnInstallEvent(int request_id); | 246 void OnInstallEvent(int request_id); |
244 void OnNotificationClickEvent( | 247 void OnNotificationClickEvent( |
245 int request_id, | 248 int request_id, |
246 const std::string& notification_id, | 249 const std::string& notification_id, |
247 const PlatformNotificationData& notification_data, | 250 const PlatformNotificationData& notification_data, |
248 int action_index, | 251 int action_index, |
249 const base::NullableString16& reply); | 252 const base::NullableString16& reply); |
250 void OnNotificationCloseEvent( | 253 void OnNotificationCloseEvent( |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 // Initialized on the worker thread in workerContextStarted and | 313 // Initialized on the worker thread in workerContextStarted and |
311 // destructed on the worker thread in willDestroyWorkerContext. | 314 // destructed on the worker thread in willDestroyWorkerContext. |
312 std::unique_ptr<WorkerContextData> context_; | 315 std::unique_ptr<WorkerContextData> context_; |
313 | 316 |
314 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextClient); | 317 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextClient); |
315 }; | 318 }; |
316 | 319 |
317 } // namespace content | 320 } // namespace content |
318 | 321 |
319 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ | 322 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ |
OLD | NEW |