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

Side by Side Diff: components/html_viewer/html_frame.cc

Issue 1635873003: Replicating WebFrame::uniqueName across renderers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dump-render-tree3
Patch Set: Removed unnecessary crbug comment. Created 4 years, 11 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/html_viewer/html_frame.h" 5 #include "components/html_viewer/html_frame.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <limits> 9 #include <limits>
10 #include <utility> 10 #include <utility>
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 weak_factory_(this) { 126 weak_factory_(this) {
127 TRACE_EVENT0("html_viewer", "HTMLFrame::HTMLFrame"); 127 TRACE_EVENT0("html_viewer", "HTMLFrame::HTMLFrame");
128 if (parent_) 128 if (parent_)
129 parent_->children_.push_back(this); 129 parent_->children_.push_back(this);
130 130
131 if (params->window && params->window->id() == id_) 131 if (params->window && params->window->id() == id_)
132 SetWindow(params->window); 132 SetWindow(params->window);
133 133
134 SetReplicatedFrameStateFromClientProperties(params->properties, &state_); 134 SetReplicatedFrameStateFromClientProperties(params->properties, &state_);
135 135
136 // TODO(lukasza): Add |frame_unique_name| to ReplicatedFrameState?
137 blink::WebString unique_name; // Empty string = will recalculate in Blink.
138
136 if (!parent_) { 139 if (!parent_) {
137 CreateRootWebWidget(); 140 CreateRootWebWidget();
138 141
139 // This is the root of the tree (aka the main frame). 142 // This is the root of the tree (aka the main frame).
140 // Expected order for creating webframes is: 143 // Expected order for creating webframes is:
141 // . Create local webframe (first webframe must always be local). 144 // . Create local webframe (first webframe must always be local).
142 // . Set as main frame on WebView. 145 // . Set as main frame on WebView.
143 // . Swap to remote (if not local). 146 // . Swap to remote (if not local).
144 blink::WebLocalFrame* local_web_frame = 147 blink::WebLocalFrame* local_web_frame =
145 blink::WebLocalFrame::create(state_.tree_scope, this); 148 blink::WebLocalFrame::create(state_.tree_scope, this);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 StatsCollectionController::Install(web_frame_, GetApp()); 183 StatsCollectionController::Install(web_frame_, GetApp());
181 } 184 }
182 } else if (!params->is_local_create_child && params->window && 185 } else if (!params->is_local_create_child && params->window &&
183 id_ == params->window->id()) { 186 id_ == params->window->id()) {
184 // Frame represents the local frame, and it isn't the root of the tree. 187 // Frame represents the local frame, and it isn't the root of the tree.
185 HTMLFrame* previous_sibling = GetPreviousSibling(this); 188 HTMLFrame* previous_sibling = GetPreviousSibling(this);
186 blink::WebFrame* previous_web_frame = 189 blink::WebFrame* previous_web_frame =
187 previous_sibling ? previous_sibling->web_frame() : nullptr; 190 previous_sibling ? previous_sibling->web_frame() : nullptr;
188 CHECK(!parent_->IsLocal()); 191 CHECK(!parent_->IsLocal());
189 web_frame_ = parent_->web_frame()->toWebRemoteFrame()->createLocalChild( 192 web_frame_ = parent_->web_frame()->toWebRemoteFrame()->createLocalChild(
190 state_.tree_scope, state_.name, state_.sandbox_flags, this, 193 state_.tree_scope, state_.name, unique_name, state_.sandbox_flags, this,
191 previous_web_frame, 194 previous_web_frame,
192 // TODO(lazyboy): Replicate WebFrameOwnerProperties where needed. 195 // TODO(lazyboy): Replicate WebFrameOwnerProperties where needed.
193 blink::WebFrameOwnerProperties()); 196 blink::WebFrameOwnerProperties());
194 CreateLocalRootWebWidget(web_frame_->toWebLocalFrame()); 197 CreateLocalRootWebWidget(web_frame_->toWebLocalFrame());
195 } else if (!parent_->IsLocal()) { 198 } else if (!parent_->IsLocal()) {
196 web_frame_ = parent_->web_frame()->toWebRemoteFrame()->createRemoteChild( 199 web_frame_ = parent_->web_frame()->toWebRemoteFrame()->createRemoteChild(
197 state_.tree_scope, state_.name, state_.sandbox_flags, this); 200 state_.tree_scope, state_.name, unique_name, state_.sandbox_flags,
201 this);
198 } else { 202 } else {
199 CHECK(params->is_local_create_child); 203 CHECK(params->is_local_create_child);
200 204
201 blink::WebLocalFrame* child_web_frame = 205 blink::WebLocalFrame* child_web_frame =
202 blink::WebLocalFrame::create(state_.tree_scope, this); 206 blink::WebLocalFrame::create(state_.tree_scope, this);
203 web_frame_ = child_web_frame; 207 web_frame_ = child_web_frame;
204 parent_->web_frame_->appendChild(child_web_frame); 208 parent_->web_frame_->appendChild(child_web_frame);
205 } 209 }
206 210
207 DVLOG(2) << "HTMLFrame init this=" << this << " id=" << id_ 211 DVLOG(2) << "HTMLFrame init this=" << this << " id=" << id_
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 const blink::WebString& sink_id, 323 const blink::WebString& sink_id,
320 blink::WebMediaSession* media_session) { 324 blink::WebMediaSession* media_session) {
321 return global_state()->media_factory()->CreateMediaPlayer( 325 return global_state()->media_factory()->CreateMediaPlayer(
322 frame, url, client, encrypted_client, initial_cdm, GetApp()->shell()); 326 frame, url, client, encrypted_client, initial_cdm, GetApp()->shell());
323 } 327 }
324 328
325 blink::WebFrame* HTMLFrame::createChildFrame( 329 blink::WebFrame* HTMLFrame::createChildFrame(
326 blink::WebLocalFrame* parent, 330 blink::WebLocalFrame* parent,
327 blink::WebTreeScopeType scope, 331 blink::WebTreeScopeType scope,
328 const blink::WebString& frame_name, 332 const blink::WebString& frame_name,
333 const blink::WebString& /* frame_unique_name */,
329 blink::WebSandboxFlags sandbox_flags, 334 blink::WebSandboxFlags sandbox_flags,
330 const blink::WebFrameOwnerProperties& frame_owner_properties) { 335 const blink::WebFrameOwnerProperties& /* frame_owner_properties */) {
331 DCHECK(IsLocal()); // Can't create children of remote frames. 336 DCHECK(IsLocal()); // Can't create children of remote frames.
332 DCHECK_EQ(parent, web_frame_); 337 DCHECK_EQ(parent, web_frame_);
333 DCHECK(window_); // If we're local we have to have a window. 338 DCHECK(window_); // If we're local we have to have a window.
334 // Create the window that will house the frame now. We embed once we know the 339 // Create the window that will house the frame now. We embed once we know the
335 // url (see decidePolicyForNavigation()). 340 // url (see decidePolicyForNavigation()).
336 mus::Window* child_window = window_->connection()->NewWindow(); 341 mus::Window* child_window = window_->connection()->NewWindow();
342 // TODO(lukasza): Add |frame_unique_name| to ReplicatedFrameState?
337 ReplicatedFrameState child_state; 343 ReplicatedFrameState child_state;
338 child_state.name = frame_name; 344 child_state.name = frame_name;
339 child_state.tree_scope = scope; 345 child_state.tree_scope = scope;
340 child_state.sandbox_flags = sandbox_flags; 346 child_state.sandbox_flags = sandbox_flags;
341 mojo::Map<mojo::String, mojo::Array<uint8_t>> client_properties; 347 mojo::Map<mojo::String, mojo::Array<uint8_t>> client_properties;
342 client_properties.mark_non_null(); 348 client_properties.mark_non_null();
343 ClientPropertiesFromReplicatedFrameState(child_state, &client_properties); 349 ClientPropertiesFromReplicatedFrameState(child_state, &client_properties);
344 350
345 child_window->SetVisible(true); 351 child_window->SetVisible(true);
346 window_->AddChild(child_window); 352 window_->AddChild(child_window);
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 server_->LoadingStateChanged(true, load_progress); 479 server_->LoadingStateChanged(true, load_progress);
474 } 480 }
475 481
476 void HTMLFrame::dispatchLoad() { 482 void HTMLFrame::dispatchLoad() {
477 // According to comments of WebFrameClient::dispatchLoad(), this should only 483 // According to comments of WebFrameClient::dispatchLoad(), this should only
478 // be called when the parent frame is remote. 484 // be called when the parent frame is remote.
479 DCHECK(parent_ && !parent_->IsLocal()); 485 DCHECK(parent_ && !parent_->IsLocal());
480 server_->DispatchLoadEventToParent(); 486 server_->DispatchLoadEventToParent();
481 } 487 }
482 488
483 void HTMLFrame::didChangeName(blink::WebLocalFrame* frame, 489 void HTMLFrame::didChangeName(blink::WebLocalFrame* /* frame */,
alexmos 2016/02/10 00:46:46 Is this style ok? I haven't really seen this (lea
Łukasz Anforowicz 2016/02/10 22:10:50 I don't remember where I first saw this style, but
Charlie Reis 2016/02/11 22:02:14 It's moot in this case, since this file is gone no
Łukasz Anforowicz 2016/02/11 23:23:55 Right, but 1) we are not "omitting" the parameter
484 const blink::WebString& name) { 490 const blink::WebString& name,
491 const blink::WebString& /* unique_name */) {
492 // TODO(lukasza): Add |frame_unique_name| to ReplicatedFrameState?
485 state_.name = name; 493 state_.name = name;
486 server_->SetClientProperty(kPropertyFrameName, 494 server_->SetClientProperty(kPropertyFrameName,
487 FrameNameToClientProperty(name)); 495 FrameNameToClientProperty(name));
488 } 496 }
489 497
490 void HTMLFrame::didCommitProvisionalLoad( 498 void HTMLFrame::didCommitProvisionalLoad(
491 blink::WebLocalFrame* frame, 499 blink::WebLocalFrame* frame,
492 const blink::WebHistoryItem& item, 500 const blink::WebHistoryItem& item,
493 blink::WebHistoryCommitType commit_type) { 501 blink::WebHistoryCommitType commit_type) {
494 state_.origin = FrameOrigin(frame); 502 state_.origin = FrameOrigin(frame);
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
1041 1049
1042 if (!surface_layer_) 1050 if (!surface_layer_)
1043 return; 1051 return;
1044 1052
1045 surface_layer_->SetSurfaceId(cc::SurfaceId(owned_window_->window()->id()), 1053 surface_layer_->SetSurfaceId(cc::SurfaceId(owned_window_->window()->id()),
1046 global_state()->device_pixel_ratio(), 1054 global_state()->device_pixel_ratio(),
1047 owned_window_->window()->bounds().size()); 1055 owned_window_->window()->bounds().size());
1048 } 1056 }
1049 1057
1050 } // namespace mojo 1058 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698