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_BROWSER_WORKER_HOST_WORKER_PROCESS_HOST_H_ | 5 #ifndef CONTENT_BROWSER_WORKER_HOST_WORKER_PROCESS_HOST_H_ |
6 #define CONTENT_BROWSER_WORKER_HOST_WORKER_PROCESS_HOST_H_ | 6 #define CONTENT_BROWSER_WORKER_HOST_WORKER_PROCESS_HOST_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "content/browser/worker_host/worker_document_set.h" | 15 #include "content/browser/worker_host/worker_document_set.h" |
16 #include "content/browser/worker_host/worker_storage_partition.h" | 16 #include "content/browser/worker_host/worker_storage_partition.h" |
17 #include "content/common/content_export.h" | 17 #include "content/common/content_export.h" |
18 #include "content/public/browser/browser_child_process_host_delegate.h" | 18 #include "content/public/browser/browser_child_process_host_delegate.h" |
19 #include "content/public/browser/browser_child_process_host_iterator.h" | 19 #include "content/public/browser/browser_child_process_host_iterator.h" |
20 #include "content/public/common/process_type.h" | 20 #include "content/public/common/process_type.h" |
21 #include "ipc/ipc_sender.h" | 21 #include "ipc/ipc_sender.h" |
| 22 #include "third_party/WebKit/public/web/WebContentSecurityPolicy.h" |
22 #include "url/gurl.h" | 23 #include "url/gurl.h" |
23 #include "webkit/common/resource_type.h" | 24 #include "webkit/common/resource_type.h" |
24 | 25 |
25 struct ResourceHostMsg_Request; | 26 struct ResourceHostMsg_Request; |
26 | 27 |
27 namespace fileapi { | 28 namespace fileapi { |
28 class FileSystemContext; | 29 class FileSystemContext; |
29 } // namespace fileapi | 30 } // namespace fileapi |
30 | 31 |
31 namespace net { | 32 namespace net { |
(...skipping 19 matching lines...) Expand all Loading... |
51 // BrowserContext. | 52 // BrowserContext. |
52 class WorkerProcessHost : public BrowserChildProcessHostDelegate, | 53 class WorkerProcessHost : public BrowserChildProcessHostDelegate, |
53 public IPC::Sender { | 54 public IPC::Sender { |
54 public: | 55 public: |
55 // Contains information about each worker instance, needed to forward messages | 56 // Contains information about each worker instance, needed to forward messages |
56 // between the renderer and worker processes. | 57 // between the renderer and worker processes. |
57 class WorkerInstance { | 58 class WorkerInstance { |
58 public: | 59 public: |
59 WorkerInstance(const GURL& url, | 60 WorkerInstance(const GURL& url, |
60 const base::string16& name, | 61 const base::string16& name, |
| 62 const base::string16& content_security_policy, |
| 63 blink::WebContentSecurityPolicyType security_policy_type, |
61 int worker_route_id, | 64 int worker_route_id, |
62 int parent_process_id, | 65 int parent_process_id, |
63 int64 main_resource_appcache_id, | 66 int64 main_resource_appcache_id, |
64 ResourceContext* resource_context, | 67 ResourceContext* resource_context, |
65 const WorkerStoragePartition& partition); | 68 const WorkerStoragePartition& partition); |
66 // Used for pending instances. Rest of the parameters are ignored. | 69 // Used for pending instances. Rest of the parameters are ignored. |
67 WorkerInstance(const GURL& url, | 70 WorkerInstance(const GURL& url, |
68 bool shared, | 71 bool shared, |
69 const base::string16& name, | 72 const base::string16& name, |
70 ResourceContext* resource_context, | 73 ResourceContext* resource_context, |
(...skipping 30 matching lines...) Expand all Loading... |
101 // is the only reference) as a result. | 104 // is the only reference) as a result. |
102 void ShareDocumentSet(const WorkerInstance& instance) { | 105 void ShareDocumentSet(const WorkerInstance& instance) { |
103 worker_document_set_ = instance.worker_document_set_; | 106 worker_document_set_ = instance.worker_document_set_; |
104 }; | 107 }; |
105 | 108 |
106 // Accessors | 109 // Accessors |
107 bool closed() const { return closed_; } | 110 bool closed() const { return closed_; } |
108 void set_closed(bool closed) { closed_ = closed; } | 111 void set_closed(bool closed) { closed_ = closed; } |
109 const GURL& url() const { return url_; } | 112 const GURL& url() const { return url_; } |
110 const base::string16 name() const { return name_; } | 113 const base::string16 name() const { return name_; } |
| 114 const base::string16 content_security_policy() const { |
| 115 return content_security_policy_; |
| 116 } |
| 117 blink::WebContentSecurityPolicyType security_policy_type() const { |
| 118 return security_policy_type_; |
| 119 } |
111 int worker_route_id() const { return worker_route_id_; } | 120 int worker_route_id() const { return worker_route_id_; } |
112 int parent_process_id() const { return parent_process_id_; } | 121 int parent_process_id() const { return parent_process_id_; } |
113 int64 main_resource_appcache_id() const { | 122 int64 main_resource_appcache_id() const { |
114 return main_resource_appcache_id_; | 123 return main_resource_appcache_id_; |
115 } | 124 } |
116 WorkerDocumentSet* worker_document_set() const { | 125 WorkerDocumentSet* worker_document_set() const { |
117 return worker_document_set_.get(); | 126 return worker_document_set_.get(); |
118 } | 127 } |
119 ResourceContext* resource_context() const { | 128 ResourceContext* resource_context() const { |
120 return resource_context_; | 129 return resource_context_; |
121 } | 130 } |
122 const WorkerStoragePartition& partition() const { | 131 const WorkerStoragePartition& partition() const { |
123 return partition_; | 132 return partition_; |
124 } | 133 } |
125 | 134 |
126 private: | 135 private: |
127 // Set of all filters (clients) associated with this worker. | 136 // Set of all filters (clients) associated with this worker. |
128 GURL url_; | 137 GURL url_; |
129 bool closed_; | 138 bool closed_; |
130 base::string16 name_; | 139 base::string16 name_; |
| 140 base::string16 content_security_policy_; |
| 141 blink::WebContentSecurityPolicyType security_policy_type_; |
131 int worker_route_id_; | 142 int worker_route_id_; |
132 int parent_process_id_; | 143 int parent_process_id_; |
133 int64 main_resource_appcache_id_; | 144 int64 main_resource_appcache_id_; |
134 FilterList filters_; | 145 FilterList filters_; |
135 scoped_refptr<WorkerDocumentSet> worker_document_set_; | 146 scoped_refptr<WorkerDocumentSet> worker_document_set_; |
136 ResourceContext* const resource_context_; | 147 ResourceContext* const resource_context_; |
137 WorkerStoragePartition partition_; | 148 WorkerStoragePartition partition_; |
138 }; | 149 }; |
139 | 150 |
140 WorkerProcessHost(ResourceContext* resource_context, | 151 WorkerProcessHost(ResourceContext* resource_context, |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 public: | 266 public: |
256 WorkerProcessHostIterator() | 267 WorkerProcessHostIterator() |
257 : BrowserChildProcessHostTypeIterator<WorkerProcessHost>( | 268 : BrowserChildProcessHostTypeIterator<WorkerProcessHost>( |
258 PROCESS_TYPE_WORKER) { | 269 PROCESS_TYPE_WORKER) { |
259 } | 270 } |
260 }; | 271 }; |
261 | 272 |
262 } // namespace content | 273 } // namespace content |
263 | 274 |
264 #endif // CONTENT_BROWSER_WORKER_HOST_WORKER_PROCESS_HOST_H_ | 275 #endif // CONTENT_BROWSER_WORKER_HOST_WORKER_PROCESS_HOST_H_ |
OLD | NEW |