| 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 "base/bind.h" |    5 #include "base/bind.h" | 
|    6 #include "base/strings/stringprintf.h" |    6 #include "base/strings/stringprintf.h" | 
|    7 #include "content/browser/frame_host/frame_tree.h" |    7 #include "content/browser/frame_host/frame_tree.h" | 
|    8 #include "content/browser/frame_host/navigation_controller_impl.h" |    8 #include "content/browser/frame_host/navigation_controller_impl.h" | 
|    9 #include "content/browser/frame_host/navigation_entry_impl.h" |    9 #include "content/browser/frame_host/navigation_entry_impl.h" | 
|   10 #include "content/browser/web_contents/web_contents_impl.h" |   10 #include "content/browser/web_contents/web_contents_impl.h" | 
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  282     if (rfh->frame_tree_node()->frame_tree_node_id() != frame_tree_node_id_) |  282     if (rfh->frame_tree_node()->frame_tree_node_id() != frame_tree_node_id_) | 
|  283       return; |  283       return; | 
|  284  |  284  | 
|  285     --navigations_remaining_; |  285     --navigations_remaining_; | 
|  286     params_.push_back(params); |  286     params_.push_back(params); | 
|  287     details_.push_back(details); |  287     details_.push_back(details); | 
|  288     if (!web_contents()->IsLoading() && !navigations_remaining_) |  288     if (!web_contents()->IsLoading() && !navigations_remaining_) | 
|  289       message_loop_runner_->Quit(); |  289       message_loop_runner_->Quit(); | 
|  290   } |  290   } | 
|  291  |  291  | 
|  292   void DidStopLoading(RenderViewHost* render_view_host) override { |  292   void DidStopLoading() override { | 
|  293     if (!navigations_remaining_) |  293     if (!navigations_remaining_) | 
|  294       message_loop_runner_->Quit(); |  294       message_loop_runner_->Quit(); | 
|  295   } |  295   } | 
|  296  |  296  | 
|  297   // The id of the FrameTreeNode whose navigations to observe. |  297   // The id of the FrameTreeNode whose navigations to observe. | 
|  298   int frame_tree_node_id_; |  298   int frame_tree_node_id_; | 
|  299  |  299  | 
|  300   // How many navigations remain to capture. |  300   // How many navigations remain to capture. | 
|  301   int navigations_remaining_; |  301   int navigations_remaining_; | 
|  302  |  302  | 
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  352     RenderFrameHostImpl* rfh = |  352     RenderFrameHostImpl* rfh = | 
|  353         static_cast<RenderFrameHostImpl*>(render_frame_host); |  353         static_cast<RenderFrameHostImpl*>(render_frame_host); | 
|  354     if (rfh->frame_tree_node()->frame_tree_node_id() != frame_tree_node_id_) |  354     if (rfh->frame_tree_node()->frame_tree_node_id() != frame_tree_node_id_) | 
|  355       return; |  355       return; | 
|  356  |  356  | 
|  357     transition_type_ = transition_type; |  357     transition_type_ = transition_type; | 
|  358     if (!web_contents()->IsLoading()) |  358     if (!web_contents()->IsLoading()) | 
|  359       message_loop_runner_->Quit(); |  359       message_loop_runner_->Quit(); | 
|  360   } |  360   } | 
|  361  |  361  | 
|  362   void DidStopLoading(RenderViewHost* render_view_host) override { |  362   void DidStopLoading() override { message_loop_runner_->Quit(); } | 
|  363     message_loop_runner_->Quit(); |  | 
|  364   } |  | 
|  365  |  363  | 
|  366   // The id of the FrameTreeNode whose navigations to observe. |  364   // The id of the FrameTreeNode whose navigations to observe. | 
|  367   int frame_tree_node_id_; |  365   int frame_tree_node_id_; | 
|  368  |  366  | 
|  369   // The transition_type of the last navigation. |  367   // The transition_type of the last navigation. | 
|  370   ui::PageTransition transition_type_; |  368   ui::PageTransition transition_type_; | 
|  371  |  369  | 
|  372   // The MessageLoopRunner used to spin the message loop. |  370   // The MessageLoopRunner used to spin the message loop. | 
|  373   scoped_refptr<MessageLoopRunner> message_loop_runner_; |  371   scoped_refptr<MessageLoopRunner> message_loop_runner_; | 
|  374 }; |  372 }; | 
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  849     ASSERT_EQ(2U, details.size()); |  847     ASSERT_EQ(2U, details.size()); | 
|  850     EXPECT_EQ(ui::PAGE_TRANSITION_LINK, params[0].transition); |  848     EXPECT_EQ(ui::PAGE_TRANSITION_LINK, params[0].transition); | 
|  851     EXPECT_EQ(NAVIGATION_TYPE_NEW_PAGE, details[0].type); |  849     EXPECT_EQ(NAVIGATION_TYPE_NEW_PAGE, details[0].type); | 
|  852     EXPECT_EQ(ui::PAGE_TRANSITION_LINK | ui::PAGE_TRANSITION_CLIENT_REDIRECT, |  850     EXPECT_EQ(ui::PAGE_TRANSITION_LINK | ui::PAGE_TRANSITION_CLIENT_REDIRECT, | 
|  853               params[1].transition); |  851               params[1].transition); | 
|  854     EXPECT_EQ(NAVIGATION_TYPE_EXISTING_PAGE, details[1].type); |  852     EXPECT_EQ(NAVIGATION_TYPE_EXISTING_PAGE, details[1].type); | 
|  855   } |  853   } | 
|  856 } |  854 } | 
|  857  |  855  | 
|  858 }  // namespace content |  856 }  // namespace content | 
| OLD | NEW |