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

Side by Side Diff: content/renderer/render_view_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/render_view_browsertest.cc ('k') | content/renderer/render_widget.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_view_impl.h" 5 #include "content/renderer/render_view_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 // On Android, we never have subpixel antialiasing. 382 // On Android, we never have subpixel antialiasing.
383 return true; 383 return true;
384 #else 384 #else
385 return device_scale_factor > 1.5f; 385 return device_scale_factor > 1.5f;
386 #endif 386 #endif
387 387
388 } 388 }
389 389
390 static bool PreferCompositingToLCDText(CompositorDependencies* compositor_deps, 390 static bool PreferCompositingToLCDText(CompositorDependencies* compositor_deps,
391 float device_scale_factor) { 391 float device_scale_factor) {
392 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 392 const base::CommandLine& command_line =
393 *base::CommandLine::ForCurrentProcess();
393 if (command_line.HasSwitch(switches::kDisablePreferCompositingToLCDText)) 394 if (command_line.HasSwitch(switches::kDisablePreferCompositingToLCDText))
394 return false; 395 return false;
395 if (command_line.HasSwitch(switches::kEnablePreferCompositingToLCDText)) 396 if (command_line.HasSwitch(switches::kEnablePreferCompositingToLCDText))
396 return true; 397 return true;
397 if (!compositor_deps->IsLcdTextEnabled()) 398 if (!compositor_deps->IsLcdTextEnabled())
398 return true; 399 return true;
399 return DeviceScaleEnsuresTextQuality(device_scale_factor); 400 return DeviceScaleEnsuresTextQuality(device_scale_factor);
400 } 401 }
401 402
402 static FaviconURL::IconType ToFaviconType(blink::WebIconURL::Type type) { 403 static FaviconURL::IconType ToFaviconType(blink::WebIconURL::Type type) {
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 this, params.main_frame_routing_id)); 687 this, params.main_frame_routing_id));
687 // The main frame WebLocalFrame object is closed by 688 // The main frame WebLocalFrame object is closed by
688 // RenderFrameImpl::frameDetached(). 689 // RenderFrameImpl::frameDetached().
689 WebLocalFrame* web_frame = WebLocalFrame::create(main_render_frame_.get()); 690 WebLocalFrame* web_frame = WebLocalFrame::create(main_render_frame_.get());
690 main_render_frame_->SetWebFrame(web_frame); 691 main_render_frame_->SetWebFrame(web_frame);
691 692
692 compositor_deps_ = compositor_deps; 693 compositor_deps_ = compositor_deps;
693 webwidget_ = WebView::create(this); 694 webwidget_ = WebView::create(this);
694 webwidget_mouse_lock_target_.reset(new WebWidgetLockTarget(webwidget_)); 695 webwidget_mouse_lock_target_.reset(new WebWidgetLockTarget(webwidget_));
695 696
696 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 697 const base::CommandLine& command_line =
698 *base::CommandLine::ForCurrentProcess();
697 699
698 if (command_line.HasSwitch(switches::kStatsCollectionController)) 700 if (command_line.HasSwitch(switches::kStatsCollectionController))
699 stats_collection_observer_.reset(new StatsCollectionObserver(this)); 701 stats_collection_observer_.reset(new StatsCollectionObserver(this));
700 702
701 #if defined(OS_ANDROID) 703 #if defined(OS_ANDROID)
702 const std::string region_code = 704 const std::string region_code =
703 command_line.HasSwitch(switches::kNetworkCountryIso) 705 command_line.HasSwitch(switches::kNetworkCountryIso)
704 ? command_line.GetSwitchValueASCII(switches::kNetworkCountryIso) 706 ? command_line.GetSwitchValueASCII(switches::kNetworkCountryIso)
705 : net::android::GetTelephonyNetworkCountryIso(); 707 : net::android::GetTelephonyNetworkCountryIso();
706 content_detectors_.push_back(linked_ptr<ContentDetector>( 708 content_detectors_.push_back(linked_ptr<ContentDetector>(
(...skipping 1364 matching lines...) Expand 10 before | Expand all | Expand 10 after
2071 RenderWidgetCompositor* rwc = compositor(); 2073 RenderWidgetCompositor* rwc = compositor();
2072 if (!rwc) 2074 if (!rwc)
2073 return; 2075 return;
2074 if (webview() && webview()->devToolsAgent()) 2076 if (webview() && webview()->devToolsAgent())
2075 webview()->devToolsAgent()->setLayerTreeId(rwc->GetLayerTreeId()); 2077 webview()->devToolsAgent()->setLayerTreeId(rwc->GetLayerTreeId());
2076 2078
2077 bool use_threaded_event_handling = true; 2079 bool use_threaded_event_handling = true;
2078 #if defined(OS_MACOSX) && !defined(OS_IOS) 2080 #if defined(OS_MACOSX) && !defined(OS_IOS)
2079 // Development flag because many events are still unhandled on Mac. 2081 // Development flag because many events are still unhandled on Mac.
2080 // http://crbug.com/138003 2082 // http://crbug.com/138003
2081 use_threaded_event_handling = CommandLine::ForCurrentProcess()->HasSwitch( 2083 use_threaded_event_handling =
2082 switches::kEnableThreadedEventHandlingMac); 2084 base::CommandLine::ForCurrentProcess()->HasSwitch(
2085 switches::kEnableThreadedEventHandlingMac);
2083 #endif 2086 #endif
2084 if (use_threaded_event_handling) { 2087 if (use_threaded_event_handling) {
2085 RenderThreadImpl* render_thread = RenderThreadImpl::current(); 2088 RenderThreadImpl* render_thread = RenderThreadImpl::current();
2086 // render_thread may be NULL in tests. 2089 // render_thread may be NULL in tests.
2087 InputHandlerManager* input_handler_manager = 2090 InputHandlerManager* input_handler_manager =
2088 render_thread ? render_thread->input_handler_manager() : NULL; 2091 render_thread ? render_thread->input_handler_manager() : NULL;
2089 if (input_handler_manager) { 2092 if (input_handler_manager) {
2090 input_handler_manager->AddInputHandler( 2093 input_handler_manager->AddInputHandler(
2091 routing_id_, rwc->GetInputHandler(), AsWeakPtr()); 2094 routing_id_, rwc->GetInputHandler(), AsWeakPtr());
2092 } 2095 }
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
2287 navigation_state->set_transferred_request_request_id( 2290 navigation_state->set_transferred_request_request_id(
2288 params.transferred_request_request_id); 2291 params.transferred_request_request_id);
2289 navigation_state->set_allow_download(params.common_params.allow_download); 2292 navigation_state->set_allow_download(params.common_params.allow_download);
2290 navigation_state->set_extra_headers(params.request_params.extra_headers); 2293 navigation_state->set_extra_headers(params.request_params.extra_headers);
2291 } else { 2294 } else {
2292 navigation_state = NavigationState::CreateContentInitiated(); 2295 navigation_state = NavigationState::CreateContentInitiated();
2293 } 2296 }
2294 return navigation_state; 2297 return navigation_state;
2295 } 2298 }
2296 2299
2297 void RenderViewImpl::ProcessViewLayoutFlags(const CommandLine& command_line) { 2300 void RenderViewImpl::ProcessViewLayoutFlags(
2301 const base::CommandLine& command_line) {
2298 bool enable_viewport = 2302 bool enable_viewport =
2299 command_line.HasSwitch(switches::kEnableViewport) || 2303 command_line.HasSwitch(switches::kEnableViewport) ||
2300 command_line.HasSwitch(switches::kEnableViewportMeta); 2304 command_line.HasSwitch(switches::kEnableViewportMeta);
2301 2305
2302 // If viewport tag is enabled, then the WebKit side will take care 2306 // If viewport tag is enabled, then the WebKit side will take care
2303 // of setting the fixed layout size and page scale limits. 2307 // of setting the fixed layout size and page scale limits.
2304 if (enable_viewport) 2308 if (enable_viewport)
2305 return; 2309 return;
2306 2310
2307 // When navigating to a new page, reset the page scale factor to be 1.0. 2311 // When navigating to a new page, reset the page scale factor to be 1.0.
2308 webview()->setInitialPageScaleOverride(1.f); 2312 webview()->setInitialPageScaleOverride(1.f);
2309 2313
2310 float maxPageScaleFactor = 2314 float maxPageScaleFactor =
2311 command_line.HasSwitch(switches::kEnablePinch) ? 4.f : 1.f ; 2315 command_line.HasSwitch(switches::kEnablePinch) ? 4.f : 1.f ;
2312 webview()->setPageScaleFactorLimits(1, maxPageScaleFactor); 2316 webview()->setPageScaleFactorLimits(1, maxPageScaleFactor);
2313 } 2317 }
2314 2318
2315 void RenderViewImpl::didClearWindowObject(WebLocalFrame* frame) { 2319 void RenderViewImpl::didClearWindowObject(WebLocalFrame* frame) {
2316 FOR_EACH_OBSERVER( 2320 FOR_EACH_OBSERVER(
2317 RenderViewObserver, observers_, DidClearWindowObject(frame)); 2321 RenderViewObserver, observers_, DidClearWindowObject(frame));
2318 2322
2319 if (enabled_bindings_& BINDINGS_POLICY_WEB_UI) 2323 if (enabled_bindings_& BINDINGS_POLICY_WEB_UI)
2320 WebUIExtension::Install(frame); 2324 WebUIExtension::Install(frame);
2321 2325
2322 if (enabled_bindings_ & BINDINGS_POLICY_STATS_COLLECTION) 2326 if (enabled_bindings_ & BINDINGS_POLICY_STATS_COLLECTION)
2323 StatsCollectionController::Install(frame); 2327 StatsCollectionController::Install(frame);
2324 2328
2325 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 2329 const base::CommandLine& command_line =
2330 *base::CommandLine::ForCurrentProcess();
2326 2331
2327 if (command_line.HasSwitch(switches::kEnableSkiaBenchmarking)) 2332 if (command_line.HasSwitch(switches::kEnableSkiaBenchmarking))
2328 SkiaBenchmarking::Install(frame); 2333 SkiaBenchmarking::Install(frame);
2329 2334
2330 if (command_line.HasSwitch(cc::switches::kEnableGpuBenchmarking)) 2335 if (command_line.HasSwitch(cc::switches::kEnableGpuBenchmarking))
2331 GpuBenchmarking::Install(frame); 2336 GpuBenchmarking::Install(frame);
2332 2337
2333 if (command_line.HasSwitch(switches::kEnableMemoryBenchmarking)) 2338 if (command_line.HasSwitch(switches::kEnableMemoryBenchmarking))
2334 MemoryBenchmarkingExtension::Install(frame); 2339 MemoryBenchmarkingExtension::Install(frame);
2335 } 2340 }
(...skipping 1755 matching lines...) Expand 10 before | Expand all | Expand 10 after
4091 std::vector<gfx::Size> sizes; 4096 std::vector<gfx::Size> sizes;
4092 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); 4097 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes);
4093 if (!url.isEmpty()) 4098 if (!url.isEmpty())
4094 urls.push_back( 4099 urls.push_back(
4095 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); 4100 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes));
4096 } 4101 }
4097 SendUpdateFaviconURL(urls); 4102 SendUpdateFaviconURL(urls);
4098 } 4103 }
4099 4104
4100 } // namespace content 4105 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_view_browsertest.cc ('k') | content/renderer/render_widget.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698