| 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 | 9 |
| 9 #include "base/macros.h" | 10 #include "base/macros.h" |
| 10 #include "base/profiler/scoped_tracker.h" | 11 #include "base/profiler/scoped_tracker.h" |
| 11 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
| 12 #include "content/browser/frame_host/frame_tree.h" | 13 #include "content/browser/frame_host/frame_tree.h" |
| 13 #include "content/browser/frame_host/navigation_request.h" | 14 #include "content/browser/frame_host/navigation_request.h" |
| 14 #include "content/browser/frame_host/navigator.h" | 15 #include "content/browser/frame_host/navigator.h" |
| 15 #include "content/browser/frame_host/render_frame_host_impl.h" | 16 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 16 #include "content/browser/renderer_host/render_view_host_impl.h" | 17 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 17 #include "content/common/frame_messages.h" | 18 #include "content/common/frame_messages.h" |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 MSG_ROUTING_NONE); | 146 MSG_ROUTING_NONE); |
| 146 | 147 |
| 147 // Other renderer processes in this BrowsingInstance may need to find out | 148 // Other renderer processes in this BrowsingInstance may need to find out |
| 148 // about the new frame. Create a proxy for the child frame in all | 149 // about the new frame. Create a proxy for the child frame in all |
| 149 // SiteInstances that have a proxy for the frame's parent, since all frames | 150 // SiteInstances that have a proxy for the frame's parent, since all frames |
| 150 // in a frame tree should have the same set of proxies. | 151 // in a frame tree should have the same set of proxies. |
| 151 // TODO(alexmos, nick): We ought to do this for non-oopif too, for openers. | 152 // TODO(alexmos, nick): We ought to do this for non-oopif too, for openers. |
| 152 if (SiteIsolationPolicy::AreCrossProcessFramesPossible()) | 153 if (SiteIsolationPolicy::AreCrossProcessFramesPossible()) |
| 153 render_manager_.CreateProxiesForChildFrame(child.get()); | 154 render_manager_.CreateProxiesForChildFrame(child.get()); |
| 154 | 155 |
| 155 children_.push_back(child.Pass()); | 156 children_.push_back(std::move(child)); |
| 156 return children_.back().get(); | 157 return children_.back().get(); |
| 157 } | 158 } |
| 158 | 159 |
| 159 void FrameTreeNode::RemoveChild(FrameTreeNode* child) { | 160 void FrameTreeNode::RemoveChild(FrameTreeNode* child) { |
| 160 for (auto iter = children_.begin(); iter != children_.end(); ++iter) { | 161 for (auto iter = children_.begin(); iter != children_.end(); ++iter) { |
| 161 if (iter->get() == child) { | 162 if (iter->get() == child) { |
| 162 // Subtle: we need to make sure the node is gone from the tree before | 163 // Subtle: we need to make sure the node is gone from the tree before |
| 163 // observers are notified of its deletion. | 164 // observers are notified of its deletion. |
| 164 scoped_ptr<FrameTreeNode> node_to_delete(iter->Pass()); | 165 scoped_ptr<FrameTreeNode> node_to_delete(std::move(*iter)); |
| 165 children_.erase(iter); | 166 children_.erase(iter); |
| 166 node_to_delete.reset(); | 167 node_to_delete.reset(); |
| 167 return; | 168 return; |
| 168 } | 169 } |
| 169 } | 170 } |
| 170 } | 171 } |
| 171 | 172 |
| 172 void FrameTreeNode::ResetForNewProcess() { | 173 void FrameTreeNode::ResetForNewProcess() { |
| 173 current_url_ = GURL(); | 174 current_url_ = GURL(); |
| 174 | 175 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 // Force the throbber to start to keep it in sync with what is happening in | 284 // Force the throbber to start to keep it in sync with what is happening in |
| 284 // the UI. Blink doesn't send throb notifications for JavaScript URLs, so it | 285 // the UI. Blink doesn't send throb notifications for JavaScript URLs, so it |
| 285 // is not done here either. | 286 // is not done here either. |
| 286 if (!navigation_request->common_params().url.SchemeIs( | 287 if (!navigation_request->common_params().url.SchemeIs( |
| 287 url::kJavaScriptScheme)) { | 288 url::kJavaScriptScheme)) { |
| 288 // TODO(fdegans): Check if this is a same-document navigation and set the | 289 // TODO(fdegans): Check if this is a same-document navigation and set the |
| 289 // proper argument. | 290 // proper argument. |
| 290 DidStartLoading(true); | 291 DidStartLoading(true); |
| 291 } | 292 } |
| 292 | 293 |
| 293 navigation_request_ = navigation_request.Pass(); | 294 navigation_request_ = std::move(navigation_request); |
| 294 | 295 |
| 295 render_manager()->DidCreateNavigationRequest(*navigation_request_); | 296 render_manager()->DidCreateNavigationRequest(*navigation_request_); |
| 296 } | 297 } |
| 297 | 298 |
| 298 void FrameTreeNode::ResetNavigationRequest(bool is_commit) { | 299 void FrameTreeNode::ResetNavigationRequest(bool is_commit) { |
| 299 CHECK(IsBrowserSideNavigationEnabled()); | 300 CHECK(IsBrowserSideNavigationEnabled()); |
| 300 if (!navigation_request_) | 301 if (!navigation_request_) |
| 301 return; | 302 return; |
| 302 navigation_request_.reset(); | 303 navigation_request_.reset(); |
| 303 | 304 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 render_manager_.Stop(); | 392 render_manager_.Stop(); |
| 392 return true; | 393 return true; |
| 393 } | 394 } |
| 394 | 395 |
| 395 void FrameTreeNode::DidFocus() { | 396 void FrameTreeNode::DidFocus() { |
| 396 last_focus_time_ = base::TimeTicks::Now(); | 397 last_focus_time_ = base::TimeTicks::Now(); |
| 397 FOR_EACH_OBSERVER(Observer, observers_, OnFrameTreeNodeFocused(this)); | 398 FOR_EACH_OBSERVER(Observer, observers_, OnFrameTreeNodeFocused(this)); |
| 398 } | 399 } |
| 399 | 400 |
| 400 } // namespace content | 401 } // namespace content |
| OLD | NEW |