| 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.h" | 5 #include "content/browser/frame_host/frame_tree.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <queue> | 9 #include <queue> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 render_frame_delegate, | 102 render_frame_delegate, |
| 103 render_widget_delegate, | 103 render_widget_delegate, |
| 104 manager_delegate, | 104 manager_delegate, |
| 105 nullptr, | 105 nullptr, |
| 106 // The top-level frame must always be in a | 106 // The top-level frame must always be in a |
| 107 // document scope. | 107 // document scope. |
| 108 blink::WebTreeScopeType::Document, | 108 blink::WebTreeScopeType::Document, |
| 109 std::string(), | 109 std::string(), |
| 110 std::string(), | 110 std::string(), |
| 111 FrameOwnerProperties())), | 111 FrameOwnerProperties())), |
| 112 focused_frame_tree_node_id_(-1), | 112 focused_frame_tree_node_id_(FrameTreeNode::kFrameTreeNodeInvalidId), |
| 113 load_progress_(0.0) {} | 113 load_progress_(0.0) {} |
| 114 | 114 |
| 115 FrameTree::~FrameTree() { | 115 FrameTree::~FrameTree() { |
| 116 delete root_; | 116 delete root_; |
| 117 root_ = nullptr; | 117 root_ = nullptr; |
| 118 } | 118 } |
| 119 | 119 |
| 120 FrameTreeNode* FrameTree::FindByID(int frame_tree_node_id) { | 120 FrameTreeNode* FrameTree::FindByID(int frame_tree_node_id) { |
| 121 for (FrameTreeNode* node : Nodes()) { | 121 for (FrameTreeNode* node : Nodes()) { |
| 122 if (node->frame_tree_node_id() == frame_tree_node_id) | 122 if (node->frame_tree_node_id() == frame_tree_node_id) |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 CHECK_GT(iter->second->ref_count(), 0); | 374 CHECK_GT(iter->second->ref_count(), 0); |
| 375 iter->second->decrement_ref_count(); | 375 iter->second->decrement_ref_count(); |
| 376 if (iter->second->ref_count() == 0) { | 376 if (iter->second->ref_count() == 0) { |
| 377 iter->second->ShutdownAndDestroy(); | 377 iter->second->ShutdownAndDestroy(); |
| 378 render_view_host_map_.erase(iter); | 378 render_view_host_map_.erase(iter); |
| 379 } | 379 } |
| 380 } | 380 } |
| 381 | 381 |
| 382 void FrameTree::FrameRemoved(FrameTreeNode* frame) { | 382 void FrameTree::FrameRemoved(FrameTreeNode* frame) { |
| 383 if (frame->frame_tree_node_id() == focused_frame_tree_node_id_) | 383 if (frame->frame_tree_node_id() == focused_frame_tree_node_id_) |
| 384 focused_frame_tree_node_id_ = -1; | 384 focused_frame_tree_node_id_ = FrameTreeNode::kFrameTreeNodeInvalidId; |
| 385 | 385 |
| 386 // No notification for the root frame. | 386 // No notification for the root frame. |
| 387 if (!frame->parent()) { | 387 if (!frame->parent()) { |
| 388 CHECK_EQ(frame, root_); | 388 CHECK_EQ(frame, root_); |
| 389 return; | 389 return; |
| 390 } | 390 } |
| 391 | 391 |
| 392 // Notify observers of the frame removal. | 392 // Notify observers of the frame removal. |
| 393 if (!on_frame_removed_.is_null()) | 393 if (!on_frame_removed_.is_null()) |
| 394 on_frame_removed_.Run(frame->current_frame_host()); | 394 on_frame_removed_.Run(frame->current_frame_host()); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 // This is only used to set page-level focus in cross-process subframes, and | 472 // This is only used to set page-level focus in cross-process subframes, and |
| 473 // requests to set focus in main frame's SiteInstance are ignored. | 473 // requests to set focus in main frame's SiteInstance are ignored. |
| 474 if (instance != root_manager->current_frame_host()->GetSiteInstance()) { | 474 if (instance != root_manager->current_frame_host()->GetSiteInstance()) { |
| 475 RenderFrameProxyHost* proxy = | 475 RenderFrameProxyHost* proxy = |
| 476 root_manager->GetRenderFrameProxyHost(instance); | 476 root_manager->GetRenderFrameProxyHost(instance); |
| 477 proxy->Send(new InputMsg_SetFocus(proxy->GetRoutingID(), is_focused)); | 477 proxy->Send(new InputMsg_SetFocus(proxy->GetRoutingID(), is_focused)); |
| 478 } | 478 } |
| 479 } | 479 } |
| 480 | 480 |
| 481 } // namespace content | 481 } // namespace content |
| OLD | NEW |