| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/navigation_controller_impl.h" | 5 #include "content/browser/frame_host/navigation_controller_impl.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 | 707 |
| 708 // If this object was not created with a specified frame tree node, then use | 708 // If this object was not created with a specified frame tree node, then use |
| 709 // the first created active RenderFrameHost. Once a node is selected, there | 709 // the first created active RenderFrameHost. Once a node is selected, there |
| 710 // shouldn't be any other frames being created. | 710 // shouldn't be any other frames being created. |
| 711 int frame_tree_node_id = rfh->frame_tree_node()->frame_tree_node_id(); | 711 int frame_tree_node_id = rfh->frame_tree_node()->frame_tree_node_id(); |
| 712 DCHECK(frame_tree_node_id_ == 0 || | 712 DCHECK(frame_tree_node_id_ == 0 || |
| 713 frame_tree_node_id_ == frame_tree_node_id); | 713 frame_tree_node_id_ == frame_tree_node_id); |
| 714 frame_tree_node_id_ = frame_tree_node_id; | 714 frame_tree_node_id_ = frame_tree_node_id; |
| 715 } | 715 } |
| 716 | 716 |
| 717 void DidCommitProvisionalLoadForFrame( | 717 void DidFinishNavigation(NavigationHandle* navigation_handle) override { |
| 718 RenderFrameHost* render_frame_host, | 718 if (!navigation_handle->HasCommitted()) |
| 719 const GURL& url, | |
| 720 ui::PageTransition transition_type) override { | |
| 721 DCHECK_NE(0, frame_tree_node_id_); | |
| 722 RenderFrameHostImpl* rfh = | |
| 723 static_cast<RenderFrameHostImpl*>(render_frame_host); | |
| 724 if (rfh->frame_tree_node()->frame_tree_node_id() != frame_tree_node_id_) | |
| 725 return; | 719 return; |
| 726 | 720 |
| 727 transition_type_ = transition_type; | 721 DCHECK_NE(0, frame_tree_node_id_); |
| 722 if (navigation_handle->GetRenderFrameHost()->GetFrameTreeNodeId() != |
| 723 frame_tree_node_id_) { |
| 724 return; |
| 725 } |
| 726 |
| 727 transition_type_ = navigation_handle->GetPageTransition(); |
| 728 if (!web_contents()->IsLoading()) | 728 if (!web_contents()->IsLoading()) |
| 729 message_loop_runner_->Quit(); | 729 message_loop_runner_->Quit(); |
| 730 } | 730 } |
| 731 | 731 |
| 732 void DidStopLoading() override { message_loop_runner_->Quit(); } | 732 void DidStopLoading() override { message_loop_runner_->Quit(); } |
| 733 | 733 |
| 734 // The id of the FrameTreeNode whose navigations to observe. | 734 // The id of the FrameTreeNode whose navigations to observe. |
| 735 int frame_tree_node_id_; | 735 int frame_tree_node_id_; |
| 736 | 736 |
| 737 // The transition_type of the last navigation. | 737 // The transition_type of the last navigation. |
| (...skipping 5973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6711 NavigationHandleCommitObserver handle_observer(shell()->web_contents(), | 6711 NavigationHandleCommitObserver handle_observer(shell()->web_contents(), |
| 6712 kFragmentURL); | 6712 kFragmentURL); |
| 6713 EXPECT_TRUE(NavigateToURL(shell(), kFragmentURL)); | 6713 EXPECT_TRUE(NavigateToURL(shell(), kFragmentURL)); |
| 6714 | 6714 |
| 6715 EXPECT_TRUE(handle_observer.has_committed()); | 6715 EXPECT_TRUE(handle_observer.has_committed()); |
| 6716 EXPECT_TRUE(handle_observer.was_same_page()); | 6716 EXPECT_TRUE(handle_observer.was_same_page()); |
| 6717 EXPECT_FALSE(handle_observer.was_renderer_initiated()); | 6717 EXPECT_FALSE(handle_observer.was_renderer_initiated()); |
| 6718 } | 6718 } |
| 6719 | 6719 |
| 6720 } // namespace content | 6720 } // namespace content |
| OLD | NEW |