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.ConstructCommitNavigationParams( |
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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 | 693 |
692 // Select an appropriate renderer to commit the navigation. | 694 // Select an appropriate renderer to commit the navigation. |
693 RenderFrameHostImpl* render_frame_host = | 695 RenderFrameHostImpl* render_frame_host = |
694 frame_tree_node->render_manager()->GetFrameHostForNavigation( | 696 frame_tree_node->render_manager()->GetFrameHostForNavigation( |
695 *navigation_request); | 697 *navigation_request); |
696 CheckWebUIRendererDoesNotDisplayNormalURL( | 698 CheckWebUIRendererDoesNotDisplayNormalURL( |
697 render_frame_host, navigation_request->common_params().url); | 699 render_frame_host, navigation_request->common_params().url); |
698 | 700 |
699 render_frame_host->CommitNavigation(response, body.Pass(), | 701 render_frame_host->CommitNavigation(response, body.Pass(), |
700 navigation_request->common_params(), | 702 navigation_request->common_params(), |
701 navigation_request->commit_params(), | 703 navigation_request->commit_params()); |
702 navigation_request->history_params()); | |
703 } | 704 } |
704 | 705 |
705 // PlzNavigate | 706 // PlzNavigate |
706 void NavigatorImpl::CancelNavigation(FrameTreeNode* frame_tree_node) { | 707 void NavigatorImpl::CancelNavigation(FrameTreeNode* frame_tree_node) { |
707 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( | 708 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( |
708 switches::kEnableBrowserSideNavigation)); | 709 switches::kEnableBrowserSideNavigation)); |
709 navigation_request_map_.erase(frame_tree_node->frame_tree_node_id()); | 710 navigation_request_map_.erase(frame_tree_node->frame_tree_node_id()); |
710 if (frame_tree_node->IsMainFrame()) | 711 if (frame_tree_node->IsMainFrame()) |
711 navigation_data_.reset(); | 712 navigation_data_.reset(); |
712 // TODO(carlosk): move this cleanup into the NavigationRequest destructor once | 713 // TODO(carlosk): move this cleanup into the NavigationRequest destructor once |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
866 "Navigation.TimeToCommit_ExistingRenderer_BeforeUnloadDiscounted", | 867 "Navigation.TimeToCommit_ExistingRenderer_BeforeUnloadDiscounted", |
867 time_to_commit); | 868 time_to_commit); |
868 UMA_HISTOGRAM_TIMES( | 869 UMA_HISTOGRAM_TIMES( |
869 "Navigation.TimeToURLJobStart_ExistingRenderer_BeforeUnloadDiscounted", | 870 "Navigation.TimeToURLJobStart_ExistingRenderer_BeforeUnloadDiscounted", |
870 time_to_network); | 871 time_to_network); |
871 } | 872 } |
872 navigation_data_.reset(); | 873 navigation_data_.reset(); |
873 } | 874 } |
874 | 875 |
875 } // namespace content | 876 } // namespace content |
OLD | NEW |