OLD | NEW |
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 "extensions/common/feature_switch.h" | 5 #include "extensions/common/feature_switch.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
11 #include "extensions/common/switches.h" | 11 #include "extensions/common/switches.h" |
12 | 12 |
13 namespace extensions { | 13 namespace extensions { |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 class CommonSwitches { | 17 class CommonSwitches { |
18 public: | 18 public: |
19 CommonSwitches() | 19 CommonSwitches() |
20 : easy_off_store_install( | 20 : easy_off_store_install( |
21 switches::kEasyOffStoreExtensionInstall, | 21 switches::kEasyOffStoreExtensionInstall, |
22 FeatureSwitch::DEFAULT_DISABLED), | 22 FeatureSwitch::DEFAULT_DISABLED), |
| 23 force_dev_mode_highlighting( |
| 24 switches::kForceDevModeHighlighting, |
| 25 FeatureSwitch::DEFAULT_DISABLED), |
23 global_commands( | 26 global_commands( |
24 switches::kGlobalCommands, | 27 switches::kGlobalCommands, |
25 FeatureSwitch::DEFAULT_DISABLED), | 28 FeatureSwitch::DEFAULT_DISABLED), |
26 script_badges( | 29 script_badges( |
27 switches::kScriptBadges, | 30 switches::kScriptBadges, |
28 FeatureSwitch::DEFAULT_DISABLED), | 31 FeatureSwitch::DEFAULT_DISABLED), |
29 script_bubble( | 32 script_bubble( |
30 switches::kScriptBubble, | 33 switches::kScriptBubble, |
31 FeatureSwitch::DEFAULT_DISABLED), | 34 FeatureSwitch::DEFAULT_DISABLED), |
32 prompt_for_external_extensions( | 35 prompt_for_external_extensions( |
33 switches::kPromptForExternalExtensions, | 36 switches::kPromptForExternalExtensions, |
34 #if defined(OS_WIN) | 37 #if defined(OS_WIN) |
35 FeatureSwitch::DEFAULT_ENABLED), | 38 FeatureSwitch::DEFAULT_ENABLED), |
36 #else | 39 #else |
37 FeatureSwitch::DEFAULT_DISABLED), | 40 FeatureSwitch::DEFAULT_DISABLED), |
38 #endif | 41 #endif |
39 error_console( | 42 error_console( |
40 switches::kErrorConsole, | 43 switches::kErrorConsole, |
41 FeatureSwitch::DEFAULT_DISABLED), | 44 FeatureSwitch::DEFAULT_DISABLED), |
42 enable_override_bookmarks_ui( | 45 enable_override_bookmarks_ui( |
43 switches::kEnableOverrideBookmarksUI, | 46 switches::kEnableOverrideBookmarksUI, |
44 FeatureSwitch::DEFAULT_DISABLED) {} | 47 FeatureSwitch::DEFAULT_DISABLED) {} |
45 | 48 |
46 FeatureSwitch easy_off_store_install; | 49 FeatureSwitch easy_off_store_install; |
| 50 FeatureSwitch force_dev_mode_highlighting; |
47 FeatureSwitch global_commands; | 51 FeatureSwitch global_commands; |
48 FeatureSwitch script_badges; | 52 FeatureSwitch script_badges; |
49 FeatureSwitch script_bubble; | 53 FeatureSwitch script_bubble; |
50 FeatureSwitch prompt_for_external_extensions; | 54 FeatureSwitch prompt_for_external_extensions; |
51 FeatureSwitch error_console; | 55 FeatureSwitch error_console; |
52 FeatureSwitch enable_override_bookmarks_ui; | 56 FeatureSwitch enable_override_bookmarks_ui; |
53 }; | 57 }; |
54 | 58 |
55 base::LazyInstance<CommonSwitches> g_common_switches = | 59 base::LazyInstance<CommonSwitches> g_common_switches = |
56 LAZY_INSTANCE_INITIALIZER; | 60 LAZY_INSTANCE_INITIALIZER; |
57 | 61 |
58 } // namespace | 62 } // namespace |
59 | 63 |
| 64 FeatureSwitch* FeatureSwitch::force_dev_mode_highlighting() { |
| 65 return &g_common_switches.Get().force_dev_mode_highlighting; |
| 66 } |
60 FeatureSwitch* FeatureSwitch::easy_off_store_install() { | 67 FeatureSwitch* FeatureSwitch::easy_off_store_install() { |
61 return &g_common_switches.Get().easy_off_store_install; | 68 return &g_common_switches.Get().easy_off_store_install; |
62 } | 69 } |
63 FeatureSwitch* FeatureSwitch::global_commands() { | 70 FeatureSwitch* FeatureSwitch::global_commands() { |
64 return &g_common_switches.Get().global_commands; | 71 return &g_common_switches.Get().global_commands; |
65 } | 72 } |
66 FeatureSwitch* FeatureSwitch::script_badges() { | 73 FeatureSwitch* FeatureSwitch::script_badges() { |
67 return &g_common_switches.Get().script_badges; | 74 return &g_common_switches.Get().script_badges; |
68 } | 75 } |
69 FeatureSwitch* FeatureSwitch::script_bubble() { | 76 FeatureSwitch* FeatureSwitch::script_bubble() { |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 | 151 |
145 void FeatureSwitch::SetOverrideValue(OverrideValue override_value) { | 152 void FeatureSwitch::SetOverrideValue(OverrideValue override_value) { |
146 override_value_ = override_value; | 153 override_value_ = override_value; |
147 } | 154 } |
148 | 155 |
149 FeatureSwitch::OverrideValue FeatureSwitch::GetOverrideValue() const { | 156 FeatureSwitch::OverrideValue FeatureSwitch::GetOverrideValue() const { |
150 return override_value_; | 157 return override_value_; |
151 } | 158 } |
152 | 159 |
153 } // namespace extensions | 160 } // namespace extensions |
OLD | NEW |