| 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 25 matching lines...) Expand all Loading... |
| 36 FeatureSwitch::DEFAULT_ENABLED), | 36 FeatureSwitch::DEFAULT_ENABLED), |
| 37 #else | 37 #else |
| 38 FeatureSwitch::DEFAULT_DISABLED), | 38 FeatureSwitch::DEFAULT_DISABLED), |
| 39 #endif | 39 #endif |
| 40 error_console( | 40 error_console( |
| 41 switches::kErrorConsole, | 41 switches::kErrorConsole, |
| 42 FeatureSwitch::DEFAULT_DISABLED), | 42 FeatureSwitch::DEFAULT_DISABLED), |
| 43 enable_override_bookmarks_ui( | 43 enable_override_bookmarks_ui( |
| 44 switches::kEnableOverrideBookmarksUI, | 44 switches::kEnableOverrideBookmarksUI, |
| 45 FeatureSwitch::DEFAULT_DISABLED), | 45 FeatureSwitch::DEFAULT_DISABLED), |
| 46 extension_action_redesign( |
| 47 switches::kExtensionActionRedesign, |
| 48 FeatureSwitch::DEFAULT_DISABLED), |
| 46 scripts_require_action(switches::kScriptsRequireAction, | 49 scripts_require_action(switches::kScriptsRequireAction, |
| 47 FeatureSwitch::DEFAULT_DISABLED) {} | 50 FeatureSwitch::DEFAULT_DISABLED) {} |
| 48 | 51 |
| 49 // Enables extensions to be easily installed from sites other than the web | 52 // Enables extensions to be easily installed from sites other than the web |
| 50 // store. | 53 // store. |
| 51 FeatureSwitch easy_off_store_install; | 54 FeatureSwitch easy_off_store_install; |
| 52 | 55 |
| 53 FeatureSwitch force_dev_mode_highlighting; | 56 FeatureSwitch force_dev_mode_highlighting; |
| 54 FeatureSwitch global_commands; | 57 FeatureSwitch global_commands; |
| 55 | 58 |
| 56 // Should we prompt the user before allowing external extensions to install? | 59 // Should we prompt the user before allowing external extensions to install? |
| 57 // Default is yes. | 60 // Default is yes. |
| 58 FeatureSwitch prompt_for_external_extensions; | 61 FeatureSwitch prompt_for_external_extensions; |
| 59 | 62 |
| 60 FeatureSwitch error_console; | 63 FeatureSwitch error_console; |
| 61 FeatureSwitch enable_override_bookmarks_ui; | 64 FeatureSwitch enable_override_bookmarks_ui; |
| 65 FeatureSwitch extension_action_redesign; |
| 62 FeatureSwitch scripts_require_action; | 66 FeatureSwitch scripts_require_action; |
| 63 }; | 67 }; |
| 64 | 68 |
| 65 base::LazyInstance<CommonSwitches> g_common_switches = | 69 base::LazyInstance<CommonSwitches> g_common_switches = |
| 66 LAZY_INSTANCE_INITIALIZER; | 70 LAZY_INSTANCE_INITIALIZER; |
| 67 | 71 |
| 68 } // namespace | 72 } // namespace |
| 69 | 73 |
| 70 FeatureSwitch* FeatureSwitch::force_dev_mode_highlighting() { | 74 FeatureSwitch* FeatureSwitch::force_dev_mode_highlighting() { |
| 71 return &g_common_switches.Get().force_dev_mode_highlighting; | 75 return &g_common_switches.Get().force_dev_mode_highlighting; |
| 72 } | 76 } |
| 73 FeatureSwitch* FeatureSwitch::easy_off_store_install() { | 77 FeatureSwitch* FeatureSwitch::easy_off_store_install() { |
| 74 return &g_common_switches.Get().easy_off_store_install; | 78 return &g_common_switches.Get().easy_off_store_install; |
| 75 } | 79 } |
| 76 FeatureSwitch* FeatureSwitch::global_commands() { | 80 FeatureSwitch* FeatureSwitch::global_commands() { |
| 77 return &g_common_switches.Get().global_commands; | 81 return &g_common_switches.Get().global_commands; |
| 78 } | 82 } |
| 79 FeatureSwitch* FeatureSwitch::prompt_for_external_extensions() { | 83 FeatureSwitch* FeatureSwitch::prompt_for_external_extensions() { |
| 80 return &g_common_switches.Get().prompt_for_external_extensions; | 84 return &g_common_switches.Get().prompt_for_external_extensions; |
| 81 } | 85 } |
| 82 FeatureSwitch* FeatureSwitch::error_console() { | 86 FeatureSwitch* FeatureSwitch::error_console() { |
| 83 return &g_common_switches.Get().error_console; | 87 return &g_common_switches.Get().error_console; |
| 84 } | 88 } |
| 85 FeatureSwitch* FeatureSwitch::enable_override_bookmarks_ui() { | 89 FeatureSwitch* FeatureSwitch::enable_override_bookmarks_ui() { |
| 86 return &g_common_switches.Get().enable_override_bookmarks_ui; | 90 return &g_common_switches.Get().enable_override_bookmarks_ui; |
| 87 } | 91 } |
| 88 | 92 FeatureSwitch* FeatureSwitch::extension_action_redesign() { |
| 93 return &g_common_switches.Get().extension_action_redesign; |
| 94 } |
| 89 FeatureSwitch* FeatureSwitch::scripts_require_action() { | 95 FeatureSwitch* FeatureSwitch::scripts_require_action() { |
| 90 return &g_common_switches.Get().scripts_require_action; | 96 return &g_common_switches.Get().scripts_require_action; |
| 91 } | 97 } |
| 92 | 98 |
| 93 FeatureSwitch::ScopedOverride::ScopedOverride(FeatureSwitch* feature, | 99 FeatureSwitch::ScopedOverride::ScopedOverride(FeatureSwitch* feature, |
| 94 bool override_value) | 100 bool override_value) |
| 95 : feature_(feature), | 101 : feature_(feature), |
| 96 previous_value_(feature->GetOverrideValue()) { | 102 previous_value_(feature->GetOverrideValue()) { |
| 97 feature_->SetOverrideValue( | 103 feature_->SetOverrideValue( |
| 98 override_value ? OVERRIDE_ENABLED : OVERRIDE_DISABLED); | 104 override_value ? OVERRIDE_ENABLED : OVERRIDE_DISABLED); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 | 166 |
| 161 void FeatureSwitch::SetOverrideValue(OverrideValue override_value) { | 167 void FeatureSwitch::SetOverrideValue(OverrideValue override_value) { |
| 162 override_value_ = override_value; | 168 override_value_ = override_value; |
| 163 } | 169 } |
| 164 | 170 |
| 165 FeatureSwitch::OverrideValue FeatureSwitch::GetOverrideValue() const { | 171 FeatureSwitch::OverrideValue FeatureSwitch::GetOverrideValue() const { |
| 166 return override_value_; | 172 return override_value_; |
| 167 } | 173 } |
| 168 | 174 |
| 169 } // namespace extensions | 175 } // namespace extensions |
| OLD | NEW |