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