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" |
(...skipping 24 matching lines...) Expand all Loading... |
35 nullptr, | 35 nullptr, |
36 #endif | 36 #endif |
37 #if defined(OS_WIN) || defined(OS_MACOSX) | 37 #if defined(OS_WIN) || defined(OS_MACOSX) |
38 FeatureSwitch::DEFAULT_ENABLED), | 38 FeatureSwitch::DEFAULT_ENABLED), |
39 #else | 39 #else |
40 FeatureSwitch::DEFAULT_DISABLED), | 40 FeatureSwitch::DEFAULT_DISABLED), |
41 #endif | 41 #endif |
42 error_console(switches::kErrorConsole, FeatureSwitch::DEFAULT_DISABLED), | 42 error_console(switches::kErrorConsole, FeatureSwitch::DEFAULT_DISABLED), |
43 enable_override_bookmarks_ui(switches::kEnableOverrideBookmarksUI, | 43 enable_override_bookmarks_ui(switches::kEnableOverrideBookmarksUI, |
44 FeatureSwitch::DEFAULT_DISABLED), | 44 FeatureSwitch::DEFAULT_DISABLED), |
45 extension_action_redesign(nullptr, FeatureSwitch::DEFAULT_ENABLED), | |
46 scripts_require_action(switches::kScriptsRequireAction, | 45 scripts_require_action(switches::kScriptsRequireAction, |
47 FeatureSwitch::DEFAULT_DISABLED), | 46 FeatureSwitch::DEFAULT_DISABLED), |
48 embedded_extension_options(switches::kEmbeddedExtensionOptions, | 47 embedded_extension_options(switches::kEmbeddedExtensionOptions, |
49 FeatureSwitch::DEFAULT_DISABLED), | 48 FeatureSwitch::DEFAULT_DISABLED), |
50 trace_app_source(switches::kTraceAppSource, | 49 trace_app_source(switches::kTraceAppSource, |
51 FeatureSwitch::DEFAULT_ENABLED), | 50 FeatureSwitch::DEFAULT_ENABLED), |
52 load_media_router_component_extension( | 51 load_media_router_component_extension( |
53 kLoadMediaRouterComponentExtensionFlag, | 52 kLoadMediaRouterComponentExtensionFlag, |
54 #if defined(GOOGLE_CHROME_BUILD) | 53 #if defined(GOOGLE_CHROME_BUILD) |
55 FeatureSwitch::DEFAULT_ENABLED), | 54 FeatureSwitch::DEFAULT_ENABLED), |
56 #else | 55 #else |
57 FeatureSwitch::DEFAULT_DISABLED), | 56 FeatureSwitch::DEFAULT_DISABLED), |
58 #endif // defined(GOOGLE_CHROME_BUILD) | 57 #endif // defined(GOOGLE_CHROME_BUILD) |
59 native_crx_bindings(switches::kNativeCrxBindings, | 58 native_crx_bindings(switches::kNativeCrxBindings, |
60 FeatureSwitch::DEFAULT_DISABLED), | 59 FeatureSwitch::DEFAULT_DISABLED), |
61 yield_between_content_script_runs( | 60 yield_between_content_script_runs( |
62 switches::kYieldBetweenContentScriptRuns, | 61 switches::kYieldBetweenContentScriptRuns, |
63 kYieldBetweenContentScriptRunsFieldTrial, | 62 kYieldBetweenContentScriptRunsFieldTrial, |
64 FeatureSwitch::DEFAULT_DISABLED) { | 63 FeatureSwitch::DEFAULT_DISABLED) { |
65 } | 64 } |
66 | 65 |
67 FeatureSwitch force_dev_mode_highlighting; | 66 FeatureSwitch force_dev_mode_highlighting; |
68 | 67 |
69 // Should we prompt the user before allowing external extensions to install? | 68 // Should we prompt the user before allowing external extensions to install? |
70 // Default is yes. | 69 // Default is yes. |
71 FeatureSwitch prompt_for_external_extensions; | 70 FeatureSwitch prompt_for_external_extensions; |
72 | 71 |
73 FeatureSwitch error_console; | 72 FeatureSwitch error_console; |
74 FeatureSwitch enable_override_bookmarks_ui; | 73 FeatureSwitch enable_override_bookmarks_ui; |
75 FeatureSwitch extension_action_redesign; | |
76 FeatureSwitch scripts_require_action; | 74 FeatureSwitch scripts_require_action; |
77 FeatureSwitch embedded_extension_options; | 75 FeatureSwitch embedded_extension_options; |
78 FeatureSwitch trace_app_source; | 76 FeatureSwitch trace_app_source; |
79 FeatureSwitch load_media_router_component_extension; | 77 FeatureSwitch load_media_router_component_extension; |
80 FeatureSwitch native_crx_bindings; | 78 FeatureSwitch native_crx_bindings; |
81 FeatureSwitch yield_between_content_script_runs; | 79 FeatureSwitch yield_between_content_script_runs; |
82 }; | 80 }; |
83 | 81 |
84 base::LazyInstance<CommonSwitches>::DestructorAtExit g_common_switches = | 82 base::LazyInstance<CommonSwitches>::DestructorAtExit g_common_switches = |
85 LAZY_INSTANCE_INITIALIZER; | 83 LAZY_INSTANCE_INITIALIZER; |
86 | 84 |
87 } // namespace | 85 } // namespace |
88 | 86 |
89 FeatureSwitch* FeatureSwitch::force_dev_mode_highlighting() { | 87 FeatureSwitch* FeatureSwitch::force_dev_mode_highlighting() { |
90 return &g_common_switches.Get().force_dev_mode_highlighting; | 88 return &g_common_switches.Get().force_dev_mode_highlighting; |
91 } | 89 } |
92 FeatureSwitch* FeatureSwitch::prompt_for_external_extensions() { | 90 FeatureSwitch* FeatureSwitch::prompt_for_external_extensions() { |
93 return &g_common_switches.Get().prompt_for_external_extensions; | 91 return &g_common_switches.Get().prompt_for_external_extensions; |
94 } | 92 } |
95 FeatureSwitch* FeatureSwitch::error_console() { | 93 FeatureSwitch* FeatureSwitch::error_console() { |
96 return &g_common_switches.Get().error_console; | 94 return &g_common_switches.Get().error_console; |
97 } | 95 } |
98 FeatureSwitch* FeatureSwitch::enable_override_bookmarks_ui() { | 96 FeatureSwitch* FeatureSwitch::enable_override_bookmarks_ui() { |
99 return &g_common_switches.Get().enable_override_bookmarks_ui; | 97 return &g_common_switches.Get().enable_override_bookmarks_ui; |
100 } | 98 } |
101 FeatureSwitch* FeatureSwitch::extension_action_redesign() { | |
102 return &g_common_switches.Get().extension_action_redesign; | |
103 } | |
104 FeatureSwitch* FeatureSwitch::scripts_require_action() { | 99 FeatureSwitch* FeatureSwitch::scripts_require_action() { |
105 return &g_common_switches.Get().scripts_require_action; | 100 return &g_common_switches.Get().scripts_require_action; |
106 } | 101 } |
107 FeatureSwitch* FeatureSwitch::embedded_extension_options() { | 102 FeatureSwitch* FeatureSwitch::embedded_extension_options() { |
108 return &g_common_switches.Get().embedded_extension_options; | 103 return &g_common_switches.Get().embedded_extension_options; |
109 } | 104 } |
110 FeatureSwitch* FeatureSwitch::trace_app_source() { | 105 FeatureSwitch* FeatureSwitch::trace_app_source() { |
111 return &g_common_switches.Get().trace_app_source; | 106 return &g_common_switches.Get().trace_app_source; |
112 } | 107 } |
113 FeatureSwitch* FeatureSwitch::load_media_router_component_extension() { | 108 FeatureSwitch* FeatureSwitch::load_media_router_component_extension() { |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 | 211 |
217 void FeatureSwitch::SetOverrideValue(OverrideValue override_value) { | 212 void FeatureSwitch::SetOverrideValue(OverrideValue override_value) { |
218 override_value_ = override_value; | 213 override_value_ = override_value; |
219 } | 214 } |
220 | 215 |
221 FeatureSwitch::OverrideValue FeatureSwitch::GetOverrideValue() const { | 216 FeatureSwitch::OverrideValue FeatureSwitch::GetOverrideValue() const { |
222 return override_value_; | 217 return override_value_; |
223 } | 218 } |
224 | 219 |
225 } // namespace extensions | 220 } // namespace extensions |
OLD | NEW |