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