| 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 17 matching lines...) Expand all Loading... |
| 28 #endif | 28 #endif |
| 29 error_console(switches::kErrorConsole, FeatureSwitch::DEFAULT_DISABLED), | 29 error_console(switches::kErrorConsole, FeatureSwitch::DEFAULT_DISABLED), |
| 30 enable_override_bookmarks_ui(switches::kEnableOverrideBookmarksUI, | 30 enable_override_bookmarks_ui(switches::kEnableOverrideBookmarksUI, |
| 31 FeatureSwitch::DEFAULT_DISABLED), | 31 FeatureSwitch::DEFAULT_DISABLED), |
| 32 extension_action_redesign(switches::kExtensionActionRedesign, | 32 extension_action_redesign(switches::kExtensionActionRedesign, |
| 33 FeatureSwitch::DEFAULT_DISABLED), | 33 FeatureSwitch::DEFAULT_DISABLED), |
| 34 scripts_require_action(switches::kScriptsRequireAction, | 34 scripts_require_action(switches::kScriptsRequireAction, |
| 35 FeatureSwitch::DEFAULT_DISABLED), | 35 FeatureSwitch::DEFAULT_DISABLED), |
| 36 embedded_extension_options(switches::kEmbeddedExtensionOptions, | 36 embedded_extension_options(switches::kEmbeddedExtensionOptions, |
| 37 FeatureSwitch::DEFAULT_DISABLED), | 37 FeatureSwitch::DEFAULT_DISABLED), |
| 38 worker_frame(switches::kWorkerFrame, FeatureSwitch::DEFAULT_DISABLED), | 38 surface_worker(switches::kSurfaceWorker, |
| 39 FeatureSwitch::DEFAULT_DISABLED), |
| 39 trace_app_source(switches::kTraceAppSource, | 40 trace_app_source(switches::kTraceAppSource, |
| 40 FeatureSwitch::DEFAULT_DISABLED) { | 41 FeatureSwitch::DEFAULT_DISABLED) { |
| 41 } | 42 } |
| 42 | 43 |
| 43 // Enables extensions to be easily installed from sites other than the web | 44 // Enables extensions to be easily installed from sites other than the web |
| 44 // store. | 45 // store. |
| 45 FeatureSwitch easy_off_store_install; | 46 FeatureSwitch easy_off_store_install; |
| 46 | 47 |
| 47 FeatureSwitch force_dev_mode_highlighting; | 48 FeatureSwitch force_dev_mode_highlighting; |
| 48 | 49 |
| 49 // Should we prompt the user before allowing external extensions to install? | 50 // Should we prompt the user before allowing external extensions to install? |
| 50 // Default is yes. | 51 // Default is yes. |
| 51 FeatureSwitch prompt_for_external_extensions; | 52 FeatureSwitch prompt_for_external_extensions; |
| 52 | 53 |
| 53 FeatureSwitch error_console; | 54 FeatureSwitch error_console; |
| 54 FeatureSwitch enable_override_bookmarks_ui; | 55 FeatureSwitch enable_override_bookmarks_ui; |
| 55 FeatureSwitch extension_action_redesign; | 56 FeatureSwitch extension_action_redesign; |
| 56 FeatureSwitch scripts_require_action; | 57 FeatureSwitch scripts_require_action; |
| 57 FeatureSwitch embedded_extension_options; | 58 FeatureSwitch embedded_extension_options; |
| 58 FeatureSwitch worker_frame; | 59 FeatureSwitch surface_worker; |
| 59 FeatureSwitch trace_app_source; | 60 FeatureSwitch trace_app_source; |
| 60 }; | 61 }; |
| 61 | 62 |
| 62 base::LazyInstance<CommonSwitches> g_common_switches = | 63 base::LazyInstance<CommonSwitches> g_common_switches = |
| 63 LAZY_INSTANCE_INITIALIZER; | 64 LAZY_INSTANCE_INITIALIZER; |
| 64 | 65 |
| 65 } // namespace | 66 } // namespace |
| 66 | 67 |
| 67 FeatureSwitch* FeatureSwitch::force_dev_mode_highlighting() { | 68 FeatureSwitch* FeatureSwitch::force_dev_mode_highlighting() { |
| 68 return &g_common_switches.Get().force_dev_mode_highlighting; | 69 return &g_common_switches.Get().force_dev_mode_highlighting; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 81 } | 82 } |
| 82 FeatureSwitch* FeatureSwitch::extension_action_redesign() { | 83 FeatureSwitch* FeatureSwitch::extension_action_redesign() { |
| 83 return &g_common_switches.Get().extension_action_redesign; | 84 return &g_common_switches.Get().extension_action_redesign; |
| 84 } | 85 } |
| 85 FeatureSwitch* FeatureSwitch::scripts_require_action() { | 86 FeatureSwitch* FeatureSwitch::scripts_require_action() { |
| 86 return &g_common_switches.Get().scripts_require_action; | 87 return &g_common_switches.Get().scripts_require_action; |
| 87 } | 88 } |
| 88 FeatureSwitch* FeatureSwitch::embedded_extension_options() { | 89 FeatureSwitch* FeatureSwitch::embedded_extension_options() { |
| 89 return &g_common_switches.Get().embedded_extension_options; | 90 return &g_common_switches.Get().embedded_extension_options; |
| 90 } | 91 } |
| 91 FeatureSwitch* FeatureSwitch::worker_frame() { | 92 FeatureSwitch* FeatureSwitch::surface_worker() { |
| 92 return &g_common_switches.Get().worker_frame; | 93 return &g_common_switches.Get().surface_worker; |
| 93 } | 94 } |
| 94 FeatureSwitch* FeatureSwitch::trace_app_source() { | 95 FeatureSwitch* FeatureSwitch::trace_app_source() { |
| 95 return &g_common_switches.Get().trace_app_source; | 96 return &g_common_switches.Get().trace_app_source; |
| 96 } | 97 } |
| 97 | 98 |
| 98 FeatureSwitch::ScopedOverride::ScopedOverride(FeatureSwitch* feature, | 99 FeatureSwitch::ScopedOverride::ScopedOverride(FeatureSwitch* feature, |
| 99 bool override_value) | 100 bool override_value) |
| 100 : feature_(feature), | 101 : feature_(feature), |
| 101 previous_value_(feature->GetOverrideValue()) { | 102 previous_value_(feature->GetOverrideValue()) { |
| 102 feature_->SetOverrideValue( | 103 feature_->SetOverrideValue( |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 | 166 |
| 166 void FeatureSwitch::SetOverrideValue(OverrideValue override_value) { | 167 void FeatureSwitch::SetOverrideValue(OverrideValue override_value) { |
| 167 override_value_ = override_value; | 168 override_value_ = override_value; |
| 168 } | 169 } |
| 169 | 170 |
| 170 FeatureSwitch::OverrideValue FeatureSwitch::GetOverrideValue() const { | 171 FeatureSwitch::OverrideValue FeatureSwitch::GetOverrideValue() const { |
| 171 return override_value_; | 172 return override_value_; |
| 172 } | 173 } |
| 173 | 174 |
| 174 } // namespace extensions | 175 } // namespace extensions |
| OLD | NEW |