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" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
64 std::pair<FrameTreeNodeIDMap::iterator, bool> result = | 64 std::pair<FrameTreeNodeIDMap::iterator, bool> result = |
65 g_frame_tree_node_id_map.Get().insert( | 65 g_frame_tree_node_id_map.Get().insert( |
66 std::make_pair(frame_tree_node_id_, this)); | 66 std::make_pair(frame_tree_node_id_, this)); |
67 CHECK(result.second); | 67 CHECK(result.second); |
68 } | 68 } |
69 | 69 |
70 FrameTreeNode::~FrameTreeNode() { | 70 FrameTreeNode::~FrameTreeNode() { |
71 frame_tree_->FrameRemoved(this); | 71 frame_tree_->FrameRemoved(this); |
72 | 72 |
73 g_frame_tree_node_id_map.Get().erase(frame_tree_node_id_); | 73 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 } | 74 } |
79 | 75 |
80 bool FrameTreeNode::IsMainFrame() const { | 76 bool FrameTreeNode::IsMainFrame() const { |
81 return frame_tree_->root() == this; | 77 return frame_tree_->root() == this; |
82 } | 78 } |
83 | 79 |
84 void FrameTreeNode::AddChild(scoped_ptr<FrameTreeNode> child, | 80 void FrameTreeNode::AddChild(scoped_ptr<FrameTreeNode> child, |
85 int process_id, | 81 int process_id, |
86 int frame_routing_id) { | 82 int frame_routing_id) { |
87 // Child frame must always be created in the same process as the parent. | 83 // 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(); | 163 return current_frame_host->is_loading(); |
168 } | 164 } |
169 | 165 |
170 bool FrameTreeNode::CommitPendingSandboxFlags() { | 166 bool FrameTreeNode::CommitPendingSandboxFlags() { |
171 bool did_change_flags = | 167 bool did_change_flags = |
172 effective_sandbox_flags_ != replication_state_.sandbox_flags; | 168 effective_sandbox_flags_ != replication_state_.sandbox_flags; |
173 effective_sandbox_flags_ = replication_state_.sandbox_flags; | 169 effective_sandbox_flags_ = replication_state_.sandbox_flags; |
174 return did_change_flags; | 170 return did_change_flags; |
175 } | 171 } |
176 | 172 |
173 void FrameTreeNode::SetNavigationRequest( | |
174 scoped_ptr<NavigationRequest> navigation_request) { | |
175 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( | |
176 switches::kEnableBrowserSideNavigation)); | |
177 ResetNavigationRequest(false); | |
178 // TODO(clamy): perform the StartLoading logic here. | |
179 navigation_request_ = navigation_request.Pass(); | |
180 } | |
181 | |
182 void FrameTreeNode::ResetNavigationRequest(bool is_commit) { | |
183 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( | |
184 switches::kEnableBrowserSideNavigation)); | |
185 // If there is an ongoing navigation, clean up any state that could have been | |
186 // created in the RenderFrameHostManager. | |
187 if (navigation_request_ && !is_commit) { | |
188 // TODO(clamy): perform the StopLoading logic. | |
nasko
2015/04/15 20:36:03
Why does it matter whether this is a commit or not
clamy
2015/04/16 12:12:30
On commit we reset the navigation request because
| |
189 render_manager_.CleanUpNavigation(); | |
190 } | |
191 navigation_request_.reset(); | |
192 } | |
193 | |
177 } // namespace content | 194 } // namespace content |
OLD | NEW |