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 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
11 #include "content/browser/frame_host/frame_tree.h" | 11 #include "content/browser/frame_host/frame_tree.h" |
| 12 #include "content/browser/frame_host/navigation_request.h" |
12 #include "content/browser/frame_host/navigator.h" | 13 #include "content/browser/frame_host/navigator.h" |
13 #include "content/browser/frame_host/render_frame_host_impl.h" | 14 #include "content/browser/frame_host/render_frame_host_impl.h" |
14 #include "content/browser/renderer_host/render_view_host_impl.h" | 15 #include "content/browser/renderer_host/render_view_host_impl.h" |
15 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
16 #include "content/public/common/content_switches.h" | 17 #include "content/public/common/content_switches.h" |
17 | 18 |
18 namespace content { | 19 namespace content { |
19 | 20 |
20 namespace { | 21 namespace { |
21 | 22 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 std::pair<FrameTreeNodeIDMap::iterator, bool> result = | 65 std::pair<FrameTreeNodeIDMap::iterator, bool> result = |
65 g_frame_tree_node_id_map.Get().insert( | 66 g_frame_tree_node_id_map.Get().insert( |
66 std::make_pair(frame_tree_node_id_, this)); | 67 std::make_pair(frame_tree_node_id_, this)); |
67 CHECK(result.second); | 68 CHECK(result.second); |
68 } | 69 } |
69 | 70 |
70 FrameTreeNode::~FrameTreeNode() { | 71 FrameTreeNode::~FrameTreeNode() { |
71 frame_tree_->FrameRemoved(this); | 72 frame_tree_->FrameRemoved(this); |
72 | 73 |
73 g_frame_tree_node_id_map.Get().erase(frame_tree_node_id_); | 74 g_frame_tree_node_id_map.Get().erase(frame_tree_node_id_); |
74 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | |
75 switches::kEnableBrowserSideNavigation)) { | |
76 navigator_->CancelNavigation(this); | |
77 } | |
78 } | 75 } |
79 | 76 |
80 bool FrameTreeNode::IsMainFrame() const { | 77 bool FrameTreeNode::IsMainFrame() const { |
81 return frame_tree_->root() == this; | 78 return frame_tree_->root() == this; |
82 } | 79 } |
83 | 80 |
84 void FrameTreeNode::AddChild(scoped_ptr<FrameTreeNode> child, | 81 void FrameTreeNode::AddChild(scoped_ptr<FrameTreeNode> child, |
85 int process_id, | 82 int process_id, |
86 int frame_routing_id) { | 83 int frame_routing_id) { |
87 // Child frame must always be created in the same process as the parent. | 84 // Child frame must always be created in the same process as the parent. |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 return current_frame_host->is_loading(); | 164 return current_frame_host->is_loading(); |
168 } | 165 } |
169 | 166 |
170 bool FrameTreeNode::CommitPendingSandboxFlags() { | 167 bool FrameTreeNode::CommitPendingSandboxFlags() { |
171 bool did_change_flags = | 168 bool did_change_flags = |
172 effective_sandbox_flags_ != replication_state_.sandbox_flags; | 169 effective_sandbox_flags_ != replication_state_.sandbox_flags; |
173 effective_sandbox_flags_ = replication_state_.sandbox_flags; | 170 effective_sandbox_flags_ = replication_state_.sandbox_flags; |
174 return did_change_flags; | 171 return did_change_flags; |
175 } | 172 } |
176 | 173 |
| 174 void FrameTreeNode::SetNavigationRequest( |
| 175 scoped_ptr<NavigationRequest> navigation_request) { |
| 176 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 177 switches::kEnableBrowserSideNavigation)); |
| 178 ResetNavigationRequest(false); |
| 179 // TODO(clamy): perform the StartLoading logic here. |
| 180 navigation_request_ = navigation_request.Pass(); |
| 181 } |
| 182 |
| 183 void FrameTreeNode::ResetNavigationRequest(bool is_commit) { |
| 184 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 185 switches::kEnableBrowserSideNavigation)); |
| 186 // Upon commit the current NavigationRequest will be reset. There should be no |
| 187 // cleanup performed since the navigation is still ongoing. If the reset |
| 188 // corresponds to a cancelation, the RenderFrameHostManager should clean up |
| 189 // any speculative RenderFrameHost it created for the navigation. |
| 190 if (navigation_request_ && !is_commit) { |
| 191 // TODO(clamy): perform the StopLoading logic. |
| 192 render_manager_.CleanUpNavigation(); |
| 193 } |
| 194 navigation_request_.reset(); |
| 195 } |
| 196 |
177 } // namespace content | 197 } // namespace content |
OLD | NEW |