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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 parent_(parent), | 95 parent_(parent), |
96 opener_(nullptr), | 96 opener_(nullptr), |
97 opener_observer_(nullptr), | 97 opener_observer_(nullptr), |
98 has_committed_real_load_(false), | 98 has_committed_real_load_(false), |
99 replication_state_( | 99 replication_state_( |
100 scope, | 100 scope, |
101 name, | 101 name, |
102 unique_name, | 102 unique_name, |
103 blink::WebSandboxFlags::None, | 103 blink::WebSandboxFlags::None, |
104 false /* should enforce strict mixed content checking */, | 104 false /* should enforce strict mixed content checking */, |
105 false /* is a potentially trustworthy unique origin */), | 105 false /* is a potentially trustworthy unique origin */, |
| 106 false /* has received a user gesture */), |
106 pending_sandbox_flags_(blink::WebSandboxFlags::None), | 107 pending_sandbox_flags_(blink::WebSandboxFlags::None), |
107 frame_owner_properties_(frame_owner_properties), | 108 frame_owner_properties_(frame_owner_properties), |
108 loading_progress_(kLoadingProgressNotStarted), | 109 loading_progress_(kLoadingProgressNotStarted), |
109 blame_context_(frame_tree_node_id_, parent) { | 110 blame_context_(frame_tree_node_id_, parent) { |
110 std::pair<FrameTreeNodeIdMap::iterator, bool> result = | 111 std::pair<FrameTreeNodeIdMap::iterator, bool> result = |
111 g_frame_tree_node_id_map.Get().insert( | 112 g_frame_tree_node_id_map.Get().insert( |
112 std::make_pair(frame_tree_node_id_, this)); | 113 std::make_pair(frame_tree_node_id_, this)); |
113 CHECK(result.second); | 114 CHECK(result.second); |
114 | 115 |
115 RecordUniqueNameLength(unique_name.size()); | 116 RecordUniqueNameLength(unique_name.size()); |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 if (speculative_frame_host) | 503 if (speculative_frame_host) |
503 speculative_frame_host->ResetLoadingState(); | 504 speculative_frame_host->ResetLoadingState(); |
504 } else { | 505 } else { |
505 RenderFrameHostImpl* pending_frame_host = | 506 RenderFrameHostImpl* pending_frame_host = |
506 render_manager_.pending_frame_host(); | 507 render_manager_.pending_frame_host(); |
507 if (pending_frame_host) | 508 if (pending_frame_host) |
508 pending_frame_host->ResetLoadingState(); | 509 pending_frame_host->ResetLoadingState(); |
509 } | 510 } |
510 } | 511 } |
511 | 512 |
| 513 void FrameTreeNode::OnSetHasReceivedUserGesture() { |
| 514 render_manager_.OnSetHasReceivedUserGesture(); |
| 515 replication_state_.has_received_user_gesture = true; |
| 516 } |
| 517 |
512 FrameTreeNode* FrameTreeNode::GetSibling(int relative_offset) const { | 518 FrameTreeNode* FrameTreeNode::GetSibling(int relative_offset) const { |
513 if (!parent_ || !parent_->child_count()) | 519 if (!parent_ || !parent_->child_count()) |
514 return nullptr; | 520 return nullptr; |
515 | 521 |
516 for (size_t i = 0; i < parent_->child_count(); ++i) { | 522 for (size_t i = 0; i < parent_->child_count(); ++i) { |
517 if (parent_->child_at(i) == this) { | 523 if (parent_->child_at(i) == this) { |
518 if ((relative_offset < 0 && static_cast<size_t>(-relative_offset) > i) || | 524 if ((relative_offset < 0 && static_cast<size_t>(-relative_offset) > i) || |
519 i + relative_offset >= parent_->child_count()) { | 525 i + relative_offset >= parent_->child_count()) { |
520 return nullptr; | 526 return nullptr; |
521 } | 527 } |
522 return parent_->child_at(i + relative_offset); | 528 return parent_->child_at(i + relative_offset); |
523 } | 529 } |
524 } | 530 } |
525 | 531 |
526 NOTREACHED() << "FrameTreeNode not found in its parent's children."; | 532 NOTREACHED() << "FrameTreeNode not found in its parent's children."; |
527 return nullptr; | 533 return nullptr; |
528 } | 534 } |
529 | 535 |
530 } // namespace content | 536 } // namespace content |
OLD | NEW |