OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 19 matching lines...) Expand all Loading... |
30 unsigned long long document_id, | 30 unsigned long long document_id, |
31 bool exists, | 31 bool exists, |
32 int route_id, | 32 int route_id, |
33 int render_view_route_id); | 33 int render_view_route_id); |
34 virtual ~WebSharedWorkerProxy(); | 34 virtual ~WebSharedWorkerProxy(); |
35 | 35 |
36 // Implementations of WebSharedWorker APIs | 36 // Implementations of WebSharedWorker APIs |
37 virtual bool isStarted(); | 37 virtual bool isStarted(); |
38 virtual void connect(WebKit::WebMessagePortChannel* channel, | 38 virtual void connect(WebKit::WebMessagePortChannel* channel, |
39 ConnectListener* listener); | 39 ConnectListener* listener); |
| 40 |
| 41 // API is evolving from first form to second. This function must remain |
| 42 // virtual to avoid conflicts on the webkit roll. |
| 43 // DEPRECATED |
40 virtual void startWorkerContext(const WebKit::WebURL& script_url, | 44 virtual void startWorkerContext(const WebKit::WebURL& script_url, |
41 const WebKit::WebString& name, | 45 const WebKit::WebString& name, |
42 const WebKit::WebString& user_agent, | 46 const WebKit::WebString& user_agent, |
43 const WebKit::WebString& source_code, | 47 const WebKit::WebString& source_code, |
44 long long script_resource_appcache_id); | 48 long long script_resource_appcache_id); |
| 49 |
| 50 virtual void startWorkerContext( |
| 51 const WebKit::WebURL& script_url, |
| 52 const WebKit::WebString& name, |
| 53 const WebKit::WebString& user_agent, |
| 54 const WebKit::WebString& source_code, |
| 55 const WebKit::WebString& content_security_policy, |
| 56 WebKit::WebContentSecurityPolicyType policy_type, |
| 57 long long script_resource_appcache_id); |
| 58 |
45 virtual void terminateWorkerContext(); | 59 virtual void terminateWorkerContext(); |
46 virtual void clientDestroyed(); | 60 virtual void clientDestroyed(); |
47 | 61 |
48 private: | 62 private: |
49 // IPC::Channel::Listener implementation. | 63 // IPC::Channel::Listener implementation. |
50 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 64 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
51 | 65 |
52 // Returns true if the worker is running (can send messages to it). | 66 // Returns true if the worker is running (can send messages to it). |
53 bool IsStarted(); | 67 bool IsStarted(); |
54 | 68 |
55 // Disconnects the worker (stops listening for incoming messages). | 69 // Disconnects the worker (stops listening for incoming messages). |
56 void Disconnect(); | 70 void Disconnect(); |
57 | 71 |
58 // Sends a message to the worker thread (forwarded via the RenderViewHost). | 72 // Sends a message to the worker thread (forwarded via the RenderViewHost). |
59 // If WorkerStarted() has not yet been called, message is queued. | 73 // If WorkerStarted() has not yet been called, message is queued. |
60 bool Send(IPC::Message*); | 74 bool Send(IPC::Message*); |
61 | 75 |
62 // Returns true if there are queued messages. | 76 // Returns true if there are queued messages. |
63 bool HasQueuedMessages() { return !queued_messages_.empty(); } | 77 bool HasQueuedMessages() { return !queued_messages_.empty(); } |
64 | 78 |
65 // Sends any messages currently in the queue. | 79 // Sends any messages currently in the queue. |
66 void SendQueuedMessages(); | 80 void SendQueuedMessages(); |
67 | 81 |
68 void CreateWorkerContext(const GURL& script_url, | 82 void CreateWorkerContext(const GURL& script_url, |
69 bool is_shared, | 83 bool is_shared, |
70 const string16& name, | 84 const string16& name, |
71 const string16& user_agent, | 85 const string16& user_agent, |
72 const string16& source_code, | 86 const string16& source_code, |
| 87 const string16& content_security_policy, |
| 88 WebKit::WebContentSecurityPolicyType policy_type, |
73 int pending_route_id, | 89 int pending_route_id, |
74 int64 script_resource_appcache_id); | 90 int64 script_resource_appcache_id); |
75 void OnWorkerCreated(); | 91 void OnWorkerCreated(); |
76 | 92 |
77 | 93 |
78 // Routing id associated with this worker - used to receive messages from the | 94 // Routing id associated with this worker - used to receive messages from the |
79 // worker, and also to route messages to the worker (WorkerService contains | 95 // worker, and also to route messages to the worker (WorkerService contains |
80 // a map that maps between these renderer-side route IDs and worker-side | 96 // a map that maps between these renderer-side route IDs and worker-side |
81 // routing ids). | 97 // routing ids). |
82 int route_id_; | 98 int route_id_; |
(...skipping 13 matching lines...) Expand all Loading... |
96 // The id for the placeholder worker instance we've stored on the | 112 // The id for the placeholder worker instance we've stored on the |
97 // browser process (we need to pass this same route id back in when creating | 113 // browser process (we need to pass this same route id back in when creating |
98 // the worker). | 114 // the worker). |
99 int pending_route_id_; | 115 int pending_route_id_; |
100 ConnectListener* connect_listener_; | 116 ConnectListener* connect_listener_; |
101 | 117 |
102 DISALLOW_COPY_AND_ASSIGN(WebSharedWorkerProxy); | 118 DISALLOW_COPY_AND_ASSIGN(WebSharedWorkerProxy); |
103 }; | 119 }; |
104 | 120 |
105 #endif // CONTENT_RENDERER_WEBSHAREDWORKER_PROXY_H_ | 121 #endif // CONTENT_RENDERER_WEBSHAREDWORKER_PROXY_H_ |
OLD | NEW |