| 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 21 matching lines...) Expand all Loading... |
| 32 #include "v8/include/v8.h" | 32 #include "v8/include/v8.h" |
| 33 | 33 |
| 34 struct ServiceWorkerMsg_ExtendableMessageEvent_Params; | 34 struct ServiceWorkerMsg_ExtendableMessageEvent_Params; |
| 35 | 35 |
| 36 namespace base { | 36 namespace base { |
| 37 class SingleThreadTaskRunner; | 37 class SingleThreadTaskRunner; |
| 38 class TaskRunner; | 38 class TaskRunner; |
| 39 } | 39 } |
| 40 | 40 |
| 41 namespace blink { | 41 namespace blink { |
| 42 class WebDataConsumerHandle; |
| 42 class WebDataSource; | 43 class WebDataSource; |
| 43 struct WebServiceWorkerClientQueryOptions; | 44 struct WebServiceWorkerClientQueryOptions; |
| 44 class WebServiceWorkerContextProxy; | 45 class WebServiceWorkerContextProxy; |
| 45 class WebServiceWorkerProvider; | 46 class WebServiceWorkerProvider; |
| 47 class WebServiceWorkerResponse; |
| 46 struct WebSyncRegistration; | 48 struct WebSyncRegistration; |
| 47 } | 49 } |
| 48 | 50 |
| 49 namespace IPC { | 51 namespace IPC { |
| 50 class Message; | 52 class Message; |
| 51 } | 53 } |
| 52 | 54 |
| 53 namespace content { | 55 namespace content { |
| 54 | 56 |
| 55 struct PlatformNotificationData; | 57 struct PlatformNotificationData; |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 const blink::WebVector<blink::WebSecurityOrigin>& origins) override; | 197 const blink::WebVector<blink::WebSecurityOrigin>& origins) override; |
| 196 | 198 |
| 197 virtual void DispatchSyncEvent( | 199 virtual void DispatchSyncEvent( |
| 198 const std::string& tag, | 200 const std::string& tag, |
| 199 blink::WebServiceWorkerContextProxy::LastChanceOption last_chance, | 201 blink::WebServiceWorkerContextProxy::LastChanceOption last_chance, |
| 200 const SyncCallback& callback); | 202 const SyncCallback& callback); |
| 201 | 203 |
| 202 private: | 204 private: |
| 203 struct WorkerContextData; | 205 struct WorkerContextData; |
| 204 class FetchEventDispatcherImpl; | 206 class FetchEventDispatcherImpl; |
| 207 class NavigationPreloadRequest; |
| 205 | 208 |
| 206 // Get routing_id for sending message to the ServiceWorkerVersion | 209 // Get routing_id for sending message to the ServiceWorkerVersion |
| 207 // in the browser process. | 210 // in the browser process. |
| 208 int GetRoutingID() const { return embedded_worker_id_; } | 211 int GetRoutingID() const { return embedded_worker_id_; } |
| 209 | 212 |
| 210 void Send(IPC::Message* message); | 213 void Send(IPC::Message* message); |
| 211 void SendWorkerStarted(); | 214 void SendWorkerStarted(); |
| 212 void SetRegistrationInServiceWorkerGlobalScope( | 215 void SetRegistrationInServiceWorkerGlobalScope( |
| 213 const ServiceWorkerRegistrationObjectInfo& info, | 216 const ServiceWorkerRegistrationObjectInfo& info, |
| 214 const ServiceWorkerVersionAttributes& attrs); | 217 const ServiceWorkerVersionAttributes& attrs); |
| 215 | 218 |
| 216 void OnActivateEvent(int request_id); | 219 void OnActivateEvent(int request_id); |
| 217 void OnExtendableMessageEvent( | 220 void OnExtendableMessageEvent( |
| 218 int request_id, | 221 int request_id, |
| 219 const ServiceWorkerMsg_ExtendableMessageEvent_Params& params); | 222 const ServiceWorkerMsg_ExtendableMessageEvent_Params& params); |
| 220 void OnInstallEvent(int request_id); | 223 void OnInstallEvent(int request_id); |
| 221 void DispatchFetchEvent(int fetch_event_id, | 224 void DispatchFetchEvent( |
| 222 const ServiceWorkerFetchRequest& request, | 225 int fetch_event_id, |
| 223 const FetchCallback& callback); | 226 const ServiceWorkerFetchRequest& request, |
| 227 std::unique_ptr<NavigationPreloadRequest> preload_request, |
| 228 const FetchCallback& callback); |
| 224 void OnNotificationClickEvent( | 229 void OnNotificationClickEvent( |
| 225 int request_id, | 230 int request_id, |
| 226 const std::string& notification_id, | 231 const std::string& notification_id, |
| 227 const PlatformNotificationData& notification_data, | 232 const PlatformNotificationData& notification_data, |
| 228 int action_index, | 233 int action_index, |
| 229 const base::NullableString16& reply); | 234 const base::NullableString16& reply); |
| 230 void OnPushEvent(int request_id, const PushEventPayload& payload); | 235 void OnPushEvent(int request_id, const PushEventPayload& payload); |
| 231 void OnNotificationCloseEvent( | 236 void OnNotificationCloseEvent( |
| 232 int request_id, | 237 int request_id, |
| 233 const std::string& notification_id, | 238 const std::string& notification_id, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 244 void OnNavigateClientResponse(int request_id, | 249 void OnNavigateClientResponse(int request_id, |
| 245 const ServiceWorkerClientInfo& client); | 250 const ServiceWorkerClientInfo& client); |
| 246 void OnNavigateClientError(int request_id, const GURL& url); | 251 void OnNavigateClientError(int request_id, const GURL& url); |
| 247 void OnDidSkipWaiting(int request_id); | 252 void OnDidSkipWaiting(int request_id); |
| 248 void OnDidClaimClients(int request_id); | 253 void OnDidClaimClients(int request_id); |
| 249 void OnClaimClientsError(int request_id, | 254 void OnClaimClientsError(int request_id, |
| 250 blink::WebServiceWorkerError::ErrorType error_type, | 255 blink::WebServiceWorkerError::ErrorType error_type, |
| 251 const base::string16& message); | 256 const base::string16& message); |
| 252 void OnPing(); | 257 void OnPing(); |
| 253 | 258 |
| 259 void OnNavigationPreloadResponse( |
| 260 int fetch_event_id, |
| 261 std::unique_ptr<blink::WebServiceWorkerResponse> response, |
| 262 std::unique_ptr<blink::WebDataConsumerHandle> data_consumer_handle); |
| 263 void OnNavigationPreloadError( |
| 264 int fetch_event_id, |
| 265 std::unique_ptr<blink::WebServiceWorkerError> error); |
| 266 |
| 254 base::WeakPtr<ServiceWorkerContextClient> GetWeakPtr(); | 267 base::WeakPtr<ServiceWorkerContextClient> GetWeakPtr(); |
| 255 | 268 |
| 256 const int embedded_worker_id_; | 269 const int embedded_worker_id_; |
| 257 const int64_t service_worker_version_id_; | 270 const int64_t service_worker_version_id_; |
| 258 const GURL service_worker_scope_; | 271 const GURL service_worker_scope_; |
| 259 const GURL script_url_; | 272 const GURL script_url_; |
| 260 const int worker_devtools_agent_route_id_; | 273 const int worker_devtools_agent_route_id_; |
| 261 scoped_refptr<ThreadSafeSender> sender_; | 274 scoped_refptr<ThreadSafeSender> sender_; |
| 262 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; | 275 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; |
| 263 scoped_refptr<base::TaskRunner> worker_task_runner_; | 276 scoped_refptr<base::TaskRunner> worker_task_runner_; |
| 264 | 277 |
| 265 scoped_refptr<ServiceWorkerProviderContext> provider_context_; | 278 scoped_refptr<ServiceWorkerProviderContext> provider_context_; |
| 266 | 279 |
| 267 // Not owned; this object is destroyed when proxy_ becomes invalid. | 280 // Not owned; this object is destroyed when proxy_ becomes invalid. |
| 268 blink::WebServiceWorkerContextProxy* proxy_; | 281 blink::WebServiceWorkerContextProxy* proxy_; |
| 269 | 282 |
| 270 // Renderer-side object corresponding to WebEmbeddedWorkerInstance | 283 // Renderer-side object corresponding to WebEmbeddedWorkerInstance |
| 271 std::unique_ptr<EmbeddedWorkerInstanceClientImpl> embedded_worker_client_; | 284 std::unique_ptr<EmbeddedWorkerInstanceClientImpl> embedded_worker_client_; |
| 272 | 285 |
| 273 // Initialized on the worker thread in workerContextStarted and | 286 // Initialized on the worker thread in workerContextStarted and |
| 274 // destructed on the worker thread in willDestroyWorkerContext. | 287 // destructed on the worker thread in willDestroyWorkerContext. |
| 275 std::unique_ptr<WorkerContextData> context_; | 288 std::unique_ptr<WorkerContextData> context_; |
| 276 | 289 |
| 277 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextClient); | 290 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextClient); |
| 278 }; | 291 }; |
| 279 | 292 |
| 280 } // namespace content | 293 } // namespace content |
| 281 | 294 |
| 282 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ | 295 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ |
| OLD | NEW |