| 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 18 matching lines...) Expand all Loading... |
| 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( | 34 sideload_wipeout( |
| 35 switches::kSideloadWipeout, | 35 switches::kSideloadWipeout, |
| 36 FeatureSwitch::DEFAULT_DISABLED), | 36 FeatureSwitch::DEFAULT_DISABLED), |
| 37 prompt_for_external_extensions( | 37 prompt_for_external_extensions( |
| 38 switches::kPromptForExternalExtensions, | 38 switches::kPromptForExternalExtensions, |
| 39 FeatureSwitch::DEFAULT_ENABLED), |
| 40 tab_capture( |
| 41 switches::kTabCapture, |
| 39 FeatureSwitch::DEFAULT_DISABLED) | 42 FeatureSwitch::DEFAULT_DISABLED) |
| 40 { | 43 { |
| 41 // Disabling easy off-store installation is not yet implemented for Aura. Not | 44 // Disabling easy off-store installation is not yet implemented for Aura. Not |
| 42 // sure what the Aura equivalent for this UI is. | 45 // sure what the Aura equivalent for this UI is. |
| 43 #if defined(USE_AURA) | 46 #if defined(USE_AURA) |
| 44 easy_off_store_install.SetOverrideValue(FeatureSwitch::OVERRIDE_ENABLED); | 47 easy_off_store_install.SetOverrideValue(FeatureSwitch::OVERRIDE_ENABLED); |
| 45 #endif | 48 #endif |
| 46 | 49 |
| 47 if (!action_box.IsEnabled()){ | 50 if (!action_box.IsEnabled()){ |
| 48 extensions_in_action_box.SetOverrideValue( | 51 extensions_in_action_box.SetOverrideValue( |
| 49 FeatureSwitch::OVERRIDE_DISABLED); | 52 FeatureSwitch::OVERRIDE_DISABLED); |
| 50 } | 53 } |
| 51 } | 54 } |
| 52 | 55 |
| 53 FeatureSwitch action_box; | 56 FeatureSwitch action_box; |
| 54 FeatureSwitch easy_off_store_install; | 57 FeatureSwitch easy_off_store_install; |
| 55 FeatureSwitch extensions_in_action_box; | 58 FeatureSwitch extensions_in_action_box; |
| 56 FeatureSwitch script_badges; | 59 FeatureSwitch script_badges; |
| 57 FeatureSwitch script_bubble; | 60 FeatureSwitch script_bubble; |
| 58 FeatureSwitch sideload_wipeout; | 61 FeatureSwitch sideload_wipeout; |
| 59 FeatureSwitch prompt_for_external_extensions; | 62 FeatureSwitch prompt_for_external_extensions; |
| 63 FeatureSwitch tab_capture; |
| 60 }; | 64 }; |
| 61 | 65 |
| 62 base::LazyInstance<CommonSwitches> g_common_switches = | 66 base::LazyInstance<CommonSwitches> g_common_switches = |
| 63 LAZY_INSTANCE_INITIALIZER; | 67 LAZY_INSTANCE_INITIALIZER; |
| 64 | 68 |
| 65 } // namespace | 69 } // namespace |
| 66 | 70 |
| 67 | 71 |
| 68 FeatureSwitch* FeatureSwitch::action_box() { | 72 FeatureSwitch* FeatureSwitch::action_box() { |
| 69 return &g_common_switches.Get().action_box; | 73 return &g_common_switches.Get().action_box; |
| 70 } | 74 } |
| 71 FeatureSwitch* FeatureSwitch::easy_off_store_install() { | 75 FeatureSwitch* FeatureSwitch::easy_off_store_install() { |
| 72 return &g_common_switches.Get().easy_off_store_install; | 76 return &g_common_switches.Get().easy_off_store_install; |
| 73 } | 77 } |
| 74 FeatureSwitch* FeatureSwitch::extensions_in_action_box() { | 78 FeatureSwitch* FeatureSwitch::extensions_in_action_box() { |
| 75 return &g_common_switches.Get().extensions_in_action_box; | 79 return &g_common_switches.Get().extensions_in_action_box; |
| 76 } | 80 } |
| 77 FeatureSwitch* FeatureSwitch::script_badges() { | 81 FeatureSwitch* FeatureSwitch::script_badges() { |
| 78 return &g_common_switches.Get().script_badges; | 82 return &g_common_switches.Get().script_badges; |
| 79 } | 83 } |
| 80 FeatureSwitch* FeatureSwitch::script_bubble() { | 84 FeatureSwitch* FeatureSwitch::script_bubble() { |
| 81 return &g_common_switches.Get().script_bubble; | 85 return &g_common_switches.Get().script_bubble; |
| 82 } | 86 } |
| 83 FeatureSwitch* FeatureSwitch::sideload_wipeout() { | 87 FeatureSwitch* FeatureSwitch::sideload_wipeout() { |
| 84 return &g_common_switches.Get().sideload_wipeout; | 88 return &g_common_switches.Get().sideload_wipeout; |
| 85 } | 89 } |
| 86 FeatureSwitch* FeatureSwitch::prompt_for_external_extensions() { | 90 FeatureSwitch* FeatureSwitch::prompt_for_external_extensions() { |
| 87 return &g_common_switches.Get().prompt_for_external_extensions; | 91 return &g_common_switches.Get().prompt_for_external_extensions; |
| 88 } | 92 } |
| 93 FeatureSwitch* FeatureSwitch::tab_capture() { |
| 94 return &g_common_switches.Get().tab_capture; |
| 95 } |
| 89 | 96 |
| 90 | 97 |
| 91 FeatureSwitch::ScopedOverride::ScopedOverride(FeatureSwitch* feature, | 98 FeatureSwitch::ScopedOverride::ScopedOverride(FeatureSwitch* feature, |
| 92 bool override_value) | 99 bool override_value) |
| 93 : feature_(feature), | 100 : feature_(feature), |
| 94 previous_value_(feature->GetOverrideValue()) { | 101 previous_value_(feature->GetOverrideValue()) { |
| 95 feature_->SetOverrideValue( | 102 feature_->SetOverrideValue( |
| 96 override_value ? OVERRIDE_ENABLED : OVERRIDE_DISABLED); | 103 override_value ? OVERRIDE_ENABLED : OVERRIDE_DISABLED); |
| 97 } | 104 } |
| 98 | 105 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 | 160 |
| 154 void FeatureSwitch::SetOverrideValue(OverrideValue override_value) { | 161 void FeatureSwitch::SetOverrideValue(OverrideValue override_value) { |
| 155 override_value_ = override_value; | 162 override_value_ = override_value; |
| 156 } | 163 } |
| 157 | 164 |
| 158 FeatureSwitch::OverrideValue FeatureSwitch::GetOverrideValue() const { | 165 FeatureSwitch::OverrideValue FeatureSwitch::GetOverrideValue() const { |
| 159 return override_value_; | 166 return override_value_; |
| 160 } | 167 } |
| 161 | 168 |
| 162 } // namespace extensions | 169 } // namespace extensions |
| OLD | NEW |