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

Side by Side Diff: content/renderer/render_frame_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
« no previous file with comments | « content/renderer/pepper/plugin_module.cc ('k') | content/renderer/render_process_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/renderer/render_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after
1100 before_unload_start_time, 1100 before_unload_start_time,
1101 before_unload_end_time)); 1101 before_unload_end_time));
1102 } 1102 }
1103 1103
1104 void RenderFrameImpl::OnSwapOut( 1104 void RenderFrameImpl::OnSwapOut(
1105 int proxy_routing_id, 1105 int proxy_routing_id,
1106 bool is_loading, 1106 bool is_loading,
1107 const FrameReplicationState& replicated_frame_state) { 1107 const FrameReplicationState& replicated_frame_state) {
1108 TRACE_EVENT1("navigation", "RenderFrameImpl::OnSwapOut", "id", routing_id_); 1108 TRACE_EVENT1("navigation", "RenderFrameImpl::OnSwapOut", "id", routing_id_);
1109 RenderFrameProxy* proxy = NULL; 1109 RenderFrameProxy* proxy = NULL;
1110 bool is_site_per_process = 1110 bool is_site_per_process = base::CommandLine::ForCurrentProcess()->HasSwitch(
1111 CommandLine::ForCurrentProcess()->HasSwitch(switches::kSitePerProcess); 1111 switches::kSitePerProcess);
1112 bool is_main_frame = !frame_->parent(); 1112 bool is_main_frame = !frame_->parent();
1113 1113
1114 // Only run unload if we're not swapped out yet, but send the ack either way. 1114 // Only run unload if we're not swapped out yet, but send the ack either way.
1115 if (!is_swapped_out_) { 1115 if (!is_swapped_out_) {
1116 // Swap this RenderFrame out so the frame can navigate to a page rendered by 1116 // Swap this RenderFrame out so the frame can navigate to a page rendered by
1117 // a different process. This involves running the unload handler and 1117 // a different process. This involves running the unload handler and
1118 // clearing the page. We also allow this process to exit if there are no 1118 // clearing the page. We also allow this process to exit if there are no
1119 // other active RenderFrames in it. 1119 // other active RenderFrames in it.
1120 1120
1121 // Send an UpdateState message before we get swapped out. 1121 // Send an UpdateState message before we get swapped out.
(...skipping 2606 matching lines...) Expand 10 before | Expand all | Expand 10 after
3728 3728
3729 void RenderFrameImpl::FocusedNodeChanged(const WebNode& node) { 3729 void RenderFrameImpl::FocusedNodeChanged(const WebNode& node) {
3730 if (renderer_accessibility_) 3730 if (renderer_accessibility_)
3731 renderer_accessibility_->FocusedNodeChanged(node); 3731 renderer_accessibility_->FocusedNodeChanged(node);
3732 } 3732 }
3733 3733
3734 // PlzNavigate 3734 // PlzNavigate
3735 void RenderFrameImpl::OnRequestNavigation( 3735 void RenderFrameImpl::OnRequestNavigation(
3736 const CommonNavigationParams& common_params, 3736 const CommonNavigationParams& common_params,
3737 const RequestNavigationParams& request_params) { 3737 const RequestNavigationParams& request_params) {
3738 CHECK(CommandLine::ForCurrentProcess()->HasSwitch( 3738 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
3739 switches::kEnableBrowserSideNavigation)); 3739 switches::kEnableBrowserSideNavigation));
3740 WebURLRequest request = 3740 WebURLRequest request =
3741 CreateURLRequestForNavigation(common_params, 3741 CreateURLRequestForNavigation(common_params,
3742 request_params, 3742 request_params,
3743 scoped_ptr<StreamOverrideParameters>(), 3743 scoped_ptr<StreamOverrideParameters>(),
3744 frame_->isViewSourceModeEnabled()); 3744 frame_->isViewSourceModeEnabled());
3745 BeginNavigation(&request); 3745 BeginNavigation(&request);
3746 } 3746 }
3747 3747
3748 // PlzNavigate 3748 // PlzNavigate
3749 void RenderFrameImpl::OnCommitNavigation( 3749 void RenderFrameImpl::OnCommitNavigation(
3750 const ResourceResponseHead& response, 3750 const ResourceResponseHead& response,
3751 const GURL& stream_url, 3751 const GURL& stream_url,
3752 const CommonNavigationParams& common_params, 3752 const CommonNavigationParams& common_params,
3753 const CommitNavigationParams& commit_params) { 3753 const CommitNavigationParams& commit_params) {
3754 CHECK(CommandLine::ForCurrentProcess()->HasSwitch( 3754 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
3755 switches::kEnableBrowserSideNavigation)); 3755 switches::kEnableBrowserSideNavigation));
3756 bool is_reload = false; 3756 bool is_reload = false;
3757 bool is_history_navigation = commit_params.page_state.IsValid(); 3757 bool is_history_navigation = commit_params.page_state.IsValid();
3758 WebURLRequest::CachePolicy cache_policy = 3758 WebURLRequest::CachePolicy cache_policy =
3759 WebURLRequest::UseProtocolCachePolicy; 3759 WebURLRequest::UseProtocolCachePolicy;
3760 if (!RenderFrameImpl::PrepareRenderViewForNavigation( 3760 if (!RenderFrameImpl::PrepareRenderViewForNavigation(
3761 common_params.url, common_params.navigation_type, 3761 common_params.url, common_params.navigation_type,
3762 commit_params.page_state, false /* check_for_stale_navigation */, 3762 commit_params.page_state, false /* check_for_stale_navigation */,
3763 is_history_navigation, -1 /* current_history_list_offset; TODO(clamy)*/, 3763 is_history_navigation, -1 /* current_history_list_offset; TODO(clamy)*/,
3764 -1, &is_reload, &cache_policy)) { 3764 -1, &is_reload, &cache_policy)) {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
3810 info.urlRequest, 3810 info.urlRequest,
3811 info.navigationType, 3811 info.navigationType,
3812 info.defaultPolicy, 3812 info.defaultPolicy,
3813 info.isRedirect)) { 3813 info.isRedirect)) {
3814 return blink::WebNavigationPolicyIgnore; 3814 return blink::WebNavigationPolicyIgnore;
3815 } 3815 }
3816 #endif 3816 #endif
3817 3817
3818 Referrer referrer(RenderViewImpl::GetReferrerFromRequest(info.frame, 3818 Referrer referrer(RenderViewImpl::GetReferrerFromRequest(info.frame,
3819 info.urlRequest)); 3819 info.urlRequest));
3820 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 3820 const base::CommandLine& command_line =
3821 *base::CommandLine::ForCurrentProcess();
3821 3822
3822 bool is_subframe = !!info.frame->parent(); 3823 bool is_subframe = !!info.frame->parent();
3823 3824
3824 if (command_line.HasSwitch(switches::kSitePerProcess) && is_subframe) { 3825 if (command_line.HasSwitch(switches::kSitePerProcess) && is_subframe) {
3825 // There's no reason to ignore navigations on subframes, since the swap out 3826 // There's no reason to ignore navigations on subframes, since the swap out
3826 // logic no longer applies. 3827 // logic no longer applies.
3827 } else { 3828 } else {
3828 if (is_swapped_out_) { 3829 if (is_swapped_out_) {
3829 if (info.urlRequest.url() != GURL(kSwappedOutURL)) { 3830 if (info.urlRequest.url() != GURL(kSwappedOutURL)) {
3830 // Targeted links may try to navigate a swapped out frame. Allow the 3831 // Targeted links may try to navigate a swapped out frame. Allow the
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
4008 // Must be a JavaScript navigation, which appears as "other". 4009 // Must be a JavaScript navigation, which appears as "other".
4009 info.navigationType == blink::WebNavigationTypeOther; 4010 info.navigationType == blink::WebNavigationTypeOther;
4010 4011
4011 if (is_fork) { 4012 if (is_fork) {
4012 // Open the URL via the browser, not via WebKit. 4013 // Open the URL via the browser, not via WebKit.
4013 OpenURL(info.frame, url, Referrer(), info.defaultPolicy); 4014 OpenURL(info.frame, url, Referrer(), info.defaultPolicy);
4014 return blink::WebNavigationPolicyIgnore; 4015 return blink::WebNavigationPolicyIgnore;
4015 } 4016 }
4016 4017
4017 // PlzNavigate: send the request to the browser if needed. 4018 // PlzNavigate: send the request to the browser if needed.
4018 if (CommandLine::ForCurrentProcess()->HasSwitch( 4019 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
4019 switches::kEnableBrowserSideNavigation) && 4020 switches::kEnableBrowserSideNavigation) &&
4020 info.urlRequest.checkForBrowserSideNavigation()) { 4021 info.urlRequest.checkForBrowserSideNavigation()) {
4021 BeginNavigation(&info.urlRequest); 4022 BeginNavigation(&info.urlRequest);
4022 return blink::WebNavigationPolicyIgnore; 4023 return blink::WebNavigationPolicyIgnore;
4023 } 4024 }
4024 4025
4025 return info.defaultPolicy; 4026 return info.defaultPolicy;
4026 } 4027 }
4027 4028
4028 void RenderFrameImpl::OpenURL(WebFrame* frame, 4029 void RenderFrameImpl::OpenURL(WebFrame* frame,
4029 const GURL& url, 4030 const GURL& url,
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
4130 SetSelectedText(text, offset, range); 4131 SetSelectedText(text, offset, range);
4131 } 4132 }
4132 GetRenderWidget()->UpdateSelectionBounds(); 4133 GetRenderWidget()->UpdateSelectionBounds();
4133 } 4134 }
4134 4135
4135 void RenderFrameImpl::InitializeUserMediaClient() { 4136 void RenderFrameImpl::InitializeUserMediaClient() {
4136 if (!RenderThreadImpl::current()) // Will be NULL during unit tests. 4137 if (!RenderThreadImpl::current()) // Will be NULL during unit tests.
4137 return; 4138 return;
4138 4139
4139 #if defined(OS_ANDROID) 4140 #if defined(OS_ANDROID)
4140 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableWebRTC)) 4141 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
4142 switches::kDisableWebRTC))
4141 return; 4143 return;
4142 #endif 4144 #endif
4143 4145
4144 #if defined(ENABLE_WEBRTC) 4146 #if defined(ENABLE_WEBRTC)
4145 DCHECK(!web_user_media_client_); 4147 DCHECK(!web_user_media_client_);
4146 web_user_media_client_ = new UserMediaClientImpl( 4148 web_user_media_client_ = new UserMediaClientImpl(
4147 this, 4149 this,
4148 RenderThreadImpl::current()->GetPeerConnectionDependencyFactory(), 4150 RenderThreadImpl::current()->GetPeerConnectionDependencyFactory(),
4149 make_scoped_ptr(new MediaStreamDispatcher(this)).Pass()); 4151 make_scoped_ptr(new MediaStreamDispatcher(this)).Pass());
4150 #endif 4152 #endif
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
4319 4321
4320 #if defined(ENABLE_BROWSER_CDMS) 4322 #if defined(ENABLE_BROWSER_CDMS)
4321 RendererCdmManager* RenderFrameImpl::GetCdmManager() { 4323 RendererCdmManager* RenderFrameImpl::GetCdmManager() {
4322 if (!cdm_manager_) 4324 if (!cdm_manager_)
4323 cdm_manager_ = new RendererCdmManager(this); 4325 cdm_manager_ = new RendererCdmManager(this);
4324 return cdm_manager_; 4326 return cdm_manager_;
4325 } 4327 }
4326 #endif // defined(ENABLE_BROWSER_CDMS) 4328 #endif // defined(ENABLE_BROWSER_CDMS)
4327 4329
4328 } // namespace content 4330 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/pepper/plugin_module.cc ('k') | content/renderer/render_process_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698