| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 FetchCallback = | 72 using FetchCallback = |
| 73 base::Callback<void(ServiceWorkerStatusCode, | 73 base::Callback<void(ServiceWorkerStatusCode, |
| 74 base::Time /* dispatch_event_time */)>; | 74 base::Time /* dispatch_event_time */)>; |
| 75 using PaymentRequestEventCallback = |
| 76 base::Callback<void(ServiceWorkerStatusCode, |
| 77 base::Time /* dispatch_event_time */)>; |
| 75 | 78 |
| 76 // Returns a thread-specific client instance. This does NOT create a | 79 // Returns a thread-specific client instance. This does NOT create a |
| 77 // new instance. | 80 // new instance. |
| 78 static ServiceWorkerContextClient* ThreadSpecificInstance(); | 81 static ServiceWorkerContextClient* ThreadSpecificInstance(); |
| 79 | 82 |
| 80 // Called on the main thread. | 83 // Called on the main thread. |
| 81 ServiceWorkerContextClient( | 84 ServiceWorkerContextClient( |
| 82 int embedded_worker_id, | 85 int embedded_worker_id, |
| 83 int64_t service_worker_version_id, | 86 int64_t service_worker_version_id, |
| 84 const GURL& service_worker_scope, | 87 const GURL& service_worker_scope, |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 double dispatch_event_time) override; | 155 double dispatch_event_time) override; |
| 153 void DidHandleExtendableMessageEvent( | 156 void DidHandleExtendableMessageEvent( |
| 154 int request_id, | 157 int request_id, |
| 155 blink::WebServiceWorkerEventResult result, | 158 blink::WebServiceWorkerEventResult result, |
| 156 double dispatch_event_time) override; | 159 double dispatch_event_time) override; |
| 157 void DidHandleInstallEvent(int request_id, | 160 void DidHandleInstallEvent(int request_id, |
| 158 blink::WebServiceWorkerEventResult result, | 161 blink::WebServiceWorkerEventResult result, |
| 159 double event_dispatch_time) override; | 162 double event_dispatch_time) override; |
| 160 void RespondToFetchEvent(int fetch_event_id, | 163 void RespondToFetchEvent(int fetch_event_id, |
| 161 double event_dispatch_time) override; | 164 double event_dispatch_time) override; |
| 162 void RespondToFetchEvent(int fetch_event_id, | 165 void RespondToFetchEventWithResponse( |
| 163 const blink::WebServiceWorkerResponse& response, | 166 int fetch_event_id, |
| 164 double event_dispatch_time) override; | 167 const blink::WebServiceWorkerResponse& response, |
| 168 double event_dispatch_time) override; |
| 169 void RespondToFetchEventWithResponseStream( |
| 170 int fetch_event_id, |
| 171 const blink::WebServiceWorkerResponse& response, |
| 172 blink::WebServiceWorkerStreamHandle* web_stream_handle, |
| 173 double event_dispatch_time) override; |
| 165 void DidHandleFetchEvent(int fetch_event_id, | 174 void DidHandleFetchEvent(int fetch_event_id, |
| 166 blink::WebServiceWorkerEventResult result, | 175 blink::WebServiceWorkerEventResult result, |
| 167 double dispatch_event_time) override; | 176 double dispatch_event_time) override; |
| 168 void DidHandleNotificationClickEvent( | 177 void DidHandleNotificationClickEvent( |
| 169 int request_id, | 178 int request_id, |
| 170 blink::WebServiceWorkerEventResult result, | 179 blink::WebServiceWorkerEventResult result, |
| 171 double dispatch_event_time) override; | 180 double dispatch_event_time) override; |
| 172 void DidHandleNotificationCloseEvent( | 181 void DidHandleNotificationCloseEvent( |
| 173 int request_id, | 182 int request_id, |
| 174 blink::WebServiceWorkerEventResult result, | 183 blink::WebServiceWorkerEventResult result, |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 const std::string& tag, | 246 const std::string& tag, |
| 238 const std::vector<BackgroundFetchSettledFetch>& fetches, | 247 const std::vector<BackgroundFetchSettledFetch>& fetches, |
| 239 const DispatchBackgroundFetchFailEventCallback& callback) override; | 248 const DispatchBackgroundFetchFailEventCallback& callback) override; |
| 240 void DispatchBackgroundFetchedEvent( | 249 void DispatchBackgroundFetchedEvent( |
| 241 const std::string& tag, | 250 const std::string& tag, |
| 242 const std::vector<BackgroundFetchSettledFetch>& fetches, | 251 const std::vector<BackgroundFetchSettledFetch>& fetches, |
| 243 const DispatchBackgroundFetchedEventCallback& callback) override; | 252 const DispatchBackgroundFetchedEventCallback& callback) override; |
| 244 void DispatchExtendableMessageEvent( | 253 void DispatchExtendableMessageEvent( |
| 245 mojom::ExtendableMessageEventPtr event, | 254 mojom::ExtendableMessageEventPtr event, |
| 246 const DispatchExtendableMessageEventCallback& callback) override; | 255 const DispatchExtendableMessageEventCallback& callback) override; |
| 247 void DispatchFetchEvent(int fetch_event_id, | 256 void DispatchFetchEvent( |
| 248 const ServiceWorkerFetchRequest& request, | 257 int fetch_event_id, |
| 249 mojom::FetchEventPreloadHandlePtr preload_handle, | 258 const ServiceWorkerFetchRequest& request, |
| 250 const DispatchFetchEventCallback& callback) override; | 259 mojom::FetchEventPreloadHandlePtr preload_handle, |
| 260 mojom::ServiceWorkerFetchResponseCallbackPtr response_callback, |
| 261 const DispatchFetchEventCallback& callback) override; |
| 251 void DispatchNotificationClickEvent( | 262 void DispatchNotificationClickEvent( |
| 252 const std::string& notification_id, | 263 const std::string& notification_id, |
| 253 const PlatformNotificationData& notification_data, | 264 const PlatformNotificationData& notification_data, |
| 254 int action_index, | 265 int action_index, |
| 255 const base::Optional<base::string16>& reply, | 266 const base::Optional<base::string16>& reply, |
| 256 const DispatchNotificationClickEventCallback& callback) override; | 267 const DispatchNotificationClickEventCallback& callback) override; |
| 257 void DispatchNotificationCloseEvent( | 268 void DispatchNotificationCloseEvent( |
| 258 const std::string& notification_id, | 269 const std::string& notification_id, |
| 259 const PlatformNotificationData& notification_data, | 270 const PlatformNotificationData& notification_data, |
| 260 const DispatchNotificationCloseEventCallback& callback) override; | 271 const DispatchNotificationCloseEventCallback& callback) override; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 // Initialized on the worker thread in workerContextStarted and | 350 // Initialized on the worker thread in workerContextStarted and |
| 340 // destructed on the worker thread in willDestroyWorkerContext. | 351 // destructed on the worker thread in willDestroyWorkerContext. |
| 341 std::unique_ptr<WorkerContextData> context_; | 352 std::unique_ptr<WorkerContextData> context_; |
| 342 | 353 |
| 343 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextClient); | 354 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextClient); |
| 344 }; | 355 }; |
| 345 | 356 |
| 346 } // namespace content | 357 } // namespace content |
| 347 | 358 |
| 348 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ | 359 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ |
| OLD | NEW |