Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(373)

Side by Side Diff: content/renderer/service_worker/service_worker_context_client.h

Issue 2824193002: Enable use_once_callback for //content/common/*.mojom (Closed)
Patch Set: push_messaging fix Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 class ServiceWorkerContextClient; 61 class ServiceWorkerContextClient;
62 class ThreadSafeSender; 62 class ThreadSafeSender;
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::OnceCallback<void(ServiceWorkerStatusCode,
72 base::Time /* dispatch_event_time */)>; 72 base::Time /* dispatch_event_time */)>;
73 using FetchCallback = 73 using FetchCallback =
74 base::Callback<void(ServiceWorkerStatusCode, 74 base::OnceCallback<void(ServiceWorkerStatusCode,
75 base::Time /* dispatch_event_time */)>; 75 base::Time /* dispatch_event_time */)>;
76 76
77 // Returns a thread-specific client instance. This does NOT create a 77 // Returns a thread-specific client instance. This does NOT create a
78 // new instance. 78 // new instance.
79 static ServiceWorkerContextClient* ThreadSpecificInstance(); 79 static ServiceWorkerContextClient* ThreadSpecificInstance();
80 80
81 // Called on the main thread. 81 // Called on the main thread.
82 ServiceWorkerContextClient( 82 ServiceWorkerContextClient(
83 int embedded_worker_id, 83 int embedded_worker_id,
84 int64_t service_worker_version_id, 84 int64_t service_worker_version_id,
85 const GURL& service_worker_scope, 85 const GURL& service_worker_scope,
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 // in the browser process. 219 // in the browser process.
220 int GetRoutingID() const { return embedded_worker_id_; } 220 int GetRoutingID() const { return embedded_worker_id_; }
221 221
222 void Send(IPC::Message* message); 222 void Send(IPC::Message* message);
223 void SendWorkerStarted(); 223 void SendWorkerStarted();
224 void SetRegistrationInServiceWorkerGlobalScope( 224 void SetRegistrationInServiceWorkerGlobalScope(
225 const ServiceWorkerRegistrationObjectInfo& info, 225 const ServiceWorkerRegistrationObjectInfo& info,
226 const ServiceWorkerVersionAttributes& attrs); 226 const ServiceWorkerVersionAttributes& attrs);
227 227
228 // mojom::ServiceWorkerEventDispatcher 228 // mojom::ServiceWorkerEventDispatcher
229 void DispatchActivateEvent( 229 void DispatchActivateEvent(DispatchActivateEventCallback callback) override;
230 const DispatchActivateEventCallback& callback) override;
231 void DispatchBackgroundFetchAbortEvent( 230 void DispatchBackgroundFetchAbortEvent(
232 const std::string& tag, 231 const std::string& tag,
233 const DispatchBackgroundFetchAbortEventCallback& callback) override; 232 DispatchBackgroundFetchAbortEventCallback callback) override;
234 void DispatchBackgroundFetchClickEvent( 233 void DispatchBackgroundFetchClickEvent(
235 const std::string& tag, 234 const std::string& tag,
236 mojom::BackgroundFetchState state, 235 mojom::BackgroundFetchState state,
237 const DispatchBackgroundFetchClickEventCallback& callback) override; 236 DispatchBackgroundFetchClickEventCallback callback) override;
238 void DispatchBackgroundFetchFailEvent( 237 void DispatchBackgroundFetchFailEvent(
239 const std::string& tag, 238 const std::string& tag,
240 const std::vector<BackgroundFetchSettledFetch>& fetches, 239 const std::vector<BackgroundFetchSettledFetch>& fetches,
241 const DispatchBackgroundFetchFailEventCallback& callback) override; 240 DispatchBackgroundFetchFailEventCallback callback) override;
242 void DispatchBackgroundFetchedEvent( 241 void DispatchBackgroundFetchedEvent(
243 const std::string& tag, 242 const std::string& tag,
244 const std::vector<BackgroundFetchSettledFetch>& fetches, 243 const std::vector<BackgroundFetchSettledFetch>& fetches,
245 const DispatchBackgroundFetchedEventCallback& callback) override; 244 DispatchBackgroundFetchedEventCallback callback) override;
246 void DispatchExtendableMessageEvent( 245 void DispatchExtendableMessageEvent(
247 mojom::ExtendableMessageEventPtr event, 246 mojom::ExtendableMessageEventPtr event,
248 const DispatchExtendableMessageEventCallback& callback) override; 247 DispatchExtendableMessageEventCallback callback) override;
249 void DispatchFetchEvent(int fetch_event_id, 248 void DispatchFetchEvent(int fetch_event_id,
250 const ServiceWorkerFetchRequest& request, 249 const ServiceWorkerFetchRequest& request,
251 mojom::FetchEventPreloadHandlePtr preload_handle, 250 mojom::FetchEventPreloadHandlePtr preload_handle,
252 const DispatchFetchEventCallback& callback) override; 251 DispatchFetchEventCallback callback) override;
253 void DispatchNotificationClickEvent( 252 void DispatchNotificationClickEvent(
254 const std::string& notification_id, 253 const std::string& notification_id,
255 const PlatformNotificationData& notification_data, 254 const PlatformNotificationData& notification_data,
256 int action_index, 255 int action_index,
257 const base::Optional<base::string16>& reply, 256 const base::Optional<base::string16>& reply,
258 const DispatchNotificationClickEventCallback& callback) override; 257 DispatchNotificationClickEventCallback callback) override;
259 void DispatchNotificationCloseEvent( 258 void DispatchNotificationCloseEvent(
260 const std::string& notification_id, 259 const std::string& notification_id,
261 const PlatformNotificationData& notification_data, 260 const PlatformNotificationData& notification_data,
262 const DispatchNotificationCloseEventCallback& callback) override; 261 DispatchNotificationCloseEventCallback callback) override;
263 void DispatchPushEvent(const PushEventPayload& payload, 262 void DispatchPushEvent(const PushEventPayload& payload,
264 const DispatchPushEventCallback& callback) override; 263 DispatchPushEventCallback callback) override;
265 void DispatchSyncEvent( 264 void DispatchSyncEvent(
266 const std::string& tag, 265 const std::string& tag,
267 blink::mojom::BackgroundSyncEventLastChance last_chance, 266 blink::mojom::BackgroundSyncEventLastChance last_chance,
268 const DispatchSyncEventCallback& callback) override; 267 DispatchSyncEventCallback callback) override;
269 void DispatchPaymentRequestEvent( 268 void DispatchPaymentRequestEvent(
270 int payment_request_id, 269 int payment_request_id,
271 payments::mojom::PaymentAppRequestPtr app_request, 270 payments::mojom::PaymentAppRequestPtr app_request,
272 payments::mojom::PaymentAppResponseCallbackPtr response_callback, 271 payments::mojom::PaymentAppResponseCallbackPtr response_callback,
273 const DispatchPaymentRequestEventCallback& callback) override; 272 DispatchPaymentRequestEventCallback callback) override;
274 void Ping(const PingCallback& callback) override; 273 void Ping(PingCallback callback) override;
275 274
276 void OnInstallEvent(int request_id); 275 void OnInstallEvent(int request_id);
277 void OnNotificationClickEvent( 276 void OnNotificationClickEvent(
278 int request_id, 277 int request_id,
279 const std::string& notification_id, 278 const std::string& notification_id,
280 const PlatformNotificationData& notification_data, 279 const PlatformNotificationData& notification_data,
281 int action_index, 280 int action_index,
282 const base::NullableString16& reply); 281 const base::NullableString16& reply);
283 void OnNotificationCloseEvent( 282 void OnNotificationCloseEvent(
284 int request_id, 283 int request_id,
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 // Initialized on the worker thread in workerContextStarted and 344 // Initialized on the worker thread in workerContextStarted and
346 // destructed on the worker thread in willDestroyWorkerContext. 345 // destructed on the worker thread in willDestroyWorkerContext.
347 std::unique_ptr<WorkerContextData> context_; 346 std::unique_ptr<WorkerContextData> context_;
348 347
349 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextClient); 348 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextClient);
350 }; 349 };
351 350
352 } // namespace content 351 } // namespace content
353 352
354 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ 353 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698