Chromium Code Reviews| 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/profiler/scoped_tracker.h" | 10 #include "base/profiler/scoped_tracker.h" |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 159 return false; | 159 return false; |
| 160 } | 160 } |
| 161 | 161 |
| 162 bool FrameTreeNode::IsLoading() const { | 162 bool FrameTreeNode::IsLoading() const { |
| 163 RenderFrameHostImpl* current_frame_host = | 163 RenderFrameHostImpl* current_frame_host = |
| 164 render_manager_.current_frame_host(); | 164 render_manager_.current_frame_host(); |
| 165 RenderFrameHostImpl* pending_frame_host = | 165 RenderFrameHostImpl* pending_frame_host = |
| 166 render_manager_.pending_frame_host(); | 166 render_manager_.pending_frame_host(); |
| 167 | 167 |
| 168 DCHECK(current_frame_host); | 168 DCHECK(current_frame_host); |
| 169 // TODO(fdegans): Change the implementation logic for PlzNavigate once | 169 |
| 170 // DidStartLoading and DidStopLoading are properly called. | 170 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 171 if (pending_frame_host && pending_frame_host->is_loading()) | 171 switches::kEnableBrowserSideNavigation)) { |
| 172 return true; | 172 if (navigation_request_) |
| 173 return true; | |
| 174 } else { | |
| 175 if (pending_frame_host && pending_frame_host->is_loading()) | |
| 176 return true; | |
| 177 } | |
| 173 return current_frame_host->is_loading(); | 178 return current_frame_host->is_loading(); |
| 174 } | 179 } |
| 175 | 180 |
| 176 bool FrameTreeNode::CommitPendingSandboxFlags() { | 181 bool FrameTreeNode::CommitPendingSandboxFlags() { |
| 177 bool did_change_flags = | 182 bool did_change_flags = |
| 178 effective_sandbox_flags_ != replication_state_.sandbox_flags; | 183 effective_sandbox_flags_ != replication_state_.sandbox_flags; |
| 179 effective_sandbox_flags_ = replication_state_.sandbox_flags; | 184 effective_sandbox_flags_ = replication_state_.sandbox_flags; |
| 180 return did_change_flags; | 185 return did_change_flags; |
| 181 } | 186 } |
| 182 | 187 |
| 183 void FrameTreeNode::SetNavigationRequest( | 188 void FrameTreeNode::SetNavigationRequest( |
| 184 scoped_ptr<NavigationRequest> navigation_request) { | 189 scoped_ptr<NavigationRequest> navigation_request) { |
| 185 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( | 190 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 186 switches::kEnableBrowserSideNavigation)); | 191 switches::kEnableBrowserSideNavigation)); |
| 187 ResetNavigationRequest(false); | 192 ResetNavigationRequest(false); |
| 188 // TODO(clamy): perform the StartLoading logic here. | 193 |
| 194 // Force the throbber to start to keep it in sync with what is happening in | |
| 195 // the UI. Blink doesn't send throb notifications for JavaScript URLs, so it | |
| 196 // is not done here either. | |
| 197 if (!navigation_request->common_params().url.SchemeIs( | |
| 198 url::kJavaScriptScheme)) { | |
| 199 // TODO(fdegans): Check if this is a same-document navigation and set the | |
| 200 // proper argument. | |
| 201 DidStartLoading(true); | |
| 202 } | |
| 203 | |
| 189 navigation_request_ = navigation_request.Pass(); | 204 navigation_request_ = navigation_request.Pass(); |
| 190 } | 205 } |
| 191 | 206 |
| 192 void FrameTreeNode::ResetNavigationRequest(bool is_commit) { | 207 void FrameTreeNode::ResetNavigationRequest(bool is_commit) { |
| 193 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( | 208 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 194 switches::kEnableBrowserSideNavigation)); | 209 switches::kEnableBrowserSideNavigation)); |
| 195 // Upon commit the current NavigationRequest will be reset. There should be no | 210 // Upon commit the current NavigationRequest will be reset. There should be no |
| 196 // cleanup performed since the navigation is still ongoing. If the reset | 211 // cleanup performed since the navigation is still ongoing. If the reset |
|
Charlie Reis
2015/04/28 23:10:04
What navigation tasks are still ongoing after comm
Fabrice (no longer in Chrome)
2015/04/29 09:54:43
Yes it is the loading state. I rephrased the comme
| |
| 197 // corresponds to a cancelation, the RenderFrameHostManager should clean up | 212 // corresponds to a cancelation, the RenderFrameHostManager should clean up |
| 198 // any speculative RenderFrameHost it created for the navigation. | 213 // any speculative RenderFrameHost it created for the navigation. |
| 199 if (navigation_request_ && !is_commit) { | 214 if (navigation_request_) { |
| 200 // TODO(clamy): perform the StopLoading logic. | 215 navigation_request_.reset(); |
| 216 if (is_commit) | |
| 217 return; | |
| 218 DidStopLoading(); | |
| 201 render_manager_.CleanUpNavigation(); | 219 render_manager_.CleanUpNavigation(); |
| 202 } | 220 } |
| 203 navigation_request_.reset(); | |
| 204 } | 221 } |
| 205 | 222 |
| 206 bool FrameTreeNode::has_started_loading() const { | 223 bool FrameTreeNode::has_started_loading() const { |
| 207 return loading_progress_ != kLoadingProgressNotStarted; | 224 return loading_progress_ != kLoadingProgressNotStarted; |
| 208 } | 225 } |
| 209 | 226 |
| 210 void FrameTreeNode::reset_loading_progress() { | 227 void FrameTreeNode::reset_loading_progress() { |
| 211 loading_progress_ = kLoadingProgressNotStarted; | 228 loading_progress_ = kLoadingProgressNotStarted; |
| 212 } | 229 } |
| 213 | 230 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 262 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 279 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 263 "465796 FrameTreeNode::DidStopLoading::End")); | 280 "465796 FrameTreeNode::DidStopLoading::End")); |
| 264 } | 281 } |
| 265 | 282 |
| 266 void FrameTreeNode::DidChangeLoadProgress(double load_progress) { | 283 void FrameTreeNode::DidChangeLoadProgress(double load_progress) { |
| 267 loading_progress_ = load_progress; | 284 loading_progress_ = load_progress; |
| 268 frame_tree_->UpdateLoadProgress(); | 285 frame_tree_->UpdateLoadProgress(); |
| 269 } | 286 } |
| 270 | 287 |
| 271 } // namespace content | 288 } // namespace content |
| OLD | NEW |