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

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

Issue 1904163002: Move Web Notifications to use Mojo Base URL: https://chromium.googlesource.com/chromium/src.git@skbitmap-blink
Patch Set: it works \o/ Created 4 years, 7 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 class WebServiceWorkerProvider; 45 class WebServiceWorkerProvider;
46 struct WebSyncRegistration; 46 struct WebSyncRegistration;
47 } 47 }
48 48
49 namespace IPC { 49 namespace IPC {
50 class Message; 50 class Message;
51 } 51 }
52 52
53 namespace content { 53 namespace content {
54 54
55 struct PlatformNotificationData;
56 struct PushEventPayload; 55 struct PushEventPayload;
57 struct ServiceWorkerClientInfo; 56 struct ServiceWorkerClientInfo;
58 class ServiceWorkerProviderContext; 57 class ServiceWorkerProviderContext;
59 class ServiceWorkerContextClient; 58 class ServiceWorkerContextClient;
60 class ThreadSafeSender; 59 class ThreadSafeSender;
61 class WebServiceWorkerRegistrationImpl; 60 class WebServiceWorkerRegistrationImpl;
62 61
63 // This class provides access to/from an ServiceWorker's WorkerGlobalScope. 62 // This class provides access to/from an ServiceWorker's WorkerGlobalScope.
64 // Unless otherwise noted, all methods are called on the worker thread. 63 // Unless otherwise noted, all methods are called on the worker thread.
65 class ServiceWorkerContextClient 64 class ServiceWorkerContextClient
66 : public blink::WebServiceWorkerContextClient { 65 : public blink::WebServiceWorkerContextClient {
67 public: 66 public:
68 using SyncCallback = mojo::Callback<void(mojom::ServiceWorkerEventStatus)>; 67 using MojoStatusCallback =
68 mojo::Callback<void(mojom::ServiceWorkerEventStatus)>;
69 69
70 // Returns a thread-specific client instance. This does NOT create a 70 // Returns a thread-specific client instance. This does NOT create a
71 // new instance. 71 // new instance.
72 static ServiceWorkerContextClient* ThreadSpecificInstance(); 72 static ServiceWorkerContextClient* ThreadSpecificInstance();
73 73
74 // Called on the main thread. 74 // Called on the main thread.
75 ServiceWorkerContextClient(int embedded_worker_id, 75 ServiceWorkerContextClient(int embedded_worker_id,
76 int64_t service_worker_version_id, 76 int64_t service_worker_version_id,
77 const GURL& service_worker_scope, 77 const GURL& service_worker_scope,
78 const GURL& script_url, 78 const GURL& script_url,
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 void navigate(const blink::WebString& uuid, 167 void navigate(const blink::WebString& uuid,
168 const blink::WebURL&, 168 const blink::WebURL&,
169 blink::WebServiceWorkerClientCallbacks*) override; 169 blink::WebServiceWorkerClientCallbacks*) override;
170 void skipWaiting( 170 void skipWaiting(
171 blink::WebServiceWorkerSkipWaitingCallbacks* callbacks) override; 171 blink::WebServiceWorkerSkipWaitingCallbacks* callbacks) override;
172 void claim(blink::WebServiceWorkerClientsClaimCallbacks* callbacks) override; 172 void claim(blink::WebServiceWorkerClientsClaimCallbacks* callbacks) override;
173 void registerForeignFetchScopes( 173 void registerForeignFetchScopes(
174 const blink::WebVector<blink::WebURL>& sub_scopes, 174 const blink::WebVector<blink::WebURL>& sub_scopes,
175 const blink::WebVector<blink::WebSecurityOrigin>& origins) override; 175 const blink::WebVector<blink::WebSecurityOrigin>& origins) override;
176 176
177 virtual void DispatchSyncEvent( 177 void DispatchSyncEvent(
178 const std::string& tag, 178 const std::string& tag,
179 blink::WebServiceWorkerContextProxy::LastChanceOption last_chance, 179 blink::WebServiceWorkerContextProxy::LastChanceOption last_chance,
180 const SyncCallback& callback); 180 const MojoStatusCallback& callback);
181
182 void DispatchNotificationClickEvent(
183 blink::mojom::blink::NotificationPtr notification,
184 int32_t action_index,
185 const MojoStatusCallback& callback);
186
187 void DispatchNotificationCloseEvent(
188 blink::mojom::blink::NotificationPtr notification,
189 const MojoStatusCallback& callback);
181 190
182 private: 191 private:
183 struct WorkerContextData; 192 struct WorkerContextData;
184 193
185 // Get routing_id for sending message to the ServiceWorkerVersion 194 // Get routing_id for sending message to the ServiceWorkerVersion
186 // in the browser process. 195 // in the browser process.
187 int GetRoutingID() const { return embedded_worker_id_; } 196 int GetRoutingID() const { return embedded_worker_id_; }
188 197
189 void Send(IPC::Message* message); 198 void Send(IPC::Message* message);
190 void SendWorkerStarted(); 199 void SendWorkerStarted();
191 void SetRegistrationInServiceWorkerGlobalScope( 200 void SetRegistrationInServiceWorkerGlobalScope(
192 const ServiceWorkerRegistrationObjectInfo& info, 201 const ServiceWorkerRegistrationObjectInfo& info,
193 const ServiceWorkerVersionAttributes& attrs); 202 const ServiceWorkerVersionAttributes& attrs);
194 203
195 void OnActivateEvent(int request_id); 204 void OnActivateEvent(int request_id);
196 void OnExtendableMessageEvent( 205 void OnExtendableMessageEvent(
197 int request_id, 206 int request_id,
198 const ServiceWorkerMsg_ExtendableMessageEvent_Params& params); 207 const ServiceWorkerMsg_ExtendableMessageEvent_Params& params);
199 void OnInstallEvent(int request_id); 208 void OnInstallEvent(int request_id);
200 void OnFetchEvent(int request_id, const ServiceWorkerFetchRequest& request); 209 void OnFetchEvent(int request_id, const ServiceWorkerFetchRequest& request);
201 void OnNotificationClickEvent(
202 int request_id,
203 int64_t persistent_notification_id,
204 const PlatformNotificationData& notification_data,
205 int action_index);
206 void OnPushEvent(int request_id, const PushEventPayload& payload); 210 void OnPushEvent(int request_id, const PushEventPayload& payload);
207 void OnNotificationCloseEvent(
208 int request_id,
209 int64_t persistent_notification_id,
210 const PlatformNotificationData& notification_data);
211 void OnGeofencingEvent(int request_id, 211 void OnGeofencingEvent(int request_id,
212 blink::WebGeofencingEventType event_type, 212 blink::WebGeofencingEventType event_type,
213 const std::string& region_id, 213 const std::string& region_id,
214 const blink::WebCircularGeofencingRegion& region); 214 const blink::WebCircularGeofencingRegion& region);
215 215
216 void OnDidGetClient(int request_id, const ServiceWorkerClientInfo& client); 216 void OnDidGetClient(int request_id, const ServiceWorkerClientInfo& client);
217 void OnDidGetClients( 217 void OnDidGetClients(
218 int request_id, const std::vector<ServiceWorkerClientInfo>& clients); 218 int request_id, const std::vector<ServiceWorkerClientInfo>& clients);
219 void OnOpenWindowResponse(int request_id, 219 void OnOpenWindowResponse(int request_id,
220 const ServiceWorkerClientInfo& client); 220 const ServiceWorkerClientInfo& client);
(...skipping 29 matching lines...) Expand all
250 // Initialized on the worker thread in workerContextStarted and 250 // Initialized on the worker thread in workerContextStarted and
251 // destructed on the worker thread in willDestroyWorkerContext. 251 // destructed on the worker thread in willDestroyWorkerContext.
252 std::unique_ptr<WorkerContextData> context_; 252 std::unique_ptr<WorkerContextData> context_;
253 253
254 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextClient); 254 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextClient);
255 }; 255 };
256 256
257 } // namespace content 257 } // namespace content
258 258
259 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ 259 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698