Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Side by Side Diff: content/browser/frame_host/navigator_impl.cc

Issue 803813003: Make callers of CommandLine use it via the base:: namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 // This will be used to set the Navigation Timing API navigationStart 385 // This will be used to set the Navigation Timing API navigationStart
386 // parameter for browser navigations in new tabs (intents, tabs opened through 386 // parameter for browser navigations in new tabs (intents, tabs opened through
387 // "Open link in new tab"). We need to keep it above RFHM::Navigate() call to 387 // "Open link in new tab"). We need to keep it above RFHM::Navigate() call to
388 // capture the time needed for the RenderFrameHost initialization. 388 // capture the time needed for the RenderFrameHost initialization.
389 base::TimeTicks navigation_start = base::TimeTicks::Now(); 389 base::TimeTicks navigation_start = base::TimeTicks::Now();
390 390
391 RenderFrameHostManager* manager = 391 RenderFrameHostManager* manager =
392 render_frame_host->frame_tree_node()->render_manager(); 392 render_frame_host->frame_tree_node()->render_manager();
393 393
394 // PlzNavigate: the RenderFrameHosts are no longer asked to navigate. 394 // PlzNavigate: the RenderFrameHosts are no longer asked to navigate.
395 if (CommandLine::ForCurrentProcess()->HasSwitch( 395 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
396 switches::kEnableBrowserSideNavigation)) { 396 switches::kEnableBrowserSideNavigation)) {
397 navigation_data_.reset(new NavigationMetricsData( 397 navigation_data_.reset(new NavigationMetricsData(
398 navigation_start, entry.GetURL(), entry.restore_type())); 398 navigation_start, entry.GetURL(), entry.restore_type()));
399 return RequestNavigation(render_frame_host->frame_tree_node(), 399 return RequestNavigation(render_frame_host->frame_tree_node(),
400 entry, 400 entry,
401 reload_type, 401 reload_type,
402 navigation_start); 402 navigation_start);
403 } 403 }
404 404
405 RenderFrameHostImpl* dest_render_frame_host = manager->Navigate(entry); 405 RenderFrameHostImpl* dest_render_frame_host = manager->Navigate(entry);
406 if (!dest_render_frame_host) 406 if (!dest_render_frame_host)
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 *NavigationEntryImpl::FromNavigationEntry(controller_->GetPendingEntry()), 475 *NavigationEntryImpl::FromNavigationEntry(controller_->GetPendingEntry()),
476 reload_type); 476 reload_type);
477 } 477 }
478 478
479 void NavigatorImpl::DidNavigate( 479 void NavigatorImpl::DidNavigate(
480 RenderFrameHostImpl* render_frame_host, 480 RenderFrameHostImpl* render_frame_host,
481 const FrameHostMsg_DidCommitProvisionalLoad_Params& input_params) { 481 const FrameHostMsg_DidCommitProvisionalLoad_Params& input_params) {
482 // PlzNavigate 482 // PlzNavigate
483 // The navigation request has been committed so the browser process doesn't 483 // The navigation request has been committed so the browser process doesn't
484 // need to care about it anymore. 484 // need to care about it anymore.
485 if (CommandLine::ForCurrentProcess()->HasSwitch( 485 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
486 switches::kEnableBrowserSideNavigation)) { 486 switches::kEnableBrowserSideNavigation)) {
487 navigation_request_map_.erase( 487 navigation_request_map_.erase(
488 render_frame_host->frame_tree_node()->frame_tree_node_id()); 488 render_frame_host->frame_tree_node()->frame_tree_node_id());
489 } 489 }
490 490
491 FrameHostMsg_DidCommitProvisionalLoad_Params params(input_params); 491 FrameHostMsg_DidCommitProvisionalLoad_Params params(input_params);
492 FrameTree* frame_tree = render_frame_host->frame_tree_node()->frame_tree(); 492 FrameTree* frame_tree = render_frame_host->frame_tree_node()->frame_tree();
493 bool use_site_per_process = base::CommandLine::ForCurrentProcess()->HasSwitch( 493 bool use_site_per_process = base::CommandLine::ForCurrentProcess()->HasSwitch(
494 switches::kSitePerProcess); 494 switches::kSitePerProcess);
495 495
496 if (use_site_per_process) { 496 if (use_site_per_process) {
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 730
731 if (delegate_) 731 if (delegate_)
732 delegate_->RequestOpenURL(render_frame_host, params); 732 delegate_->RequestOpenURL(render_frame_host, params);
733 } 733 }
734 734
735 // PlzNavigate 735 // PlzNavigate
736 void NavigatorImpl::OnBeginNavigation( 736 void NavigatorImpl::OnBeginNavigation(
737 FrameTreeNode* frame_tree_node, 737 FrameTreeNode* frame_tree_node,
738 const FrameHostMsg_BeginNavigation_Params& params, 738 const FrameHostMsg_BeginNavigation_Params& params,
739 const CommonNavigationParams& common_params) { 739 const CommonNavigationParams& common_params) {
740 CHECK(CommandLine::ForCurrentProcess()->HasSwitch( 740 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
741 switches::kEnableBrowserSideNavigation)); 741 switches::kEnableBrowserSideNavigation));
742 DCHECK(frame_tree_node); 742 DCHECK(frame_tree_node);
743 743
744 NavigationRequest* navigation_request = 744 NavigationRequest* navigation_request =
745 navigation_request_map_.get(frame_tree_node->frame_tree_node_id()); 745 navigation_request_map_.get(frame_tree_node->frame_tree_node_id());
746 746
747 if (!navigation_request) { 747 if (!navigation_request) {
748 // This is a renderer initiated navigation, so generate a new 748 // This is a renderer initiated navigation, so generate a new
749 // NavigationRequest and store it in the map. 749 // NavigationRequest and store it in the map.
750 // TODO(clamy): Check if some PageState should be provided here. 750 // TODO(clamy): Check if some PageState should be provided here.
(...skipping 28 matching lines...) Expand all
779 // TODO(clamy): Inform the RenderFrameHostManager that a navigation is about 779 // TODO(clamy): Inform the RenderFrameHostManager that a navigation is about
780 // to begin, so that it can speculatively spawn a new renderer if needed. 780 // to begin, so that it can speculatively spawn a new renderer if needed.
781 781
782 navigation_request->BeginNavigation(info.Pass(), params.request_body); 782 navigation_request->BeginNavigation(info.Pass(), params.request_body);
783 } 783 }
784 784
785 // PlzNavigate 785 // PlzNavigate
786 void NavigatorImpl::CommitNavigation(FrameTreeNode* frame_tree_node, 786 void NavigatorImpl::CommitNavigation(FrameTreeNode* frame_tree_node,
787 ResourceResponse* response, 787 ResourceResponse* response,
788 scoped_ptr<StreamHandle> body) { 788 scoped_ptr<StreamHandle> body) {
789 CHECK(CommandLine::ForCurrentProcess()->HasSwitch( 789 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
790 switches::kEnableBrowserSideNavigation)); 790 switches::kEnableBrowserSideNavigation));
791 791
792 // HTTP 204 (No Content) and HTTP 205 (Reset Content) responses should not 792 // HTTP 204 (No Content) and HTTP 205 (Reset Content) responses should not
793 // commit; they leave the frame showing the previous page. 793 // commit; they leave the frame showing the previous page.
794 if (response->head.headers.get() && 794 if (response->head.headers.get() &&
795 (response->head.headers->response_code() == 204 || 795 (response->head.headers->response_code() == 204 ||
796 response->head.headers->response_code() == 205)) { 796 response->head.headers->response_code() == 205)) {
797 CancelNavigation(frame_tree_node); 797 CancelNavigation(frame_tree_node);
798 return; 798 return;
799 } 799 }
(...skipping 10 matching lines...) Expand all
810 CheckWebUIRendererDoesNotDisplayNormalURL( 810 CheckWebUIRendererDoesNotDisplayNormalURL(
811 render_frame_host, navigation_request->common_params().url); 811 render_frame_host, navigation_request->common_params().url);
812 812
813 render_frame_host->CommitNavigation(response, body.Pass(), 813 render_frame_host->CommitNavigation(response, body.Pass(),
814 navigation_request->common_params(), 814 navigation_request->common_params(),
815 navigation_request->commit_params()); 815 navigation_request->commit_params());
816 } 816 }
817 817
818 // PlzNavigate 818 // PlzNavigate
819 void NavigatorImpl::CancelNavigation(FrameTreeNode* frame_tree_node) { 819 void NavigatorImpl::CancelNavigation(FrameTreeNode* frame_tree_node) {
820 CHECK(CommandLine::ForCurrentProcess()->HasSwitch( 820 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
821 switches::kEnableBrowserSideNavigation)); 821 switches::kEnableBrowserSideNavigation));
822 navigation_request_map_.erase(frame_tree_node->frame_tree_node_id()); 822 navigation_request_map_.erase(frame_tree_node->frame_tree_node_id());
823 } 823 }
824 824
825 // PlzNavigate 825 // PlzNavigate
826 NavigationRequest* NavigatorImpl::GetNavigationRequestForNodeForTesting( 826 NavigationRequest* NavigatorImpl::GetNavigationRequestForNodeForTesting(
827 FrameTreeNode* frame_tree_node) { 827 FrameTreeNode* frame_tree_node) {
828 return navigation_request_map_.get(frame_tree_node->frame_tree_node_id()); 828 return navigation_request_map_.get(frame_tree_node->frame_tree_node_id());
829 } 829 }
830 830
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 CHECK(0); 865 CHECK(0);
866 } 866 }
867 } 867 }
868 868
869 // PlzNavigate 869 // PlzNavigate
870 bool NavigatorImpl::RequestNavigation( 870 bool NavigatorImpl::RequestNavigation(
871 FrameTreeNode* frame_tree_node, 871 FrameTreeNode* frame_tree_node,
872 const NavigationEntryImpl& entry, 872 const NavigationEntryImpl& entry,
873 NavigationController::ReloadType reload_type, 873 NavigationController::ReloadType reload_type,
874 base::TimeTicks navigation_start) { 874 base::TimeTicks navigation_start) {
875 CHECK(CommandLine::ForCurrentProcess()->HasSwitch( 875 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
876 switches::kEnableBrowserSideNavigation)); 876 switches::kEnableBrowserSideNavigation));
877 DCHECK(frame_tree_node); 877 DCHECK(frame_tree_node);
878 int64 frame_tree_node_id = frame_tree_node->frame_tree_node_id(); 878 int64 frame_tree_node_id = frame_tree_node->frame_tree_node_id();
879 FrameMsg_Navigate_Type::Value navigation_type = 879 FrameMsg_Navigate_Type::Value navigation_type =
880 GetNavigationType(controller_->GetBrowserContext(), entry, reload_type); 880 GetNavigationType(controller_->GetBrowserContext(), entry, reload_type);
881 scoped_ptr<NavigationRequest> navigation_request(new NavigationRequest( 881 scoped_ptr<NavigationRequest> navigation_request(new NavigationRequest(
882 frame_tree_node, 882 frame_tree_node,
883 CommonNavigationParams(entry.GetURL(), 883 CommonNavigationParams(entry.GetURL(),
884 entry.GetReferrer(), 884 entry.GetReferrer(),
885 entry.GetTransitionType(), 885 entry.GetTransitionType(),
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
962 "Navigation.TimeToCommit_ExistingRenderer_BeforeUnloadDiscounted", 962 "Navigation.TimeToCommit_ExistingRenderer_BeforeUnloadDiscounted",
963 time_to_commit); 963 time_to_commit);
964 UMA_HISTOGRAM_TIMES( 964 UMA_HISTOGRAM_TIMES(
965 "Navigation.TimeToURLJobStart_ExistingRenderer_BeforeUnloadDiscounted", 965 "Navigation.TimeToURLJobStart_ExistingRenderer_BeforeUnloadDiscounted",
966 time_to_network); 966 time_to_network);
967 } 967 }
968 navigation_data_.reset(); 968 navigation_data_.reset();
969 } 969 }
970 970
971 } // namespace content 971 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigation_controller_impl.cc ('k') | content/browser/frame_host/render_frame_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698