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 the second form. |
40 virtual void startWorkerContext(const WebKit::WebURL& script_url, | 42 virtual void startWorkerContext(const WebKit::WebURL& script_url, |
41 const WebKit::WebString& name, | 43 const WebKit::WebString& name, |
42 const WebKit::WebString& user_agent, | 44 const WebKit::WebString& user_agent, |
43 const WebKit::WebString& source_code, | 45 const WebKit::WebString& source_code, |
44 long long script_resource_appcache_id); | 46 long long script_resource_appcache_id); |
| 47 |
| 48 virtual void startWorkerContext( |
| 49 const WebKit::WebURL& script_url, |
| 50 const WebKit::WebString& name, |
| 51 const WebKit::WebString& user_agent, |
| 52 const WebKit::WebString& source_code, |
| 53 const WebKit::WebString& content_security_policy, |
| 54 bool report_only, |
| 55 long long script_resource_appcache_id); |
| 56 |
45 virtual void terminateWorkerContext(); | 57 virtual void terminateWorkerContext(); |
46 virtual void clientDestroyed(); | 58 virtual void clientDestroyed(); |
47 | 59 |
48 private: | 60 private: |
49 // IPC::Channel::Listener implementation. | 61 // IPC::Channel::Listener implementation. |
50 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 62 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
51 | 63 |
52 // Returns true if the worker is running (can send messages to it). | 64 // Returns true if the worker is running (can send messages to it). |
53 bool IsStarted(); | 65 bool IsStarted(); |
54 | 66 |
55 // Disconnects the worker (stops listening for incoming messages). | 67 // Disconnects the worker (stops listening for incoming messages). |
56 void Disconnect(); | 68 void Disconnect(); |
57 | 69 |
58 // Sends a message to the worker thread (forwarded via the RenderViewHost). | 70 // Sends a message to the worker thread (forwarded via the RenderViewHost). |
59 // If WorkerStarted() has not yet been called, message is queued. | 71 // If WorkerStarted() has not yet been called, message is queued. |
60 bool Send(IPC::Message*); | 72 bool Send(IPC::Message*); |
61 | 73 |
62 // Returns true if there are queued messages. | 74 // Returns true if there are queued messages. |
63 bool HasQueuedMessages() { return !queued_messages_.empty(); } | 75 bool HasQueuedMessages() { return !queued_messages_.empty(); } |
64 | 76 |
65 // Sends any messages currently in the queue. | 77 // Sends any messages currently in the queue. |
66 void SendQueuedMessages(); | 78 void SendQueuedMessages(); |
67 | 79 |
68 void CreateWorkerContext(const GURL& script_url, | 80 void CreateWorkerContext(const GURL& script_url, |
69 bool is_shared, | 81 bool is_shared, |
70 const string16& name, | 82 const string16& name, |
71 const string16& user_agent, | 83 const string16& user_agent, |
72 const string16& source_code, | 84 const string16& source_code, |
| 85 const string16& content_security_policy, |
| 86 bool report_only, |
73 int pending_route_id, | 87 int pending_route_id, |
74 int64 script_resource_appcache_id); | 88 int64 script_resource_appcache_id); |
75 void OnWorkerCreated(); | 89 void OnWorkerCreated(); |
76 | 90 |
77 | 91 |
78 // Routing id associated with this worker - used to receive messages from the | 92 // Routing id associated with this worker - used to receive messages from the |
79 // worker, and also to route messages to the worker (WorkerService contains | 93 // 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 | 94 // a map that maps between these renderer-side route IDs and worker-side |
81 // routing ids). | 95 // routing ids). |
82 int route_id_; | 96 int route_id_; |
(...skipping 13 matching lines...) Expand all Loading... |
96 // The id for the placeholder worker instance we've stored on the | 110 // 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 | 111 // browser process (we need to pass this same route id back in when creating |
98 // the worker). | 112 // the worker). |
99 int pending_route_id_; | 113 int pending_route_id_; |
100 ConnectListener* connect_listener_; | 114 ConnectListener* connect_listener_; |
101 | 115 |
102 DISALLOW_COPY_AND_ASSIGN(WebSharedWorkerProxy); | 116 DISALLOW_COPY_AND_ASSIGN(WebSharedWorkerProxy); |
103 }; | 117 }; |
104 | 118 |
105 #endif // CONTENT_RENDERER_WEBSHAREDWORKER_PROXY_H_ | 119 #endif // CONTENT_RENDERER_WEBSHAREDWORKER_PROXY_H_ |
OLD | NEW |