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

Side by Side Diff: content/browser/frame_host/frame_tree_node.cc

Issue 2329523003: Main frame's unique name can always be null. (Closed)
Patch Set: Addressed CR feedback from dcheng@. Created 4 years, 3 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 | « no previous file | content/browser/web_contents/web_contents_impl.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 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/browser/frame_host/frame_tree_node.h" 5 #include "content/browser/frame_host/frame_tree_node.h"
6 6
7 #include <queue> 7 #include <queue>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 is_potentially_trustworthy_unique_origin; 225 is_potentially_trustworthy_unique_origin;
226 } 226 }
227 227
228 void FrameTreeNode::SetFrameName(const std::string& name, 228 void FrameTreeNode::SetFrameName(const std::string& name,
229 const std::string& unique_name) { 229 const std::string& unique_name) {
230 if (name == replication_state_.name) { 230 if (name == replication_state_.name) {
231 // |unique_name| shouldn't change unless |name| changes. 231 // |unique_name| shouldn't change unless |name| changes.
232 DCHECK_EQ(unique_name, replication_state_.unique_name); 232 DCHECK_EQ(unique_name, replication_state_.unique_name);
233 return; 233 return;
234 } 234 }
235
236 if (parent()) {
237 // Non-main frames should have a non-empty unique name.
238 DCHECK(!unique_name.empty());
239 } else {
240 // Unique name of main frames should always stay empty.
241 DCHECK(unique_name.empty());
Charlie Reis 2016/09/15 20:04:12 This is in response to an IPC, right? Should we e
Łukasz Anforowicz 2016/09/15 20:55:13 Usually yes, but not necessarily. For example - a
242 }
243
235 RecordUniqueNameLength(unique_name.size()); 244 RecordUniqueNameLength(unique_name.size());
236 render_manager_.OnDidUpdateName(name, unique_name); 245 render_manager_.OnDidUpdateName(name, unique_name);
237 replication_state_.name = name; 246 replication_state_.name = name;
238 replication_state_.unique_name = unique_name; 247 replication_state_.unique_name = unique_name;
239 } 248 }
240 249
241 void FrameTreeNode::AddContentSecurityPolicy( 250 void FrameTreeNode::AddContentSecurityPolicy(
242 const ContentSecurityPolicyHeader& header) { 251 const ContentSecurityPolicyHeader& header) {
243 replication_state_.accumulated_csp_headers.push_back(header); 252 replication_state_.accumulated_csp_headers.push_back(header);
244 render_manager_.OnDidAddContentSecurityPolicy(header); 253 render_manager_.OnDidAddContentSecurityPolicy(header);
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 } 503 }
495 return parent_->child_at(i + relative_offset); 504 return parent_->child_at(i + relative_offset);
496 } 505 }
497 } 506 }
498 507
499 NOTREACHED() << "FrameTreeNode not found in its parent's children."; 508 NOTREACHED() << "FrameTreeNode not found in its parent's children.";
500 return nullptr; 509 return nullptr;
501 } 510 }
502 511
503 } // namespace content 512 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/web_contents/web_contents_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698