ozone: evdev: Sync caps lock LED state to evdev
[chromium-blink-merge.git] / content / common / content_switches_internal.cc
blob1e76f9b89d5b99c2cde46bed9f91596d32209432
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"
7 #include <string>
9 #include "base/command_line.h"
10 #include "base/metrics/field_trial.h"
11 #include "content/public/common/content_switches.h"
13 #if defined(OS_WIN)
14 #include "base/win/windows_version.h"
15 #include "ui/gfx/win/direct_write.h"
16 #endif
18 namespace content {
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))
26 return false;
28 #if defined(OS_WIN)
29 return base::win::GetVersion() >= base::win::VERSION_WIN8;
30 #elif defined(OS_CHROMEOS)
31 return true;
32 #else
33 return command_line.HasSwitch(switches::kEnableViewport) ||
34 command_line.HasSwitch(switches::kEnablePinch);
35 #endif
38 #if defined(OS_WIN)
40 bool IsWin32kRendererLockdownEnabled() {
41 const std::string group_name =
42 base::FieldTrialList::FindFullName("Win32kLockdown");
43 if (base::win::GetVersion() < base::win::VERSION_WIN8)
44 return false;
45 if (!gfx::win::ShouldUseDirectWrite())
46 return false;
47 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
48 if (cmd_line->HasSwitch(switches::kEnableWin32kRendererLockDown))
49 return true;
50 if (cmd_line->HasSwitch(switches::kDisableWin32kRendererLockDown))
51 return false;
52 // Default.
53 return group_name != "Disabled";
55 #endif
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;
86 } else {
87 return V8_CACHE_OPTIONS_DEFAULT;
91 } // namespace content