| 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 27 matching lines...) Expand all Loading... |
| 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(switches::kExtensionActionRedesign, | 45 extension_action_redesign(switches::kExtensionActionRedesign, |
| 46 kExtensionActionRedesignExperiment, | 46 kExtensionActionRedesignExperiment, |
| 47 FeatureSwitch::DEFAULT_ENABLED), | 47 FeatureSwitch::DEFAULT_ENABLED), |
| 48 extension_action_redesign_override(switches::kExtensionActionRedesign, | |
| 49 FeatureSwitch::DEFAULT_ENABLED), | |
| 50 scripts_require_action(switches::kScriptsRequireAction, | 48 scripts_require_action(switches::kScriptsRequireAction, |
| 51 FeatureSwitch::DEFAULT_DISABLED), | 49 FeatureSwitch::DEFAULT_DISABLED), |
| 52 embedded_extension_options(switches::kEmbeddedExtensionOptions, | 50 embedded_extension_options(switches::kEmbeddedExtensionOptions, |
| 53 FeatureSwitch::DEFAULT_DISABLED), | 51 FeatureSwitch::DEFAULT_DISABLED), |
| 54 trace_app_source(switches::kTraceAppSource, | 52 trace_app_source(switches::kTraceAppSource, |
| 55 FeatureSwitch::DEFAULT_ENABLED), | 53 FeatureSwitch::DEFAULT_ENABLED), |
| 56 media_router(kMediaRouterFlag, | 54 media_router(kMediaRouterFlag, |
| 57 kEnableMediaRouterExperiment, | 55 kEnableMediaRouterExperiment, |
| 58 FeatureSwitch::DEFAULT_DISABLED) { | 56 FeatureSwitch::DEFAULT_ENABLED) { |
| 59 } | 57 } |
| 60 | 58 |
| 61 // Enables extensions to be easily installed from sites other than the web | 59 // Enables extensions to be easily installed from sites other than the web |
| 62 // store. | 60 // store. |
| 63 FeatureSwitch easy_off_store_install; | 61 FeatureSwitch easy_off_store_install; |
| 64 | 62 |
| 65 FeatureSwitch force_dev_mode_highlighting; | 63 FeatureSwitch force_dev_mode_highlighting; |
| 66 | 64 |
| 67 // Should we prompt the user before allowing external extensions to install? | 65 // Should we prompt the user before allowing external extensions to install? |
| 68 // Default is yes. | 66 // Default is yes. |
| 69 FeatureSwitch prompt_for_external_extensions; | 67 FeatureSwitch prompt_for_external_extensions; |
| 70 | 68 |
| 71 FeatureSwitch error_console; | 69 FeatureSwitch error_console; |
| 72 FeatureSwitch enable_override_bookmarks_ui; | 70 FeatureSwitch enable_override_bookmarks_ui; |
| 73 FeatureSwitch extension_action_redesign; | 71 FeatureSwitch extension_action_redesign; |
| 74 FeatureSwitch extension_action_redesign_override; | |
| 75 FeatureSwitch scripts_require_action; | 72 FeatureSwitch scripts_require_action; |
| 76 FeatureSwitch embedded_extension_options; | 73 FeatureSwitch embedded_extension_options; |
| 77 FeatureSwitch trace_app_source; | 74 FeatureSwitch trace_app_source; |
| 78 FeatureSwitch media_router; | 75 FeatureSwitch media_router; |
| 79 }; | 76 }; |
| 80 | 77 |
| 81 base::LazyInstance<CommonSwitches> g_common_switches = | 78 base::LazyInstance<CommonSwitches> g_common_switches = |
| 82 LAZY_INSTANCE_INITIALIZER; | 79 LAZY_INSTANCE_INITIALIZER; |
| 83 | 80 |
| 84 } // namespace | 81 } // namespace |
| 85 | 82 |
| 86 FeatureSwitch* FeatureSwitch::force_dev_mode_highlighting() { | 83 FeatureSwitch* FeatureSwitch::force_dev_mode_highlighting() { |
| 87 return &g_common_switches.Get().force_dev_mode_highlighting; | 84 return &g_common_switches.Get().force_dev_mode_highlighting; |
| 88 } | 85 } |
| 89 FeatureSwitch* FeatureSwitch::easy_off_store_install() { | 86 FeatureSwitch* FeatureSwitch::easy_off_store_install() { |
| 90 return &g_common_switches.Get().easy_off_store_install; | 87 return &g_common_switches.Get().easy_off_store_install; |
| 91 } | 88 } |
| 92 FeatureSwitch* FeatureSwitch::prompt_for_external_extensions() { | 89 FeatureSwitch* FeatureSwitch::prompt_for_external_extensions() { |
| 93 return &g_common_switches.Get().prompt_for_external_extensions; | 90 return &g_common_switches.Get().prompt_for_external_extensions; |
| 94 } | 91 } |
| 95 FeatureSwitch* FeatureSwitch::error_console() { | 92 FeatureSwitch* FeatureSwitch::error_console() { |
| 96 return &g_common_switches.Get().error_console; | 93 return &g_common_switches.Get().error_console; |
| 97 } | 94 } |
| 98 FeatureSwitch* FeatureSwitch::enable_override_bookmarks_ui() { | 95 FeatureSwitch* FeatureSwitch::enable_override_bookmarks_ui() { |
| 99 return &g_common_switches.Get().enable_override_bookmarks_ui; | 96 return &g_common_switches.Get().enable_override_bookmarks_ui; |
| 100 } | 97 } |
| 101 FeatureSwitch* FeatureSwitch::extension_action_redesign() { | 98 FeatureSwitch* FeatureSwitch::extension_action_redesign() { |
| 102 // Force-enable the redesigned extension action toolbar when the Media Router | |
| 103 // is enabled. Should be removed when the toolbar redesign is used by default. | |
| 104 // See crbug.com/514694 | |
| 105 // Note that if Media Router is enabled by experiment, it implies that the | |
| 106 // extension action redesign is also enabled by experiment. Thus it is fine | |
| 107 // to return the override switch. | |
| 108 // TODO(kmarshall): Remove this override. | |
| 109 if (media_router()->IsEnabled()) | |
| 110 return &g_common_switches.Get().extension_action_redesign_override; | |
| 111 | |
| 112 return &g_common_switches.Get().extension_action_redesign; | 99 return &g_common_switches.Get().extension_action_redesign; |
| 113 } | 100 } |
| 114 FeatureSwitch* FeatureSwitch::scripts_require_action() { | 101 FeatureSwitch* FeatureSwitch::scripts_require_action() { |
| 115 return &g_common_switches.Get().scripts_require_action; | 102 return &g_common_switches.Get().scripts_require_action; |
| 116 } | 103 } |
| 117 FeatureSwitch* FeatureSwitch::embedded_extension_options() { | 104 FeatureSwitch* FeatureSwitch::embedded_extension_options() { |
| 118 return &g_common_switches.Get().embedded_extension_options; | 105 return &g_common_switches.Get().embedded_extension_options; |
| 119 } | 106 } |
| 120 FeatureSwitch* FeatureSwitch::trace_app_source() { | 107 FeatureSwitch* FeatureSwitch::trace_app_source() { |
| 121 return &g_common_switches.Get().trace_app_source; | 108 return &g_common_switches.Get().trace_app_source; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 | 202 |
| 216 void FeatureSwitch::SetOverrideValue(OverrideValue override_value) { | 203 void FeatureSwitch::SetOverrideValue(OverrideValue override_value) { |
| 217 override_value_ = override_value; | 204 override_value_ = override_value; |
| 218 } | 205 } |
| 219 | 206 |
| 220 FeatureSwitch::OverrideValue FeatureSwitch::GetOverrideValue() const { | 207 FeatureSwitch::OverrideValue FeatureSwitch::GetOverrideValue() const { |
| 221 return override_value_; | 208 return override_value_; |
| 222 } | 209 } |
| 223 | 210 |
| 224 } // namespace extensions | 211 } // namespace extensions |
| OLD | NEW |