| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/common/extensions/feature_switch.h" | 5 #include "chrome/common/extensions/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/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 FeatureSwitch::DEFAULT_DISABLED), | 24 FeatureSwitch::DEFAULT_DISABLED), |
| 25 extensions_in_action_box( | 25 extensions_in_action_box( |
| 26 switches::kExtensionsInActionBox, | 26 switches::kExtensionsInActionBox, |
| 27 FeatureSwitch::DEFAULT_DISABLED), | 27 FeatureSwitch::DEFAULT_DISABLED), |
| 28 script_badges( | 28 script_badges( |
| 29 switches::kScriptBadges, | 29 switches::kScriptBadges, |
| 30 FeatureSwitch::DEFAULT_DISABLED), | 30 FeatureSwitch::DEFAULT_DISABLED), |
| 31 script_bubble( | 31 script_bubble( |
| 32 switches::kScriptBubble, | 32 switches::kScriptBubble, |
| 33 FeatureSwitch::DEFAULT_DISABLED), | 33 FeatureSwitch::DEFAULT_DISABLED), |
| 34 sideload_wipeout( |
| 35 switches::kSideloadWipeout, |
| 36 FeatureSwitch::DEFAULT_DISABLED), |
| 34 prompt_for_external_extensions( | 37 prompt_for_external_extensions( |
| 35 switches::kPromptForExternalExtensions, | 38 switches::kPromptForExternalExtensions, |
| 36 FeatureSwitch::DEFAULT_ENABLED) | 39 FeatureSwitch::DEFAULT_ENABLED) |
| 37 { | 40 { |
| 38 // Disabling easy off-store installation is not yet implemented for Aura. Not | 41 // Disabling easy off-store installation is not yet implemented for Aura. Not |
| 39 // sure what the Aura equivalent for this UI is. | 42 // sure what the Aura equivalent for this UI is. |
| 40 #if defined(USE_AURA) | 43 #if defined(USE_AURA) |
| 41 easy_off_store_install.SetOverrideValue(FeatureSwitch::OVERRIDE_ENABLED); | 44 easy_off_store_install.SetOverrideValue(FeatureSwitch::OVERRIDE_ENABLED); |
| 42 #endif | 45 #endif |
| 43 | 46 |
| 44 if (!action_box.IsEnabled()){ | 47 if (!action_box.IsEnabled()){ |
| 45 extensions_in_action_box.SetOverrideValue( | 48 extensions_in_action_box.SetOverrideValue( |
| 46 FeatureSwitch::OVERRIDE_DISABLED); | 49 FeatureSwitch::OVERRIDE_DISABLED); |
| 47 } | 50 } |
| 48 } | 51 } |
| 49 | 52 |
| 50 FeatureSwitch action_box; | 53 FeatureSwitch action_box; |
| 51 FeatureSwitch easy_off_store_install; | 54 FeatureSwitch easy_off_store_install; |
| 52 FeatureSwitch extensions_in_action_box; | 55 FeatureSwitch extensions_in_action_box; |
| 53 FeatureSwitch script_badges; | 56 FeatureSwitch script_badges; |
| 54 FeatureSwitch script_bubble; | 57 FeatureSwitch script_bubble; |
| 58 FeatureSwitch sideload_wipeout; |
| 55 FeatureSwitch prompt_for_external_extensions; | 59 FeatureSwitch prompt_for_external_extensions; |
| 56 }; | 60 }; |
| 57 | 61 |
| 58 base::LazyInstance<CommonSwitches> g_common_switches = | 62 base::LazyInstance<CommonSwitches> g_common_switches = |
| 59 LAZY_INSTANCE_INITIALIZER; | 63 LAZY_INSTANCE_INITIALIZER; |
| 60 | 64 |
| 61 } // namespace | 65 } // namespace |
| 62 | 66 |
| 63 | 67 |
| 64 FeatureSwitch* FeatureSwitch::action_box() { | 68 FeatureSwitch* FeatureSwitch::action_box() { |
| 65 return &g_common_switches.Get().action_box; | 69 return &g_common_switches.Get().action_box; |
| 66 } | 70 } |
| 67 FeatureSwitch* FeatureSwitch::easy_off_store_install() { | 71 FeatureSwitch* FeatureSwitch::easy_off_store_install() { |
| 68 return &g_common_switches.Get().easy_off_store_install; | 72 return &g_common_switches.Get().easy_off_store_install; |
| 69 } | 73 } |
| 70 FeatureSwitch* FeatureSwitch::extensions_in_action_box() { | 74 FeatureSwitch* FeatureSwitch::extensions_in_action_box() { |
| 71 return &g_common_switches.Get().extensions_in_action_box; | 75 return &g_common_switches.Get().extensions_in_action_box; |
| 72 } | 76 } |
| 73 FeatureSwitch* FeatureSwitch::script_badges() { | 77 FeatureSwitch* FeatureSwitch::script_badges() { |
| 74 return &g_common_switches.Get().script_badges; | 78 return &g_common_switches.Get().script_badges; |
| 75 } | 79 } |
| 76 FeatureSwitch* FeatureSwitch::script_bubble() { | 80 FeatureSwitch* FeatureSwitch::script_bubble() { |
| 77 return &g_common_switches.Get().script_bubble; | 81 return &g_common_switches.Get().script_bubble; |
| 78 } | 82 } |
| 83 FeatureSwitch* FeatureSwitch::sideload_wipeout() { |
| 84 return &g_common_switches.Get().sideload_wipeout; |
| 85 } |
| 79 FeatureSwitch* FeatureSwitch::prompt_for_external_extensions() { | 86 FeatureSwitch* FeatureSwitch::prompt_for_external_extensions() { |
| 80 return &g_common_switches.Get().prompt_for_external_extensions; | 87 return &g_common_switches.Get().prompt_for_external_extensions; |
| 81 } | 88 } |
| 82 | 89 |
| 83 | 90 |
| 84 FeatureSwitch::ScopedOverride::ScopedOverride(FeatureSwitch* feature, | 91 FeatureSwitch::ScopedOverride::ScopedOverride(FeatureSwitch* feature, |
| 85 bool override_value) | 92 bool override_value) |
| 86 : feature_(feature), | 93 : feature_(feature), |
| 87 previous_value_(feature->GetOverrideValue()) { | 94 previous_value_(feature->GetOverrideValue()) { |
| 88 feature_->SetOverrideValue( | 95 feature_->SetOverrideValue( |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 | 153 |
| 147 void FeatureSwitch::SetOverrideValue(OverrideValue override_value) { | 154 void FeatureSwitch::SetOverrideValue(OverrideValue override_value) { |
| 148 override_value_ = override_value; | 155 override_value_ = override_value; |
| 149 } | 156 } |
| 150 | 157 |
| 151 FeatureSwitch::OverrideValue FeatureSwitch::GetOverrideValue() const { | 158 FeatureSwitch::OverrideValue FeatureSwitch::GetOverrideValue() const { |
| 152 return override_value_; | 159 return override_value_; |
| 153 } | 160 } |
| 154 | 161 |
| 155 } // namespace extensions | 162 } // namespace extensions |
| OLD | NEW |