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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 114 |
115 RecordUniqueNameLength(unique_name.size()); | 115 RecordUniqueNameLength(unique_name.size()); |
116 | 116 |
117 // Note: this should always be done last in the constructor. | 117 // Note: this should always be done last in the constructor. |
118 blame_context_.Initialize(); | 118 blame_context_.Initialize(); |
119 } | 119 } |
120 | 120 |
121 FrameTreeNode::~FrameTreeNode() { | 121 FrameTreeNode::~FrameTreeNode() { |
122 std::vector<std::unique_ptr<FrameTreeNode>>().swap(children_); | 122 std::vector<std::unique_ptr<FrameTreeNode>>().swap(children_); |
123 frame_tree_->FrameRemoved(this); | 123 frame_tree_->FrameRemoved(this); |
124 FOR_EACH_OBSERVER(Observer, observers_, OnFrameTreeNodeDestroyed(this)); | 124 for (auto& observer : observers_) |
| 125 observer.OnFrameTreeNodeDestroyed(this); |
125 | 126 |
126 if (opener_) | 127 if (opener_) |
127 opener_->RemoveObserver(opener_observer_.get()); | 128 opener_->RemoveObserver(opener_observer_.get()); |
128 | 129 |
129 g_frame_tree_node_id_map.Get().erase(frame_tree_node_id_); | 130 g_frame_tree_node_id_map.Get().erase(frame_tree_node_id_); |
130 } | 131 } |
131 | 132 |
132 void FrameTreeNode::AddObserver(Observer* observer) { | 133 void FrameTreeNode::AddObserver(Observer* observer) { |
133 observers_.AddObserver(observer); | 134 observers_.AddObserver(observer); |
134 } | 135 } |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 // mode. | 459 // mode. |
459 if (!IsMainFrame()) | 460 if (!IsMainFrame()) |
460 return true; | 461 return true; |
461 | 462 |
462 render_manager_.Stop(); | 463 render_manager_.Stop(); |
463 return true; | 464 return true; |
464 } | 465 } |
465 | 466 |
466 void FrameTreeNode::DidFocus() { | 467 void FrameTreeNode::DidFocus() { |
467 last_focus_time_ = base::TimeTicks::Now(); | 468 last_focus_time_ = base::TimeTicks::Now(); |
468 FOR_EACH_OBSERVER(Observer, observers_, OnFrameTreeNodeFocused(this)); | 469 for (auto& observer : observers_) |
| 470 observer.OnFrameTreeNodeFocused(this); |
469 } | 471 } |
470 | 472 |
471 void FrameTreeNode::BeforeUnloadCanceled() { | 473 void FrameTreeNode::BeforeUnloadCanceled() { |
472 // TODO(clamy): Support BeforeUnload in subframes. | 474 // TODO(clamy): Support BeforeUnload in subframes. |
473 if (!IsMainFrame()) | 475 if (!IsMainFrame()) |
474 return; | 476 return; |
475 | 477 |
476 RenderFrameHostImpl* current_frame_host = | 478 RenderFrameHostImpl* current_frame_host = |
477 render_manager_.current_frame_host(); | 479 render_manager_.current_frame_host(); |
478 DCHECK(current_frame_host); | 480 DCHECK(current_frame_host); |
(...skipping 24 matching lines...) Expand all Loading... |
503 } | 505 } |
504 return parent_->child_at(i + relative_offset); | 506 return parent_->child_at(i + relative_offset); |
505 } | 507 } |
506 } | 508 } |
507 | 509 |
508 NOTREACHED() << "FrameTreeNode not found in its parent's children."; | 510 NOTREACHED() << "FrameTreeNode not found in its parent's children."; |
509 return nullptr; | 511 return nullptr; |
510 } | 512 } |
511 | 513 |
512 } // namespace content | 514 } // namespace content |
OLD | NEW |