OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_WEBSHAREDWORKER_PROXY_H_ | 5 #ifndef CONTENT_RENDERER_WEBSHAREDWORKER_PROXY_H_ |
6 #define CONTENT_RENDERER_WEBSHAREDWORKER_PROXY_H_ | 6 #define CONTENT_RENDERER_WEBSHAREDWORKER_PROXY_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "ipc/ipc_listener.h" | 13 #include "ipc/ipc_listener.h" |
14 #include "third_party/WebKit/public/web/WebSharedWorker.h" | 14 #include "third_party/WebKit/public/web/WebSharedWorker.h" |
15 #include "url/gurl.h" | 15 #include "url/gurl.h" |
16 | 16 |
17 namespace content { | 17 namespace content { |
18 | 18 |
19 class ChildThread; | 19 class ChildThread; |
20 | 20 |
21 // Implementation of the WebSharedWorker APIs. This object is intended to only | 21 // Implementation of the WebSharedWorker APIs. This object is intended to only |
22 // live long enough to allow the caller to send a "connect" event to the worker | 22 // live long enough to allow the caller to send a "connect" event to the worker |
23 // thread. Once the connect event has been sent, all future communication will | 23 // thread. Once the connect event has been sent, all future communication will |
24 // happen via the WebMessagePortChannel, and the WebSharedWorker instance will | 24 // happen via the WebMessagePortChannel, and the WebSharedWorker instance will |
25 // be freed. | 25 // be freed. |
26 class WebSharedWorkerProxy : public WebKit::WebSharedWorker, | 26 class WebSharedWorkerProxy : public blink::WebSharedWorker, |
27 private IPC::Listener { | 27 private IPC::Listener { |
28 public: | 28 public: |
29 // If the worker not loaded yet, route_id == MSG_ROUTING_NONE | 29 // If the worker not loaded yet, route_id == MSG_ROUTING_NONE |
30 WebSharedWorkerProxy(ChildThread* child_thread, | 30 WebSharedWorkerProxy(ChildThread* child_thread, |
31 unsigned long long document_id, | 31 unsigned long long document_id, |
32 bool exists, | 32 bool exists, |
33 int route_id, | 33 int route_id, |
34 int render_view_route_id); | 34 int render_view_route_id); |
35 virtual ~WebSharedWorkerProxy(); | 35 virtual ~WebSharedWorkerProxy(); |
36 | 36 |
37 // Implementations of WebSharedWorker APIs | 37 // Implementations of WebSharedWorker APIs |
38 virtual bool isStarted(); | 38 virtual bool isStarted(); |
39 virtual void connect(WebKit::WebMessagePortChannel* channel, | 39 virtual void connect(blink::WebMessagePortChannel* channel, |
40 ConnectListener* listener); | 40 ConnectListener* listener); |
41 | 41 |
42 virtual void startWorkerContext( | 42 virtual void startWorkerContext( |
43 const WebKit::WebURL& script_url, | 43 const blink::WebURL& script_url, |
44 const WebKit::WebString& name, | 44 const blink::WebString& name, |
45 const WebKit::WebString& user_agent, | 45 const blink::WebString& user_agent, |
46 const WebKit::WebString& source_code, | 46 const blink::WebString& source_code, |
47 const WebKit::WebString& content_security_policy, | 47 const blink::WebString& content_security_policy, |
48 WebKit::WebContentSecurityPolicyType policy_type, | 48 blink::WebContentSecurityPolicyType policy_type, |
49 long long script_resource_appcache_id); | 49 long long script_resource_appcache_id); |
50 | 50 |
51 virtual void terminateWorkerContext(); | 51 virtual void terminateWorkerContext(); |
52 virtual void clientDestroyed(); | 52 virtual void clientDestroyed(); |
53 | 53 |
54 private: | 54 private: |
55 // IPC::Listener implementation. | 55 // IPC::Listener implementation. |
56 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 56 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
57 | 57 |
58 // Returns true if the worker is running (can send messages to it). | 58 // Returns true if the worker is running (can send messages to it). |
(...skipping 11 matching lines...) Expand all Loading... |
70 | 70 |
71 // Sends any messages currently in the queue. | 71 // Sends any messages currently in the queue. |
72 void SendQueuedMessages(); | 72 void SendQueuedMessages(); |
73 | 73 |
74 void CreateWorkerContext(const GURL& script_url, | 74 void CreateWorkerContext(const GURL& script_url, |
75 bool is_shared, | 75 bool is_shared, |
76 const string16& name, | 76 const string16& name, |
77 const string16& user_agent, | 77 const string16& user_agent, |
78 const string16& source_code, | 78 const string16& source_code, |
79 const string16& content_security_policy, | 79 const string16& content_security_policy, |
80 WebKit::WebContentSecurityPolicyType policy_type, | 80 blink::WebContentSecurityPolicyType policy_type, |
81 int pending_route_id, | 81 int pending_route_id, |
82 int64 script_resource_appcache_id); | 82 int64 script_resource_appcache_id); |
83 void OnWorkerCreated(); | 83 void OnWorkerCreated(); |
84 | 84 |
85 | 85 |
86 // Routing id associated with this worker - used to receive messages from the | 86 // Routing id associated with this worker - used to receive messages from the |
87 // worker, and also to route messages to the worker (WorkerService contains | 87 // worker, and also to route messages to the worker (WorkerService contains |
88 // a map that maps between these renderer-side route IDs and worker-side | 88 // a map that maps between these renderer-side route IDs and worker-side |
89 // routing ids). | 89 // routing ids). |
90 int route_id_; | 90 int route_id_; |
(...skipping 15 matching lines...) Expand all Loading... |
106 // the worker). | 106 // the worker). |
107 int pending_route_id_; | 107 int pending_route_id_; |
108 ConnectListener* connect_listener_; | 108 ConnectListener* connect_listener_; |
109 | 109 |
110 DISALLOW_COPY_AND_ASSIGN(WebSharedWorkerProxy); | 110 DISALLOW_COPY_AND_ASSIGN(WebSharedWorkerProxy); |
111 }; | 111 }; |
112 | 112 |
113 } // namespace content | 113 } // namespace content |
114 | 114 |
115 #endif // CONTENT_RENDERER_WEBSHAREDWORKER_PROXY_H_ | 115 #endif // CONTENT_RENDERER_WEBSHAREDWORKER_PROXY_H_ |
OLD | NEW |