OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_EMBEDDED_WORKER_CONTEXT_CLIENT_H_ | 5 #ifndef CONTENT_RENDERER_SERVICE_WORKER_EMBEDDED_WORKER_CONTEXT_CLIENT_H_ |
6 #define CONTENT_RENDERER_SERVICE_WORKER_EMBEDDED_WORKER_CONTEXT_CLIENT_H_ | 6 #define CONTENT_RENDERER_SERVICE_WORKER_EMBEDDED_WORKER_CONTEXT_CLIENT_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
11 #include "content/common/service_worker/service_worker_types.h" | 11 #include "content/common/service_worker/service_worker_types.h" |
12 #include "ipc/ipc_listener.h" | 12 #include "ipc/ipc_listener.h" |
13 #include "third_party/WebKit/public/platform/WebServiceWorkerClientFocusCallback .h" | 13 #include "third_party/WebKit/public/platform/WebServiceWorkerClientFocusCallback .h" |
14 #include "third_party/WebKit/public/platform/WebServiceWorkerClientsInfo.h" | 14 #include "third_party/WebKit/public/platform/WebServiceWorkerClientsInfo.h" |
15 #include "third_party/WebKit/public/platform/WebServiceWorkerEventResult.h" | 15 #include "third_party/WebKit/public/platform/WebServiceWorkerEventResult.h" |
16 #include "third_party/WebKit/public/platform/WebServiceWorkerSkipWaitingCallback s.h" | 16 #include "third_party/WebKit/public/platform/WebServiceWorkerSkipWaitingCallback s.h" |
17 #include "third_party/WebKit/public/platform/WebURL.h" | 17 #include "third_party/WebKit/public/platform/WebURL.h" |
18 #include "third_party/WebKit/public/web/WebServiceWorkerContextClient.h" | 18 #include "third_party/WebKit/public/web/WebServiceWorkerContextClient.h" |
19 #include "url/gurl.h" | 19 #include "url/gurl.h" |
20 | 20 |
21 namespace base { | 21 namespace base { |
22 class MessageLoopProxy; | 22 class MessageLoopProxy; |
23 class TaskRunner; | 23 class TaskRunner; |
24 } | 24 } |
25 | 25 |
26 namespace blink { | 26 namespace blink { |
27 class WebDataSource; | 27 class WebDataSource; |
28 class WebServiceWorkerProvider; | |
28 } | 29 } |
29 | 30 |
30 namespace content { | 31 namespace content { |
31 | 32 |
32 class ServiceWorkerProviderContext; | 33 class ServiceWorkerProviderContext; |
33 class ServiceWorkerScriptContext; | 34 class ServiceWorkerScriptContext; |
34 class ThreadSafeSender; | 35 class ThreadSafeSender; |
35 | 36 |
36 // This class provides access to/from an embedded worker's WorkerGlobalScope. | 37 // This class provides access to/from an embedded worker's WorkerGlobalScope. |
37 // All methods other than the constructor (it's created on the main thread) | 38 // The ctor, workerContextFailedToStart, createServiceWorkerNetworkProvider and |
38 // and createServiceWorkerNetworkProvider (also called on the main thread) | 39 // createServiceWorkerProvider are called on the main thread. Others are called |
39 // are called on the worker thread. | 40 // on the worker thread. |
falken
2015/02/05 12:07:18
Seems better to keep track of by saying "Unless ot
nhiroki
2015/02/06 01:57:31
Done.
| |
40 // | 41 // |
41 // TODO(kinuko): Currently EW/SW separation is made a little hazily. | 42 // TODO(kinuko): Currently EW/SW separation is made a little hazily. |
42 // This should implement WebEmbeddedWorkerContextClient | 43 // This should implement WebEmbeddedWorkerContextClient |
43 // or sort of it (which doesn't exist yet) rather than | 44 // or sort of it (which doesn't exist yet) rather than |
44 // WebServiceWorkerContextClient if we want to separate them more cleanly, | 45 // WebServiceWorkerContextClient if we want to separate them more cleanly, |
45 // or ServiceWorkerScriptContext should be merged into this class | 46 // or ServiceWorkerScriptContext should be merged into this class |
46 // if we consider EW == SW script context. | 47 // if we consider EW == SW script context. |
47 class EmbeddedWorkerContextClient | 48 class EmbeddedWorkerContextClient |
48 : public blink::WebServiceWorkerContextClient { | 49 : public blink::WebServiceWorkerContextClient { |
49 public: | 50 public: |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
98 virtual void didHandleNotificationClickEvent( | 99 virtual void didHandleNotificationClickEvent( |
99 int request_id, | 100 int request_id, |
100 blink::WebServiceWorkerEventResult result); | 101 blink::WebServiceWorkerEventResult result); |
101 virtual void didHandlePushEvent(int request_id, | 102 virtual void didHandlePushEvent(int request_id, |
102 blink::WebServiceWorkerEventResult result); | 103 blink::WebServiceWorkerEventResult result); |
103 virtual void didHandleSyncEvent(int request_id); | 104 virtual void didHandleSyncEvent(int request_id); |
104 virtual void didHandleCrossOriginConnectEvent(int request_id, | 105 virtual void didHandleCrossOriginConnectEvent(int request_id, |
105 bool accept_connection); | 106 bool accept_connection); |
106 virtual blink::WebServiceWorkerNetworkProvider* | 107 virtual blink::WebServiceWorkerNetworkProvider* |
107 createServiceWorkerNetworkProvider(blink::WebDataSource* data_source); | 108 createServiceWorkerNetworkProvider(blink::WebDataSource* data_source); |
109 virtual blink::WebServiceWorkerProvider* createServiceWorkerProvider(); | |
108 virtual void postMessageToClient( | 110 virtual void postMessageToClient( |
109 int client_id, | 111 int client_id, |
110 const blink::WebString& message, | 112 const blink::WebString& message, |
111 blink::WebMessagePortChannelArray* channels); | 113 blink::WebMessagePortChannelArray* channels); |
112 virtual void postMessageToCrossOriginClient( | 114 virtual void postMessageToCrossOriginClient( |
113 const blink::WebCrossOriginServiceWorkerClient& client, | 115 const blink::WebCrossOriginServiceWorkerClient& client, |
114 const blink::WebString& message, | 116 const blink::WebString& message, |
115 blink::WebMessagePortChannelArray* channels); | 117 blink::WebMessagePortChannelArray* channels); |
116 virtual void focus(int client_id, | 118 virtual void focus(int client_id, |
117 blink::WebServiceWorkerClientFocusCallback*); | 119 blink::WebServiceWorkerClientFocusCallback*); |
(...skipping 28 matching lines...) Expand all Loading... | |
146 scoped_refptr<ServiceWorkerProviderContext> provider_context_; | 148 scoped_refptr<ServiceWorkerProviderContext> provider_context_; |
147 | 149 |
148 base::WeakPtrFactory<EmbeddedWorkerContextClient> weak_factory_; | 150 base::WeakPtrFactory<EmbeddedWorkerContextClient> weak_factory_; |
149 | 151 |
150 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerContextClient); | 152 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerContextClient); |
151 }; | 153 }; |
152 | 154 |
153 } // namespace content | 155 } // namespace content |
154 | 156 |
155 #endif // CONTENT_RENDERER_SERVICE_WORKER_EMBEDDED_WORKER_CONTEXT_CLIENT_H_ | 157 #endif // CONTENT_RENDERER_SERVICE_WORKER_EMBEDDED_WORKER_CONTEXT_CLIENT_H_ |
OLD | NEW |