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"
20 bool IsPinchToZoomEnabled() {
21 const base::CommandLine
& command_line
=
22 *base::CommandLine::ForCurrentProcess();
24 // --disable-pinch should always disable pinch
25 if (command_line
.HasSwitch(switches::kDisablePinch
))
29 return base::win::GetVersion() >= base::win::VERSION_WIN8
;
30 #elif defined(OS_CHROMEOS)
33 return command_line
.HasSwitch(switches::kEnableViewport
) ||
34 command_line
.HasSwitch(switches::kEnablePinch
);
40 bool IsWin32kRendererLockdownEnabled() {
41 const std::string group_name
=
42 base::FieldTrialList::FindFullName("Win32kLockdown");
43 if (base::win::GetVersion() < base::win::VERSION_WIN8
)
45 if (!gfx::win::ShouldUseDirectWrite())
47 const base::CommandLine
* cmd_line
= base::CommandLine::ForCurrentProcess();
48 if (cmd_line
->HasSwitch(switches::kEnableWin32kRendererLockDown
))
50 if (cmd_line
->HasSwitch(switches::kDisableWin32kRendererLockDown
))
53 return group_name
!= "Disabled";
57 V8CacheOptions
GetV8CacheOptions() {
58 const base::CommandLine
& command_line
=
59 *base::CommandLine::ForCurrentProcess();
60 std::string v8_cache_options
=
61 command_line
.GetSwitchValueASCII(switches::kV8CacheOptions
);
62 if (v8_cache_options
.empty())
63 v8_cache_options
= base::FieldTrialList::FindFullName("V8CacheOptions");
64 if (v8_cache_options
== "parse") {
65 return V8_CACHE_OPTIONS_PARSE
;
66 } else if (v8_cache_options
== "code") {
67 return V8_CACHE_OPTIONS_CODE
;
68 } else if (v8_cache_options
== "code-compressed") {
69 return V8_CACHE_OPTIONS_CODE_COMPRESSED
;
70 } else if (v8_cache_options
== "none") {
71 return V8_CACHE_OPTIONS_NONE
;
72 } else if (v8_cache_options
== "parse-memory") {
73 return V8_CACHE_OPTIONS_PARSE_MEMORY
;
74 } else if (v8_cache_options
== "heuristics") {
75 return V8_CACHE_OPTIONS_HEURISTICS
;
76 } else if (v8_cache_options
== "heuristics-mobile") {
77 return V8_CACHE_OPTIONS_HEURISTICS_MOBILE
;
78 } else if (v8_cache_options
== "heuristics-default") {
79 return V8_CACHE_OPTIONS_HEURISTICS_DEFAULT
;
80 } else if (v8_cache_options
== "heuristics-default-mobile") {
81 return V8_CACHE_OPTIONS_HEURISTICS_DEFAULT_MOBILE
;
82 } else if (v8_cache_options
== "recent") {
83 return V8_CACHE_OPTIONS_RECENT
;
84 } else if (v8_cache_options
== "recent-small") {
85 return V8_CACHE_OPTIONS_RECENT_SMALL
;
87 return V8_CACHE_OPTIONS_DEFAULT
;
91 } // namespace content