| 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 "build/build_config.h" | 11 #include "build/build_config.h" |
| 12 #include "extensions/common/switches.h" | 12 #include "extensions/common/switches.h" |
| 13 | 13 |
| 14 namespace extensions { | 14 namespace extensions { |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 // The switch load-media-router-component-extension is defined in | 18 // The switch load-media-router-component-extension is defined in |
| 19 // chrome/common/chrome_switches.cc, but we can't depend on chrome here. | 19 // chrome/common/chrome_switches.cc, but we can't depend on chrome here. |
| 20 const char kLoadMediaRouterComponentExtensionFlag[] = | 20 const char kLoadMediaRouterComponentExtensionFlag[] = |
| 21 "load-media-router-component-extension"; | 21 "load-media-router-component-extension"; |
| 22 | 22 |
| 23 const char kExtensionActionRedesignExperiment[] = "ExtensionActionRedesign"; | 23 const char kExtensionActionRedesignExperiment[] = "ExtensionActionRedesign"; |
| 24 | 24 |
| 25 class CommonSwitches { | 25 class CommonSwitches { |
| 26 public: | 26 public: |
| 27 CommonSwitches() | 27 CommonSwitches() |
| 28 : easy_off_store_install(nullptr, FeatureSwitch::DEFAULT_DISABLED), | 28 : force_dev_mode_highlighting(switches::kForceDevModeHighlighting, |
| 29 force_dev_mode_highlighting(switches::kForceDevModeHighlighting, | |
| 30 FeatureSwitch::DEFAULT_DISABLED), | 29 FeatureSwitch::DEFAULT_DISABLED), |
| 31 prompt_for_external_extensions( | 30 prompt_for_external_extensions( |
| 32 #if defined(CHROMIUM_BUILD) | 31 #if defined(CHROMIUM_BUILD) |
| 33 switches::kPromptForExternalExtensions, | 32 switches::kPromptForExternalExtensions, |
| 34 #else | 33 #else |
| 35 nullptr, | 34 nullptr, |
| 36 #endif | 35 #endif |
| 37 #if defined(OS_WIN) | 36 #if defined(OS_WIN) |
| 38 FeatureSwitch::DEFAULT_ENABLED), | 37 FeatureSwitch::DEFAULT_ENABLED), |
| 39 #else | 38 #else |
| (...skipping 15 matching lines...) Expand all Loading... |
| 55 kLoadMediaRouterComponentExtensionFlag, | 54 kLoadMediaRouterComponentExtensionFlag, |
| 56 #if defined(GOOGLE_CHROME_BUILD) | 55 #if defined(GOOGLE_CHROME_BUILD) |
| 57 FeatureSwitch::DEFAULT_ENABLED), | 56 FeatureSwitch::DEFAULT_ENABLED), |
| 58 #else | 57 #else |
| 59 FeatureSwitch::DEFAULT_DISABLED), | 58 FeatureSwitch::DEFAULT_DISABLED), |
| 60 #endif // defined(GOOGLE_CHROME_BUILD) | 59 #endif // defined(GOOGLE_CHROME_BUILD) |
| 61 native_crx_bindings(switches::kNativeCrxBindings, | 60 native_crx_bindings(switches::kNativeCrxBindings, |
| 62 FeatureSwitch::DEFAULT_DISABLED) { | 61 FeatureSwitch::DEFAULT_DISABLED) { |
| 63 } | 62 } |
| 64 | 63 |
| 65 // Enables extensions to be easily installed from sites other than the web | |
| 66 // store. | |
| 67 FeatureSwitch easy_off_store_install; | |
| 68 | |
| 69 FeatureSwitch force_dev_mode_highlighting; | 64 FeatureSwitch force_dev_mode_highlighting; |
| 70 | 65 |
| 71 // Should we prompt the user before allowing external extensions to install? | 66 // Should we prompt the user before allowing external extensions to install? |
| 72 // Default is yes. | 67 // Default is yes. |
| 73 FeatureSwitch prompt_for_external_extensions; | 68 FeatureSwitch prompt_for_external_extensions; |
| 74 | 69 |
| 75 FeatureSwitch error_console; | 70 FeatureSwitch error_console; |
| 76 FeatureSwitch enable_override_bookmarks_ui; | 71 FeatureSwitch enable_override_bookmarks_ui; |
| 77 FeatureSwitch extension_action_redesign; | 72 FeatureSwitch extension_action_redesign; |
| 78 FeatureSwitch scripts_require_action; | 73 FeatureSwitch scripts_require_action; |
| 79 FeatureSwitch embedded_extension_options; | 74 FeatureSwitch embedded_extension_options; |
| 80 FeatureSwitch trace_app_source; | 75 FeatureSwitch trace_app_source; |
| 81 FeatureSwitch load_media_router_component_extension; | 76 FeatureSwitch load_media_router_component_extension; |
| 82 FeatureSwitch native_crx_bindings; | 77 FeatureSwitch native_crx_bindings; |
| 83 }; | 78 }; |
| 84 | 79 |
| 85 base::LazyInstance<CommonSwitches> g_common_switches = | 80 base::LazyInstance<CommonSwitches> g_common_switches = |
| 86 LAZY_INSTANCE_INITIALIZER; | 81 LAZY_INSTANCE_INITIALIZER; |
| 87 | 82 |
| 88 } // namespace | 83 } // namespace |
| 89 | 84 |
| 90 FeatureSwitch* FeatureSwitch::force_dev_mode_highlighting() { | 85 FeatureSwitch* FeatureSwitch::force_dev_mode_highlighting() { |
| 91 return &g_common_switches.Get().force_dev_mode_highlighting; | 86 return &g_common_switches.Get().force_dev_mode_highlighting; |
| 92 } | 87 } |
| 93 FeatureSwitch* FeatureSwitch::easy_off_store_install() { | |
| 94 return &g_common_switches.Get().easy_off_store_install; | |
| 95 } | |
| 96 FeatureSwitch* FeatureSwitch::prompt_for_external_extensions() { | 88 FeatureSwitch* FeatureSwitch::prompt_for_external_extensions() { |
| 97 return &g_common_switches.Get().prompt_for_external_extensions; | 89 return &g_common_switches.Get().prompt_for_external_extensions; |
| 98 } | 90 } |
| 99 FeatureSwitch* FeatureSwitch::error_console() { | 91 FeatureSwitch* FeatureSwitch::error_console() { |
| 100 return &g_common_switches.Get().error_console; | 92 return &g_common_switches.Get().error_console; |
| 101 } | 93 } |
| 102 FeatureSwitch* FeatureSwitch::enable_override_bookmarks_ui() { | 94 FeatureSwitch* FeatureSwitch::enable_override_bookmarks_ui() { |
| 103 return &g_common_switches.Get().enable_override_bookmarks_ui; | 95 return &g_common_switches.Get().enable_override_bookmarks_ui; |
| 104 } | 96 } |
| 105 FeatureSwitch* FeatureSwitch::extension_action_redesign() { | 97 FeatureSwitch* FeatureSwitch::extension_action_redesign() { |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 | 204 |
| 213 void FeatureSwitch::SetOverrideValue(OverrideValue override_value) { | 205 void FeatureSwitch::SetOverrideValue(OverrideValue override_value) { |
| 214 override_value_ = override_value; | 206 override_value_ = override_value; |
| 215 } | 207 } |
| 216 | 208 |
| 217 FeatureSwitch::OverrideValue FeatureSwitch::GetOverrideValue() const { | 209 FeatureSwitch::OverrideValue FeatureSwitch::GetOverrideValue() const { |
| 218 return override_value_; | 210 return override_value_; |
| 219 } | 211 } |
| 220 | 212 |
| 221 } // namespace extensions | 213 } // namespace extensions |
| OLD | NEW |