| OLD | NEW |
| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 frame_tree_node_id_(next_frame_tree_node_id_++), | 91 frame_tree_node_id_(next_frame_tree_node_id_++), |
| 92 parent_(NULL), | 92 parent_(NULL), |
| 93 opener_(nullptr), | 93 opener_(nullptr), |
| 94 opener_observer_(nullptr), | 94 opener_observer_(nullptr), |
| 95 has_committed_real_load_(false), | 95 has_committed_real_load_(false), |
| 96 replication_state_( | 96 replication_state_( |
| 97 scope, | 97 scope, |
| 98 name, | 98 name, |
| 99 unique_name, | 99 unique_name, |
| 100 blink::WebSandboxFlags::None, | 100 blink::WebSandboxFlags::None, |
| 101 false /* should enforce strict mixed content checking */), | 101 false /* should enforce strict mixed content checking */, |
| 102 false /* is a potentially trustworthy unique origin */), |
| 102 pending_sandbox_flags_(blink::WebSandboxFlags::None), | 103 pending_sandbox_flags_(blink::WebSandboxFlags::None), |
| 103 frame_owner_properties_(frame_owner_properties), | 104 frame_owner_properties_(frame_owner_properties), |
| 104 loading_progress_(kLoadingProgressNotStarted) { | 105 loading_progress_(kLoadingProgressNotStarted) { |
| 105 std::pair<FrameTreeNodeIdMap::iterator, bool> result = | 106 std::pair<FrameTreeNodeIdMap::iterator, bool> result = |
| 106 g_frame_tree_node_id_map.Get().insert( | 107 g_frame_tree_node_id_map.Get().insert( |
| 107 std::make_pair(frame_tree_node_id_, this)); | 108 std::make_pair(frame_tree_node_id_, this)); |
| 108 CHECK(result.second); | 109 CHECK(result.second); |
| 109 | 110 |
| 110 TRACE_EVENT_OBJECT_CREATED_WITH_ID( | 111 TRACE_EVENT_OBJECT_CREATED_WITH_ID( |
| 111 "navigation", "FrameTreeNode", | 112 "navigation", "FrameTreeNode", |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 } | 206 } |
| 206 } | 207 } |
| 207 | 208 |
| 208 void FrameTreeNode::SetCurrentURL(const GURL& url) { | 209 void FrameTreeNode::SetCurrentURL(const GURL& url) { |
| 209 if (!has_committed_real_load_ && url != GURL(url::kAboutBlankURL)) | 210 if (!has_committed_real_load_ && url != GURL(url::kAboutBlankURL)) |
| 210 has_committed_real_load_ = true; | 211 has_committed_real_load_ = true; |
| 211 current_frame_host()->set_last_committed_url(url); | 212 current_frame_host()->set_last_committed_url(url); |
| 212 TraceSnapshot(); | 213 TraceSnapshot(); |
| 213 } | 214 } |
| 214 | 215 |
| 215 void FrameTreeNode::SetCurrentOrigin(const url::Origin& origin) { | 216 void FrameTreeNode::SetCurrentOrigin( |
| 216 if (!origin.IsSameOriginWith(replication_state_.origin)) | 217 const url::Origin& origin, |
| 217 render_manager_.OnDidUpdateOrigin(origin); | 218 bool is_potentially_trustworthy_unique_origin) { |
| 219 if (!origin.IsSameOriginWith(replication_state_.origin) || |
| 220 replication_state_.has_potentially_trustworthy_unique_origin != |
| 221 is_potentially_trustworthy_unique_origin) { |
| 222 render_manager_.OnDidUpdateOrigin(origin, |
| 223 is_potentially_trustworthy_unique_origin); |
| 224 } |
| 218 replication_state_.origin = origin; | 225 replication_state_.origin = origin; |
| 226 replication_state_.has_potentially_trustworthy_unique_origin = |
| 227 is_potentially_trustworthy_unique_origin; |
| 219 } | 228 } |
| 220 | 229 |
| 221 void FrameTreeNode::SetFrameName(const std::string& name, | 230 void FrameTreeNode::SetFrameName(const std::string& name, |
| 222 const std::string& unique_name) { | 231 const std::string& unique_name) { |
| 223 if (name == replication_state_.name) { | 232 if (name == replication_state_.name) { |
| 224 // |unique_name| shouldn't change unless |name| changes. | 233 // |unique_name| shouldn't change unless |name| changes. |
| 225 DCHECK_EQ(unique_name, replication_state_.unique_name); | 234 DCHECK_EQ(unique_name, replication_state_.unique_name); |
| 226 return; | 235 return; |
| 227 } | 236 } |
| 228 render_manager_.OnDidUpdateName(name, unique_name); | 237 render_manager_.OnDidUpdateName(name, unique_name); |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 void FrameTreeNode::TraceSnapshot() const { | 473 void FrameTreeNode::TraceSnapshot() const { |
| 465 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 474 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 466 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID( | 475 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID( |
| 467 "navigation", "FrameTreeNode", | 476 "navigation", "FrameTreeNode", |
| 468 TRACE_ID_WITH_SCOPE("FrameTreeNode", frame_tree_node_id_), | 477 TRACE_ID_WITH_SCOPE("FrameTreeNode", frame_tree_node_id_), |
| 469 scoped_ptr<base::trace_event::ConvertableToTraceFormat>( | 478 scoped_ptr<base::trace_event::ConvertableToTraceFormat>( |
| 470 new TracedFrameTreeNode(*this))); | 479 new TracedFrameTreeNode(*this))); |
| 471 } | 480 } |
| 472 | 481 |
| 473 } // namespace content | 482 } // namespace content |
| OLD | NEW |