Chromium Code Reviews| 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 <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/id_map.h" | 12 #include "base/id_map.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
| 16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 17 #include "content/child/webmessageportchannel_impl.h" | 17 #include "content/child/webmessageportchannel_impl.h" |
| 18 #include "content/common/background_sync_service.mojom.h" | |
| 18 #include "content/common/service_worker/service_worker_types.h" | 19 #include "content/common/service_worker/service_worker_types.h" |
| 19 #include "ipc/ipc_listener.h" | 20 #include "ipc/ipc_listener.h" |
| 20 #include "third_party/WebKit/public/platform/WebGeofencingEventType.h" | 21 #include "third_party/WebKit/public/platform/WebGeofencingEventType.h" |
| 21 #include "third_party/WebKit/public/platform/WebMessagePortChannel.h" | 22 #include "third_party/WebKit/public/platform/WebMessagePortChannel.h" |
| 22 #include "third_party/WebKit/public/platform/WebServiceWorkerError.h" | 23 #include "third_party/WebKit/public/platform/WebServiceWorkerError.h" |
| 23 #include "third_party/WebKit/public/web/WebServiceWorkerContextClient.h" | 24 #include "third_party/WebKit/public/web/WebServiceWorkerContextClient.h" |
| 24 | 25 |
| 25 namespace base { | 26 namespace base { |
| 26 class SingleThreadTaskRunner; | 27 class SingleThreadTaskRunner; |
| 27 class TaskRunner; | 28 class TaskRunner; |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 43 namespace content { | 44 namespace content { |
| 44 | 45 |
| 45 struct NavigatorConnectClient; | 46 struct NavigatorConnectClient; |
| 46 struct PlatformNotificationData; | 47 struct PlatformNotificationData; |
| 47 struct ServiceWorkerClientInfo; | 48 struct ServiceWorkerClientInfo; |
| 48 class ServiceWorkerProviderContext; | 49 class ServiceWorkerProviderContext; |
| 49 class ServiceWorkerContextClient; | 50 class ServiceWorkerContextClient; |
| 50 class ThreadSafeSender; | 51 class ThreadSafeSender; |
| 51 class WebServiceWorkerRegistrationImpl; | 52 class WebServiceWorkerRegistrationImpl; |
| 52 | 53 |
| 54 using SyncCallback = mojo::Callback<void(ServiceWorkerEventStatus)>; | |
|
jkarlin
2015/06/18 18:13:57
Move this into the class.
iclelland
2015/06/19 13:44:32
Done.
| |
| 55 | |
| 53 // This class provides access to/from an ServiceWorker's WorkerGlobalScope. | 56 // This class provides access to/from an ServiceWorker's WorkerGlobalScope. |
| 54 // Unless otherwise noted, all methods are called on the worker thread. | 57 // Unless otherwise noted, all methods are called on the worker thread. |
| 55 class ServiceWorkerContextClient | 58 class ServiceWorkerContextClient |
| 56 : public blink::WebServiceWorkerContextClient { | 59 : public blink::WebServiceWorkerContextClient { |
| 57 public: | 60 public: |
| 58 // Returns a thread-specific client instance. This does NOT create a | 61 // Returns a thread-specific client instance. This does NOT create a |
| 59 // new instance. | 62 // new instance. |
| 60 static ServiceWorkerContextClient* ThreadSpecificInstance(); | 63 static ServiceWorkerContextClient* ThreadSpecificInstance(); |
| 61 | 64 |
| 62 // Called on the main thread. | 65 // Called on the main thread. |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 137 const blink::WebString& message, | 140 const blink::WebString& message, |
| 138 blink::WebMessagePortChannelArray* channels); | 141 blink::WebMessagePortChannelArray* channels); |
| 139 virtual void focus(const blink::WebString& uuid, | 142 virtual void focus(const blink::WebString& uuid, |
| 140 blink::WebServiceWorkerClientCallbacks*); | 143 blink::WebServiceWorkerClientCallbacks*); |
| 141 virtual void skipWaiting( | 144 virtual void skipWaiting( |
| 142 blink::WebServiceWorkerSkipWaitingCallbacks* callbacks); | 145 blink::WebServiceWorkerSkipWaitingCallbacks* callbacks); |
| 143 virtual void claim(blink::WebServiceWorkerClientsClaimCallbacks* callbacks); | 146 virtual void claim(blink::WebServiceWorkerClientsClaimCallbacks* callbacks); |
| 144 virtual void stashMessagePort(blink::WebMessagePortChannel* channel, | 147 virtual void stashMessagePort(blink::WebMessagePortChannel* channel, |
| 145 const blink::WebString& name); | 148 const blink::WebString& name); |
| 146 | 149 |
| 150 virtual void DispatchSyncEvent(const SyncCallback& callbacks); | |
|
jkarlin
2015/06/18 18:13:57
callback singular right? Applies to member variabl
iclelland
2015/06/19 13:44:32
Done.
| |
| 151 | |
| 147 private: | 152 private: |
| 148 struct WorkerContextData; | 153 struct WorkerContextData; |
| 149 | 154 |
| 150 // Get routing_id for sending message to the ServiceWorkerVersion | 155 // Get routing_id for sending message to the ServiceWorkerVersion |
| 151 // in the browser process. | 156 // in the browser process. |
| 152 int GetRoutingID() const { return embedded_worker_id_; } | 157 int GetRoutingID() const { return embedded_worker_id_; } |
| 153 | 158 |
| 154 void Send(IPC::Message* message); | 159 void Send(IPC::Message* message); |
| 155 void SendWorkerStarted(); | 160 void SendWorkerStarted(); |
| 156 void SetRegistrationInServiceWorkerGlobalScope(); | 161 void SetRegistrationInServiceWorkerGlobalScope(); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 228 std::map<int, base::TimeTicks> install_start_timings_; | 233 std::map<int, base::TimeTicks> install_start_timings_; |
| 229 std::map<int, base::TimeTicks> notification_click_start_timings_; | 234 std::map<int, base::TimeTicks> notification_click_start_timings_; |
| 230 std::map<int, base::TimeTicks> push_start_timings_; | 235 std::map<int, base::TimeTicks> push_start_timings_; |
| 231 | 236 |
| 232 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextClient); | 237 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextClient); |
| 233 }; | 238 }; |
| 234 | 239 |
| 235 } // namespace content | 240 } // namespace content |
| 236 | 241 |
| 237 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ | 242 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ |
| OLD | NEW |