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

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

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

Powered by Google App Engine
This is Rietveld 408576698