| 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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 if (rfh->frame_tree_node()->frame_tree_node_id() != frame_tree_node_id_) | 215 if (rfh->frame_tree_node()->frame_tree_node_id() != frame_tree_node_id_) |
| 216 return; | 216 return; |
| 217 | 217 |
| 218 --navigations_remaining_; | 218 --navigations_remaining_; |
| 219 params_.push_back(params); | 219 params_.push_back(params); |
| 220 details_.push_back(details); | 220 details_.push_back(details); |
| 221 if (!web_contents()->IsLoading() && !navigations_remaining_) | 221 if (!web_contents()->IsLoading() && !navigations_remaining_) |
| 222 message_loop_runner_->Quit(); | 222 message_loop_runner_->Quit(); |
| 223 } | 223 } |
| 224 | 224 |
| 225 void DidStopLoading(RenderViewHost* render_view_host) override { | 225 void DidStopLoading() override { |
| 226 if (!navigations_remaining_) | 226 if (!navigations_remaining_) |
| 227 message_loop_runner_->Quit(); | 227 message_loop_runner_->Quit(); |
| 228 } | 228 } |
| 229 | 229 |
| 230 // The id of the FrameTreeNode whose navigations to observe. | 230 // The id of the FrameTreeNode whose navigations to observe. |
| 231 int frame_tree_node_id_; | 231 int frame_tree_node_id_; |
| 232 | 232 |
| 233 // How many navigations remain to capture. | 233 // How many navigations remain to capture. |
| 234 int navigations_remaining_; | 234 int navigations_remaining_; |
| 235 | 235 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 RenderFrameHostImpl* rfh = | 285 RenderFrameHostImpl* rfh = |
| 286 static_cast<RenderFrameHostImpl*>(render_frame_host); | 286 static_cast<RenderFrameHostImpl*>(render_frame_host); |
| 287 if (rfh->frame_tree_node()->frame_tree_node_id() != frame_tree_node_id_) | 287 if (rfh->frame_tree_node()->frame_tree_node_id() != frame_tree_node_id_) |
| 288 return; | 288 return; |
| 289 | 289 |
| 290 transition_type_ = transition_type; | 290 transition_type_ = transition_type; |
| 291 if (!web_contents()->IsLoading()) | 291 if (!web_contents()->IsLoading()) |
| 292 message_loop_runner_->Quit(); | 292 message_loop_runner_->Quit(); |
| 293 } | 293 } |
| 294 | 294 |
| 295 void DidStopLoading(RenderViewHost* render_view_host) override { | 295 void DidStopLoading() override { message_loop_runner_->Quit(); } |
| 296 message_loop_runner_->Quit(); | |
| 297 } | |
| 298 | 296 |
| 299 // The id of the FrameTreeNode whose navigations to observe. | 297 // The id of the FrameTreeNode whose navigations to observe. |
| 300 int frame_tree_node_id_; | 298 int frame_tree_node_id_; |
| 301 | 299 |
| 302 // The transition_type of the last navigation. | 300 // The transition_type of the last navigation. |
| 303 ui::PageTransition transition_type_; | 301 ui::PageTransition transition_type_; |
| 304 | 302 |
| 305 // The MessageLoopRunner used to spin the message loop. | 303 // The MessageLoopRunner used to spin the message loop. |
| 306 scoped_refptr<MessageLoopRunner> message_loop_runner_; | 304 scoped_refptr<MessageLoopRunner> message_loop_runner_; |
| 307 }; | 305 }; |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 730 ASSERT_EQ(2U, details.size()); | 728 ASSERT_EQ(2U, details.size()); |
| 731 EXPECT_EQ(ui::PAGE_TRANSITION_LINK, params[0].transition); | 729 EXPECT_EQ(ui::PAGE_TRANSITION_LINK, params[0].transition); |
| 732 EXPECT_EQ(NAVIGATION_TYPE_NEW_PAGE, details[0].type); | 730 EXPECT_EQ(NAVIGATION_TYPE_NEW_PAGE, details[0].type); |
| 733 EXPECT_EQ(ui::PAGE_TRANSITION_LINK | ui::PAGE_TRANSITION_CLIENT_REDIRECT, | 731 EXPECT_EQ(ui::PAGE_TRANSITION_LINK | ui::PAGE_TRANSITION_CLIENT_REDIRECT, |
| 734 params[1].transition); | 732 params[1].transition); |
| 735 EXPECT_EQ(NAVIGATION_TYPE_EXISTING_PAGE, details[1].type); | 733 EXPECT_EQ(NAVIGATION_TYPE_EXISTING_PAGE, details[1].type); |
| 736 } | 734 } |
| 737 } | 735 } |
| 738 | 736 |
| 739 } // namespace content | 737 } // namespace content |
| OLD | NEW |