| 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 #include <utility> |
| 9 | 9 |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 navigation_request_->common_params().navigation_type); | 393 navigation_request_->common_params().navigation_type); |
| 394 | 394 |
| 395 DidStartLoading(to_different_document, was_previously_loading); | 395 DidStartLoading(to_different_document, was_previously_loading); |
| 396 } | 396 } |
| 397 | 397 |
| 398 void FrameTreeNode::ResetNavigationRequest(bool keep_state, | 398 void FrameTreeNode::ResetNavigationRequest(bool keep_state, |
| 399 bool inform_renderer) { | 399 bool inform_renderer) { |
| 400 CHECK(IsBrowserSideNavigationEnabled()); | 400 CHECK(IsBrowserSideNavigationEnabled()); |
| 401 if (!navigation_request_) | 401 if (!navigation_request_) |
| 402 return; | 402 return; |
| 403 bool was_renderer_initiated = !navigation_request_->browser_initiated(); | 403 int renderer_navigation_id = |
| 404 navigation_request_->begin_params().renderer_navigation_id; |
| 404 NavigationRequest::AssociatedSiteInstanceType site_instance_type = | 405 NavigationRequest::AssociatedSiteInstanceType site_instance_type = |
| 405 navigation_request_->associated_site_instance_type(); | 406 navigation_request_->associated_site_instance_type(); |
| 406 navigation_request_.reset(); | 407 navigation_request_.reset(); |
| 407 | 408 |
| 408 if (keep_state) | 409 if (keep_state) |
| 409 return; | 410 return; |
| 410 | 411 |
| 411 // The RenderFrameHostManager should clean up any speculative RenderFrameHost | 412 // The RenderFrameHostManager should clean up any speculative RenderFrameHost |
| 412 // it created for the navigation. Also register that the load stopped. | 413 // it created for the navigation. Also register that the load stopped. |
| 413 DidStopLoading(); | 414 DidStopLoading(); |
| 414 render_manager_.CleanUpNavigation(); | 415 render_manager_.CleanUpNavigation(); |
| 415 | 416 |
| 416 // When reusing the same SiteInstance, a pending WebUI may have been created | 417 // When reusing the same SiteInstance, a pending WebUI may have been created |
| 417 // on behalf of the navigation in the current RenderFrameHost. Clear it. | 418 // on behalf of the navigation in the current RenderFrameHost. Clear it. |
| 418 if (site_instance_type == | 419 if (site_instance_type == |
| 419 NavigationRequest::AssociatedSiteInstanceType::CURRENT) { | 420 NavigationRequest::AssociatedSiteInstanceType::CURRENT) { |
| 420 current_frame_host()->ClearPendingWebUI(); | 421 current_frame_host()->ClearPendingWebUI(); |
| 421 } | 422 } |
| 422 | 423 |
| 423 // If the navigation is renderer-initiated, the renderer should also be | 424 // If the navigation is renderer-initiated, the renderer should also be |
| 424 // informed that the navigation stopped. | 425 // informed that the navigation stopped. |
| 425 if (was_renderer_initiated && inform_renderer) { | 426 if (renderer_navigation_id != kInvalidRenderNavigationId && inform_renderer) { |
| 426 current_frame_host()->Send( | 427 current_frame_host()->Send(new FrameMsg_DroppedNavigation( |
| 427 new FrameMsg_Stop(current_frame_host()->GetRoutingID())); | 428 current_frame_host()->GetRoutingID(), renderer_navigation_id)); |
| 428 } | 429 } |
| 429 | 430 |
| 430 } | 431 } |
| 431 | 432 |
| 432 bool FrameTreeNode::has_started_loading() const { | 433 bool FrameTreeNode::has_started_loading() const { |
| 433 return loading_progress_ != kLoadingProgressNotStarted; | 434 return loading_progress_ != kLoadingProgressNotStarted; |
| 434 } | 435 } |
| 435 | 436 |
| 436 void FrameTreeNode::reset_loading_progress() { | 437 void FrameTreeNode::reset_loading_progress() { |
| 437 loading_progress_ = kLoadingProgressNotStarted; | 438 loading_progress_ = kLoadingProgressNotStarted; |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 } | 560 } |
| 560 return parent_->child_at(i + relative_offset); | 561 return parent_->child_at(i + relative_offset); |
| 561 } | 562 } |
| 562 } | 563 } |
| 563 | 564 |
| 564 NOTREACHED() << "FrameTreeNode not found in its parent's children."; | 565 NOTREACHED() << "FrameTreeNode not found in its parent's children."; |
| 565 return nullptr; | 566 return nullptr; |
| 566 } | 567 } |
| 567 | 568 |
| 568 } // namespace content | 569 } // namespace content |
| OLD | NEW |