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/navigator_impl.h" | 5 #include "content/browser/frame_host/navigator_impl.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "content/browser/frame_host/frame_tree.h" | 10 #include "content/browser/frame_host/frame_tree.h" |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 navigation_data_.reset(new NavigationMetricsData( | 310 navigation_data_.reset(new NavigationMetricsData( |
311 navigation_start, entry.GetURL(), entry.restore_type())); | 311 navigation_start, entry.GetURL(), entry.restore_type())); |
312 // Create the navigation parameters. | 312 // Create the navigation parameters. |
313 // TODO(vitalybuka): Move this before AboutToNavigateRenderFrame once | 313 // TODO(vitalybuka): Move this before AboutToNavigateRenderFrame once |
314 // http://crbug.com/408684 is fixed. | 314 // http://crbug.com/408684 is fixed. |
315 FrameMsg_Navigate_Type::Value navigation_type = | 315 FrameMsg_Navigate_Type::Value navigation_type = |
316 GetNavigationType(controller_->GetBrowserContext(), entry, reload_type); | 316 GetNavigationType(controller_->GetBrowserContext(), entry, reload_type); |
317 dest_render_frame_host->Navigate( | 317 dest_render_frame_host->Navigate( |
318 entry.ConstructCommonNavigationParams(navigation_type), | 318 entry.ConstructCommonNavigationParams(navigation_type), |
319 entry.ConstructStartNavigationParams(), | 319 entry.ConstructStartNavigationParams(), |
320 entry.ConstructCommitNavigationParams(navigation_start), | 320 entry.ConstructRequestNavigationParams( |
321 entry.ConstructHistoryNavigationParams(controller_)); | 321 navigation_start, controller_->GetIndexOfEntry(&entry), |
| 322 controller_->GetLastCommittedEntryIndex(), |
| 323 controller_->GetEntryCount())); |
322 } else { | 324 } else { |
323 // No need to navigate again. Just resume the deferred request. | 325 // No need to navigate again. Just resume the deferred request. |
324 dest_render_frame_host->GetProcess()->ResumeDeferredNavigation( | 326 dest_render_frame_host->GetProcess()->ResumeDeferredNavigation( |
325 entry.transferred_global_request_id()); | 327 entry.transferred_global_request_id()); |
326 } | 328 } |
327 | 329 |
328 // Make sure no code called via RFH::Navigate clears the pending entry. | 330 // Make sure no code called via RFH::Navigate clears the pending entry. |
329 CHECK_EQ(controller_->GetPendingEntry(), &entry); | 331 CHECK_EQ(controller_->GetPendingEntry(), &entry); |
330 | 332 |
331 if (entry.GetPageID() == -1) { | 333 if (entry.GetPageID() == -1) { |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 | 695 |
694 // Select an appropriate renderer to commit the navigation. | 696 // Select an appropriate renderer to commit the navigation. |
695 RenderFrameHostImpl* render_frame_host = | 697 RenderFrameHostImpl* render_frame_host = |
696 frame_tree_node->render_manager()->GetFrameHostForNavigation( | 698 frame_tree_node->render_manager()->GetFrameHostForNavigation( |
697 *navigation_request); | 699 *navigation_request); |
698 CheckWebUIRendererDoesNotDisplayNormalURL( | 700 CheckWebUIRendererDoesNotDisplayNormalURL( |
699 render_frame_host, navigation_request->common_params().url); | 701 render_frame_host, navigation_request->common_params().url); |
700 | 702 |
701 render_frame_host->CommitNavigation(response, body.Pass(), | 703 render_frame_host->CommitNavigation(response, body.Pass(), |
702 navigation_request->common_params(), | 704 navigation_request->common_params(), |
703 navigation_request->commit_params(), | 705 navigation_request->request_params()); |
704 navigation_request->history_params()); | |
705 } | 706 } |
706 | 707 |
707 // PlzNavigate | 708 // PlzNavigate |
708 void NavigatorImpl::CancelNavigation(FrameTreeNode* frame_tree_node) { | 709 void NavigatorImpl::CancelNavigation(FrameTreeNode* frame_tree_node) { |
709 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( | 710 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( |
710 switches::kEnableBrowserSideNavigation)); | 711 switches::kEnableBrowserSideNavigation)); |
711 navigation_request_map_.erase(frame_tree_node->frame_tree_node_id()); | 712 navigation_request_map_.erase(frame_tree_node->frame_tree_node_id()); |
712 if (frame_tree_node->IsMainFrame()) | 713 if (frame_tree_node->IsMainFrame()) |
713 navigation_data_.reset(); | 714 navigation_data_.reset(); |
714 // TODO(carlosk): move this cleanup into the NavigationRequest destructor once | 715 // TODO(carlosk): move this cleanup into the NavigationRequest destructor once |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
873 "Navigation.TimeToCommit_ExistingRenderer_BeforeUnloadDiscounted", | 874 "Navigation.TimeToCommit_ExistingRenderer_BeforeUnloadDiscounted", |
874 time_to_commit); | 875 time_to_commit); |
875 UMA_HISTOGRAM_TIMES( | 876 UMA_HISTOGRAM_TIMES( |
876 "Navigation.TimeToURLJobStart_ExistingRenderer_BeforeUnloadDiscounted", | 877 "Navigation.TimeToURLJobStart_ExistingRenderer_BeforeUnloadDiscounted", |
877 time_to_network); | 878 time_to_network); |
878 } | 879 } |
879 navigation_data_.reset(); | 880 navigation_data_.reset(); |
880 } | 881 } |
881 | 882 |
882 } // namespace content | 883 } // namespace content |
OLD | NEW |