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

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

Issue 2714943004: Move unique name generation and tracking into //content. (Closed)
Patch Set: Rebase again. Created 3 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
« no previous file with comments | « content/renderer/render_frame_proxy.h ('k') | content/renderer/render_view_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/render_frame_proxy.h" 5 #include "content/renderer/render_frame_proxy.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <map> 8 #include <map>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 } // namespace 54 } // namespace
55 55
56 // static 56 // static
57 RenderFrameProxy* RenderFrameProxy::CreateProxyToReplaceFrame( 57 RenderFrameProxy* RenderFrameProxy::CreateProxyToReplaceFrame(
58 RenderFrameImpl* frame_to_replace, 58 RenderFrameImpl* frame_to_replace,
59 int routing_id, 59 int routing_id,
60 blink::WebTreeScopeType scope) { 60 blink::WebTreeScopeType scope) {
61 CHECK_NE(routing_id, MSG_ROUTING_NONE); 61 CHECK_NE(routing_id, MSG_ROUTING_NONE);
62 62
63 std::unique_ptr<RenderFrameProxy> proxy(new RenderFrameProxy(routing_id)); 63 std::unique_ptr<RenderFrameProxy> proxy(new RenderFrameProxy(routing_id));
64 proxy->unique_name_ = frame_to_replace->unique_name();
64 65
65 // When a RenderFrame is replaced by a RenderProxy, the WebRemoteFrame should 66 // When a RenderFrame is replaced by a RenderProxy, the WebRemoteFrame should
66 // always come from WebRemoteFrame::create and a call to WebFrame::swap must 67 // always come from WebRemoteFrame::create and a call to WebFrame::swap must
67 // follow later. 68 // follow later.
68 blink::WebRemoteFrame* web_frame = 69 blink::WebRemoteFrame* web_frame =
69 blink::WebRemoteFrame::create(scope, proxy.get()); 70 blink::WebRemoteFrame::create(scope, proxy.get());
70 71
71 // If frame_to_replace has a RenderFrameProxy parent, then its 72 // If frame_to_replace has a RenderFrameProxy parent, then its
72 // RenderWidget will be destroyed along with it, so the new 73 // RenderWidget will be destroyed along with it, so the new
73 // RenderFrameProxy uses its parent's RenderWidget. 74 // RenderFrameProxy uses its parent's RenderWidget.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 if (!render_view->is_swapped_out()) 120 if (!render_view->is_swapped_out())
120 render_view->SetSwappedOut(true); 121 render_view->SetSwappedOut(true);
121 } else { 122 } else {
122 // Create a frame under an existing parent. The parent is always expected 123 // Create a frame under an existing parent. The parent is always expected
123 // to be a RenderFrameProxy, because navigations initiated by local frames 124 // to be a RenderFrameProxy, because navigations initiated by local frames
124 // should not wind up here. 125 // should not wind up here.
125 126
126 web_frame = parent->web_frame()->createRemoteChild( 127 web_frame = parent->web_frame()->createRemoteChild(
127 replicated_state.scope, 128 replicated_state.scope,
128 blink::WebString::fromUTF8(replicated_state.name), 129 blink::WebString::fromUTF8(replicated_state.name),
129 blink::WebString::fromUTF8(replicated_state.unique_name),
130 replicated_state.sandbox_flags, proxy.get(), opener); 130 replicated_state.sandbox_flags, proxy.get(), opener);
131 proxy->unique_name_ = replicated_state.unique_name;
131 render_view = parent->render_view(); 132 render_view = parent->render_view();
132 render_widget = parent->render_widget(); 133 render_widget = parent->render_widget();
133 } 134 }
134 135
135 proxy->Init(web_frame, render_view, render_widget); 136 proxy->Init(web_frame, render_view, render_widget);
136 137
137 // Initialize proxy's WebRemoteFrame with the security origin and other 138 // Initialize proxy's WebRemoteFrame with the security origin and other
138 // replicated information. 139 // replicated information.
139 // TODO(dcheng): Calling this when parent_routing_id != MSG_ROUTING_NONE is 140 // TODO(dcheng): Calling this when parent_routing_id != MSG_ROUTING_NONE is
140 // mostly redundant, since we already pass the name and sandbox flags in 141 // mostly redundant, since we already pass the name and sandbox flags in
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 } 214 }
214 } 215 }
215 216
216 void RenderFrameProxy::DidCommitCompositorFrame() { 217 void RenderFrameProxy::DidCommitCompositorFrame() {
217 } 218 }
218 219
219 void RenderFrameProxy::SetReplicatedState(const FrameReplicationState& state) { 220 void RenderFrameProxy::SetReplicatedState(const FrameReplicationState& state) {
220 DCHECK(web_frame_); 221 DCHECK(web_frame_);
221 web_frame_->setReplicatedOrigin(state.origin); 222 web_frame_->setReplicatedOrigin(state.origin);
222 web_frame_->setReplicatedSandboxFlags(state.sandbox_flags); 223 web_frame_->setReplicatedSandboxFlags(state.sandbox_flags);
223 web_frame_->setReplicatedName(blink::WebString::fromUTF8(state.name), 224 web_frame_->setReplicatedName(blink::WebString::fromUTF8(state.name));
224 blink::WebString::fromUTF8(state.unique_name));
225 web_frame_->setReplicatedInsecureRequestPolicy(state.insecure_request_policy); 225 web_frame_->setReplicatedInsecureRequestPolicy(state.insecure_request_policy);
226 web_frame_->setReplicatedPotentiallyTrustworthyUniqueOrigin( 226 web_frame_->setReplicatedPotentiallyTrustworthyUniqueOrigin(
227 state.has_potentially_trustworthy_unique_origin); 227 state.has_potentially_trustworthy_unique_origin);
228 web_frame_->setReplicatedFeaturePolicyHeader( 228 web_frame_->setReplicatedFeaturePolicyHeader(
229 FeaturePolicyHeaderToWeb(state.feature_policy_header)); 229 FeaturePolicyHeaderToWeb(state.feature_policy_header));
230 if (state.has_received_user_gesture) 230 if (state.has_received_user_gesture)
231 web_frame_->setHasReceivedUserGesture(); 231 web_frame_->setHasReceivedUserGesture();
232 232
233 web_frame_->resetReplicatedContentSecurityPolicy(); 233 web_frame_->resetReplicatedContentSecurityPolicy();
234 for (const auto& header : state.accumulated_csp_headers) 234 for (const auto& header : state.accumulated_csp_headers)
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 void RenderFrameProxy::OnDidStopLoading() { 340 void RenderFrameProxy::OnDidStopLoading() {
341 web_frame_->didStopLoading(); 341 web_frame_->didStopLoading();
342 } 342 }
343 343
344 void RenderFrameProxy::OnDispatchLoad() { 344 void RenderFrameProxy::OnDispatchLoad() {
345 web_frame_->dispatchLoadEventOnFrameOwner(); 345 web_frame_->dispatchLoadEventOnFrameOwner();
346 } 346 }
347 347
348 void RenderFrameProxy::OnDidUpdateName(const std::string& name, 348 void RenderFrameProxy::OnDidUpdateName(const std::string& name,
349 const std::string& unique_name) { 349 const std::string& unique_name) {
350 web_frame_->setReplicatedName(blink::WebString::fromUTF8(name), 350 web_frame_->setReplicatedName(blink::WebString::fromUTF8(name));
351 blink::WebString::fromUTF8(unique_name)); 351 unique_name_ = unique_name;
352 } 352 }
353 353
354 void RenderFrameProxy::OnAddContentSecurityPolicy( 354 void RenderFrameProxy::OnAddContentSecurityPolicy(
355 const ContentSecurityPolicyHeader& header) { 355 const ContentSecurityPolicyHeader& header) {
356 web_frame_->addReplicatedContentSecurityPolicyHeader( 356 web_frame_->addReplicatedContentSecurityPolicyHeader(
357 blink::WebString::fromUTF8(header.header_value), header.type, 357 blink::WebString::fromUTF8(header.header_value), header.type,
358 header.source); 358 header.source);
359 } 359 }
360 360
361 void RenderFrameProxy::OnResetContentSecurityPolicy() { 361 void RenderFrameProxy::OnResetContentSecurityPolicy() {
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 blink::WebLocalFrame* source) { 527 blink::WebLocalFrame* source) {
528 int source_routing_id = RenderFrameImpl::FromWebFrame(source)->GetRoutingID(); 528 int source_routing_id = RenderFrameImpl::FromWebFrame(source)->GetRoutingID();
529 Send(new FrameHostMsg_AdvanceFocus(routing_id_, type, source_routing_id)); 529 Send(new FrameHostMsg_AdvanceFocus(routing_id_, type, source_routing_id));
530 } 530 }
531 531
532 void RenderFrameProxy::frameFocused() { 532 void RenderFrameProxy::frameFocused() {
533 Send(new FrameHostMsg_FrameFocused(routing_id_)); 533 Send(new FrameHostMsg_FrameFocused(routing_id_));
534 } 534 }
535 535
536 } // namespace 536 } // namespace
OLDNEW
« no previous file with comments | « content/renderer/render_frame_proxy.h ('k') | content/renderer/render_view_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698