| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 extension_action_redesign_override(switches::kExtensionActionRedesign, | 48 extension_action_redesign_override(switches::kExtensionActionRedesign, |
| 49 FeatureSwitch::DEFAULT_ENABLED), | 49 FeatureSwitch::DEFAULT_ENABLED), |
| 50 scripts_require_action(switches::kScriptsRequireAction, | 50 scripts_require_action(switches::kScriptsRequireAction, |
| 51 FeatureSwitch::DEFAULT_DISABLED), | 51 FeatureSwitch::DEFAULT_DISABLED), |
| 52 embedded_extension_options(switches::kEmbeddedExtensionOptions, | 52 embedded_extension_options(switches::kEmbeddedExtensionOptions, |
| 53 FeatureSwitch::DEFAULT_DISABLED), | 53 FeatureSwitch::DEFAULT_DISABLED), |
| 54 trace_app_source(switches::kTraceAppSource, | 54 trace_app_source(switches::kTraceAppSource, |
| 55 FeatureSwitch::DEFAULT_ENABLED), | 55 FeatureSwitch::DEFAULT_ENABLED), |
| 56 media_router(kMediaRouterFlag, | 56 media_router(kMediaRouterFlag, |
| 57 kEnableMediaRouterExperiment, | 57 kEnableMediaRouterExperiment, |
| 58 FeatureSwitch::DEFAULT_DISABLED) { | 58 FeatureSwitch::DEFAULT_DISABLED), |
| 59 webrequest_ssl_info(switches::kWebrequestSSLInfo, |
| 60 FeatureSwitch::DEFAULT_DISABLED) { |
| 59 } | 61 } |
| 60 | 62 |
| 61 // Enables extensions to be easily installed from sites other than the web | 63 // Enables extensions to be easily installed from sites other than the web |
| 62 // store. | 64 // store. |
| 63 FeatureSwitch easy_off_store_install; | 65 FeatureSwitch easy_off_store_install; |
| 64 | 66 |
| 65 FeatureSwitch force_dev_mode_highlighting; | 67 FeatureSwitch force_dev_mode_highlighting; |
| 66 | 68 |
| 67 // Should we prompt the user before allowing external extensions to install? | 69 // Should we prompt the user before allowing external extensions to install? |
| 68 // Default is yes. | 70 // Default is yes. |
| 69 FeatureSwitch prompt_for_external_extensions; | 71 FeatureSwitch prompt_for_external_extensions; |
| 70 | 72 |
| 71 FeatureSwitch error_console; | 73 FeatureSwitch error_console; |
| 72 FeatureSwitch enable_override_bookmarks_ui; | 74 FeatureSwitch enable_override_bookmarks_ui; |
| 73 FeatureSwitch extension_action_redesign; | 75 FeatureSwitch extension_action_redesign; |
| 74 FeatureSwitch extension_action_redesign_override; | 76 FeatureSwitch extension_action_redesign_override; |
| 75 FeatureSwitch scripts_require_action; | 77 FeatureSwitch scripts_require_action; |
| 76 FeatureSwitch embedded_extension_options; | 78 FeatureSwitch embedded_extension_options; |
| 77 FeatureSwitch trace_app_source; | 79 FeatureSwitch trace_app_source; |
| 78 FeatureSwitch media_router; | 80 FeatureSwitch media_router; |
| 81 FeatureSwitch webrequest_ssl_info; |
| 79 }; | 82 }; |
| 80 | 83 |
| 81 base::LazyInstance<CommonSwitches> g_common_switches = | 84 base::LazyInstance<CommonSwitches> g_common_switches = |
| 82 LAZY_INSTANCE_INITIALIZER; | 85 LAZY_INSTANCE_INITIALIZER; |
| 83 | 86 |
| 84 } // namespace | 87 } // namespace |
| 85 | 88 |
| 86 FeatureSwitch* FeatureSwitch::force_dev_mode_highlighting() { | 89 FeatureSwitch* FeatureSwitch::force_dev_mode_highlighting() { |
| 87 return &g_common_switches.Get().force_dev_mode_highlighting; | 90 return &g_common_switches.Get().force_dev_mode_highlighting; |
| 88 } | 91 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 116 } | 119 } |
| 117 FeatureSwitch* FeatureSwitch::embedded_extension_options() { | 120 FeatureSwitch* FeatureSwitch::embedded_extension_options() { |
| 118 return &g_common_switches.Get().embedded_extension_options; | 121 return &g_common_switches.Get().embedded_extension_options; |
| 119 } | 122 } |
| 120 FeatureSwitch* FeatureSwitch::trace_app_source() { | 123 FeatureSwitch* FeatureSwitch::trace_app_source() { |
| 121 return &g_common_switches.Get().trace_app_source; | 124 return &g_common_switches.Get().trace_app_source; |
| 122 } | 125 } |
| 123 FeatureSwitch* FeatureSwitch::media_router() { | 126 FeatureSwitch* FeatureSwitch::media_router() { |
| 124 return &g_common_switches.Get().media_router; | 127 return &g_common_switches.Get().media_router; |
| 125 } | 128 } |
| 129 FeatureSwitch* FeatureSwitch::webrequest_ssl_info() { |
| 130 return &g_common_switches.Get().webrequest_ssl_info; |
| 131 } |
| 126 | 132 |
| 127 FeatureSwitch::ScopedOverride::ScopedOverride(FeatureSwitch* feature, | 133 FeatureSwitch::ScopedOverride::ScopedOverride(FeatureSwitch* feature, |
| 128 bool override_value) | 134 bool override_value) |
| 129 : feature_(feature), | 135 : feature_(feature), |
| 130 previous_value_(feature->GetOverrideValue()) { | 136 previous_value_(feature->GetOverrideValue()) { |
| 131 feature_->SetOverrideValue( | 137 feature_->SetOverrideValue( |
| 132 override_value ? OVERRIDE_ENABLED : OVERRIDE_DISABLED); | 138 override_value ? OVERRIDE_ENABLED : OVERRIDE_DISABLED); |
| 133 } | 139 } |
| 134 | 140 |
| 135 FeatureSwitch::ScopedOverride::~ScopedOverride() { | 141 FeatureSwitch::ScopedOverride::~ScopedOverride() { |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 | 221 |
| 216 void FeatureSwitch::SetOverrideValue(OverrideValue override_value) { | 222 void FeatureSwitch::SetOverrideValue(OverrideValue override_value) { |
| 217 override_value_ = override_value; | 223 override_value_ = override_value; |
| 218 } | 224 } |
| 219 | 225 |
| 220 FeatureSwitch::OverrideValue FeatureSwitch::GetOverrideValue() const { | 226 FeatureSwitch::OverrideValue FeatureSwitch::GetOverrideValue() const { |
| 221 return override_value_; | 227 return override_value_; |
| 222 } | 228 } |
| 223 | 229 |
| 224 } // namespace extensions | 230 } // namespace extensions |
| OLD | NEW |