1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "content/common/content_switches_internal.h"
9 #include "base/command_line.h"
10 #include "base/metrics/field_trial.h"
11 #include "content/public/common/content_switches.h"
14 #include "base/win/windows_version.h"
15 #include "ui/gfx/win/direct_write.h"
23 static bool g_win32k_renderer_lockdown_disabled
= false;
28 bool IsPinchToZoomEnabled() {
29 const base::CommandLine
& command_line
=
30 *base::CommandLine::ForCurrentProcess();
32 // --disable-pinch should always disable pinch
33 if (command_line
.HasSwitch(switches::kDisablePinch
))
37 return base::win::GetVersion() >= base::win::VERSION_WIN8
;
38 #elif defined(OS_CHROMEOS)
41 return command_line
.HasSwitch(switches::kEnableViewport
) ||
42 command_line
.HasSwitch(switches::kEnablePinch
);
48 void DisableWin32kRendererLockdown() {
49 g_win32k_renderer_lockdown_disabled
= true;
52 bool IsWin32kRendererLockdownEnabled() {
53 if (g_win32k_renderer_lockdown_disabled
)
55 if (base::win::GetVersion() < base::win::VERSION_WIN8
)
57 if (!gfx::win::ShouldUseDirectWrite())
59 const base::CommandLine
* cmd_line
= base::CommandLine::ForCurrentProcess();
60 if (cmd_line
->HasSwitch(switches::kDisableWin32kRendererLockDown
))
66 V8CacheOptions
GetV8CacheOptions() {
67 const base::CommandLine
& command_line
=
68 *base::CommandLine::ForCurrentProcess();
69 std::string v8_cache_options
=
70 command_line
.GetSwitchValueASCII(switches::kV8CacheOptions
);
71 if (v8_cache_options
.empty())
72 v8_cache_options
= base::FieldTrialList::FindFullName("V8CacheOptions");
73 if (v8_cache_options
== "none") {
74 return V8_CACHE_OPTIONS_NONE
;
75 } else if (v8_cache_options
== "parse") {
76 return V8_CACHE_OPTIONS_PARSE
;
77 } else if (v8_cache_options
== "code") {
78 return V8_CACHE_OPTIONS_CODE
;
80 return V8_CACHE_OPTIONS_DEFAULT
;
84 } // namespace content