Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Side by Side Diff: content/renderer/shared_worker_repository.cc

Issue 1775933002: CORS-RFC1918: Pipe creator address space through SharedWorker creation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: typo Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_impl.h" 7 #include "content/child/child_thread_impl.h"
8 #include "content/common/view_messages.h" 8 #include "content/common/view_messages.h"
9 #include "content/renderer/render_frame_impl.h" 9 #include "content/renderer/render_frame_impl.h"
10 #include "content/renderer/websharedworker_proxy.h" 10 #include "content/renderer/websharedworker_proxy.h"
11 #include "third_party/WebKit/public/web/WebContentSecurityPolicy.h" 11 #include "third_party/WebKit/public/web/WebContentSecurityPolicy.h"
12 #include "third_party/WebKit/public/web/WebLocalFrame.h" 12 #include "third_party/WebKit/public/web/WebLocalFrame.h"
13 13
14 namespace content { 14 namespace content {
15 15
16 SharedWorkerRepository::SharedWorkerRepository(RenderFrameImpl* render_frame) 16 SharedWorkerRepository::SharedWorkerRepository(RenderFrameImpl* render_frame)
17 : RenderFrameObserver(render_frame) { 17 : RenderFrameObserver(render_frame) {
18 render_frame->GetWebFrame()->setSharedWorkerRepositoryClient(this); 18 render_frame->GetWebFrame()->setSharedWorkerRepositoryClient(this);
19 } 19 }
20 20
21 SharedWorkerRepository::~SharedWorkerRepository() {} 21 SharedWorkerRepository::~SharedWorkerRepository() {}
22 22
23 blink::WebSharedWorkerConnector* 23 blink::WebSharedWorkerConnector*
24 SharedWorkerRepository::createSharedWorkerConnector( 24 SharedWorkerRepository::createSharedWorkerConnector(
25 const blink::WebURL& url, 25 const blink::WebURL& url,
26 const blink::WebString& name, 26 const blink::WebString& name,
27 DocumentID document_id, 27 DocumentID document_id,
28 const blink::WebString& content_security_policy, 28 const blink::WebString& content_security_policy,
29 blink::WebContentSecurityPolicyType security_policy_type, 29 blink::WebContentSecurityPolicyType security_policy_type,
30 blink::WebAddressSpace creation_address_space,
30 blink::WebSharedWorkerCreationContextType creation_context_type, 31 blink::WebSharedWorkerCreationContextType creation_context_type,
31 blink::WebWorkerCreationError* error) { 32 blink::WebWorkerCreationError* error) {
32 ViewHostMsg_CreateWorker_Params params; 33 ViewHostMsg_CreateWorker_Params params;
33 params.url = url; 34 params.url = url;
34 params.name = name; 35 params.name = name;
35 params.content_security_policy = content_security_policy; 36 params.content_security_policy = content_security_policy;
36 params.security_policy_type = security_policy_type; 37 params.security_policy_type = security_policy_type;
37 params.document_id = document_id; 38 params.document_id = document_id;
38 params.render_frame_route_id = render_frame()->GetRoutingID(); 39 params.render_frame_route_id = render_frame()->GetRoutingID();
40 params.creation_address_space = creation_address_space;
39 params.creation_context_type = creation_context_type; 41 params.creation_context_type = creation_context_type;
40 ViewHostMsg_CreateWorker_Reply reply; 42 ViewHostMsg_CreateWorker_Reply reply;
41 Send(new ViewHostMsg_CreateWorker(params, &reply)); 43 Send(new ViewHostMsg_CreateWorker(params, &reply));
42 *error = reply.error; 44 *error = reply.error;
43 if (reply.route_id == MSG_ROUTING_NONE) { 45 if (reply.route_id == MSG_ROUTING_NONE) {
44 return NULL; 46 return NULL;
45 } 47 }
46 documents_with_workers_.insert(document_id); 48 documents_with_workers_.insert(document_id);
47 return new WebSharedWorkerProxy(ChildThreadImpl::current()->GetRouter(), 49 return new WebSharedWorkerProxy(ChildThreadImpl::current()->GetRouter(),
48 reply.route_id); 50 reply.route_id);
49 } 51 }
50 52
51 void SharedWorkerRepository::documentDetached(DocumentID document) { 53 void SharedWorkerRepository::documentDetached(DocumentID document) {
52 std::set<DocumentID>::iterator iter = documents_with_workers_.find(document); 54 std::set<DocumentID>::iterator iter = documents_with_workers_.find(document);
53 if (iter != documents_with_workers_.end()) { 55 if (iter != documents_with_workers_.end()) {
54 // Notify the browser process that the document has shut down. 56 // Notify the browser process that the document has shut down.
55 Send(new ViewHostMsg_DocumentDetached(document)); 57 Send(new ViewHostMsg_DocumentDetached(document));
56 documents_with_workers_.erase(iter); 58 documents_with_workers_.erase(iter);
57 } 59 }
58 } 60 }
59 61
60 } // namespace content 62 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698