| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 void didHandleNotificationCloseEvent( | 172 void didHandleNotificationCloseEvent( |
| 176 int request_id, | 173 int request_id, |
| 177 blink::WebServiceWorkerEventResult result, | 174 blink::WebServiceWorkerEventResult result, |
| 178 double dispatch_event_time) override; | 175 double dispatch_event_time) override; |
| 179 void didHandlePushEvent(int request_id, | 176 void didHandlePushEvent(int request_id, |
| 180 blink::WebServiceWorkerEventResult result, | 177 blink::WebServiceWorkerEventResult result, |
| 181 double dispatch_event_time) override; | 178 double dispatch_event_time) override; |
| 182 void didHandleSyncEvent(int request_id, | 179 void didHandleSyncEvent(int request_id, |
| 183 blink::WebServiceWorkerEventResult result, | 180 blink::WebServiceWorkerEventResult result, |
| 184 double dispatch_event_time) override; | 181 double dispatch_event_time) override; |
| 185 void didHandlePaymentRequestEvent(int request_id, | 182 void respondToPaymentRequestEvent( |
| 183 int payment_request_id, |
| 184 const blink::WebPaymentAppResponse& response, |
| 185 double dispatch_event_time) override; |
| 186 void didHandlePaymentRequestEvent(int payment_request_id, |
| 186 blink::WebServiceWorkerEventResult result, | 187 blink::WebServiceWorkerEventResult result, |
| 187 double dispatch_event_time) override; | 188 double dispatch_event_time) override; |
| 188 | 189 |
| 189 // Called on the main thread. | 190 // Called on the main thread. |
| 190 blink::WebServiceWorkerNetworkProvider* createServiceWorkerNetworkProvider() | 191 blink::WebServiceWorkerNetworkProvider* createServiceWorkerNetworkProvider() |
| 191 override; | 192 override; |
| 192 blink::WebServiceWorkerProvider* createServiceWorkerProvider() override; | 193 blink::WebServiceWorkerProvider* createServiceWorkerProvider() override; |
| 193 | 194 |
| 194 void postMessageToClient(const blink::WebString& uuid, | 195 void postMessageToClient(const blink::WebString& uuid, |
| 195 const blink::WebString& message, | 196 const blink::WebString& message, |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 const std::string& notification_id, | 258 const std::string& notification_id, |
| 258 const PlatformNotificationData& notification_data, | 259 const PlatformNotificationData& notification_data, |
| 259 const DispatchNotificationCloseEventCallback& callback) override; | 260 const DispatchNotificationCloseEventCallback& callback) override; |
| 260 void DispatchPushEvent(const PushEventPayload& payload, | 261 void DispatchPushEvent(const PushEventPayload& payload, |
| 261 const DispatchPushEventCallback& callback) override; | 262 const DispatchPushEventCallback& callback) override; |
| 262 void DispatchSyncEvent( | 263 void DispatchSyncEvent( |
| 263 const std::string& tag, | 264 const std::string& tag, |
| 264 blink::mojom::BackgroundSyncEventLastChance last_chance, | 265 blink::mojom::BackgroundSyncEventLastChance last_chance, |
| 265 const DispatchSyncEventCallback& callback) override; | 266 const DispatchSyncEventCallback& callback) override; |
| 266 void DispatchPaymentRequestEvent( | 267 void DispatchPaymentRequestEvent( |
| 268 int payment_request_id, |
| 267 payments::mojom::PaymentAppRequestPtr app_request, | 269 payments::mojom::PaymentAppRequestPtr app_request, |
| 270 payments::mojom::PaymentAppResponseCallbackPtr response_callback, |
| 268 const DispatchPaymentRequestEventCallback& callback) override; | 271 const DispatchPaymentRequestEventCallback& callback) override; |
| 269 void Ping(const PingCallback& callback) override; | 272 void Ping(const PingCallback& callback) override; |
| 270 | 273 |
| 271 void OnInstallEvent(int request_id); | 274 void OnInstallEvent(int request_id); |
| 272 void OnNotificationClickEvent( | 275 void OnNotificationClickEvent( |
| 273 int request_id, | 276 int request_id, |
| 274 const std::string& notification_id, | 277 const std::string& notification_id, |
| 275 const PlatformNotificationData& notification_data, | 278 const PlatformNotificationData& notification_data, |
| 276 int action_index, | 279 int action_index, |
| 277 const base::NullableString16& reply); | 280 const base::NullableString16& reply); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 // Initialized on the worker thread in workerContextStarted and | 339 // Initialized on the worker thread in workerContextStarted and |
| 337 // destructed on the worker thread in willDestroyWorkerContext. | 340 // destructed on the worker thread in willDestroyWorkerContext. |
| 338 std::unique_ptr<WorkerContextData> context_; | 341 std::unique_ptr<WorkerContextData> context_; |
| 339 | 342 |
| 340 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextClient); | 343 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextClient); |
| 341 }; | 344 }; |
| 342 | 345 |
| 343 } // namespace content | 346 } // namespace content |
| 344 | 347 |
| 345 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ | 348 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ |
| OLD | NEW |