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 #include "content/renderer/shared_worker_repository.h" | 5 #include "content/renderer/shared_worker_repository.h" |
6 | 6 |
7 #include "content/child/child_thread.h" | 7 #include "content/child/child_thread.h" |
8 #include "content/common/view_messages.h" | 8 #include "content/common/view_messages.h" |
9 #include "content/renderer/render_view_impl.h" | 9 #include "content/renderer/render_view_impl.h" |
10 #include "content/renderer/websharedworker_proxy.h" | 10 #include "content/renderer/websharedworker_proxy.h" |
11 #include "third_party/WebKit/public/web/WebView.h" | 11 #include "third_party/WebKit/public/web/WebView.h" |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 | 14 |
15 SharedWorkerRepository::SharedWorkerRepository(RenderViewImpl* render_view) | 15 SharedWorkerRepository::SharedWorkerRepository(RenderViewImpl* render_view) |
16 : RenderViewObserver(render_view) { | 16 : RenderViewObserver(render_view) { |
17 render_view->GetWebView()->setSharedWorkerRepositoryClient(this); | 17 render_view->GetWebView()->setSharedWorkerRepositoryClient(this); |
18 } | 18 } |
19 | 19 |
20 SharedWorkerRepository::~SharedWorkerRepository() {} | 20 SharedWorkerRepository::~SharedWorkerRepository() {} |
21 | 21 |
22 blink::WebSharedWorkerConnector* | 22 blink::WebSharedWorkerConnector* |
23 SharedWorkerRepository::createSharedWorkerConnector( | 23 SharedWorkerRepository::createSharedWorkerConnector( |
24 const blink::WebURL& url, | 24 const blink::WebURL& url, |
25 const blink::WebString& name, | 25 const blink::WebString& name, |
26 DocumentID document_id) { | 26 DocumentID document_id, |
| 27 const blink::WebString& content_security_policy, |
| 28 blink::WebContentSecurityPolicyType security_policy_type) { |
27 int route_id = MSG_ROUTING_NONE; | 29 int route_id = MSG_ROUTING_NONE; |
28 bool exists = false; | 30 bool exists = false; |
29 bool url_mismatch = false; | 31 bool url_mismatch = false; |
30 ViewHostMsg_CreateWorker_Params params; | 32 ViewHostMsg_CreateWorker_Params params; |
31 params.url = url; | 33 params.url = url; |
32 params.name = name; | 34 params.name = name; |
| 35 params.content_security_policy = content_security_policy; |
| 36 params.security_policy_type = security_policy_type; |
33 params.document_id = document_id; | 37 params.document_id = document_id; |
34 params.render_view_route_id = render_view()->GetRoutingID(); | 38 params.render_view_route_id = render_view()->GetRoutingID(); |
35 params.route_id = MSG_ROUTING_NONE; | 39 params.route_id = MSG_ROUTING_NONE; |
36 params.script_resource_appcache_id = 0; | 40 params.script_resource_appcache_id = 0; |
37 Send(new ViewHostMsg_LookupSharedWorker( | 41 Send(new ViewHostMsg_LookupSharedWorker( |
38 params, &exists, &route_id, &url_mismatch)); | 42 params, &exists, &route_id, &url_mismatch)); |
39 if (url_mismatch) | 43 if (url_mismatch) |
40 return NULL; | 44 return NULL; |
41 documents_with_workers_.insert(document_id); | 45 documents_with_workers_.insert(document_id); |
42 return new WebSharedWorkerProxy(ChildThread::current(), | 46 return new WebSharedWorkerProxy(ChildThread::current(), |
43 document_id, | 47 document_id, |
44 exists, | 48 exists, |
45 route_id, | 49 route_id, |
46 render_view()->GetRoutingID()); | 50 render_view()->GetRoutingID()); |
47 } | 51 } |
48 | 52 |
49 void SharedWorkerRepository::documentDetached(DocumentID document) { | 53 void SharedWorkerRepository::documentDetached(DocumentID document) { |
50 std::set<DocumentID>::iterator iter = documents_with_workers_.find(document); | 54 std::set<DocumentID>::iterator iter = documents_with_workers_.find(document); |
51 if (iter != documents_with_workers_.end()) { | 55 if (iter != documents_with_workers_.end()) { |
52 // Notify the browser process that the document has shut down. | 56 // Notify the browser process that the document has shut down. |
53 Send(new ViewHostMsg_DocumentDetached(document)); | 57 Send(new ViewHostMsg_DocumentDetached(document)); |
54 documents_with_workers_.erase(iter); | 58 documents_with_workers_.erase(iter); |
55 } | 59 } |
56 } | 60 } |
57 | 61 |
58 } // namespace content | 62 } // namespace content |
OLD | NEW |