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 27 matching lines...) Expand all Loading... |
38 FeatureSwitch::DEFAULT_DISABLED), | 38 FeatureSwitch::DEFAULT_DISABLED), |
39 extension_action_redesign( | 39 extension_action_redesign( |
40 switches::kExtensionActionRedesign, | 40 switches::kExtensionActionRedesign, |
41 FeatureSwitch::DEFAULT_DISABLED), | 41 FeatureSwitch::DEFAULT_DISABLED), |
42 scripts_require_action(switches::kScriptsRequireAction, | 42 scripts_require_action(switches::kScriptsRequireAction, |
43 FeatureSwitch::DEFAULT_DISABLED), | 43 FeatureSwitch::DEFAULT_DISABLED), |
44 embedded_extension_options( | 44 embedded_extension_options( |
45 switches::kEmbeddedExtensionOptions, | 45 switches::kEmbeddedExtensionOptions, |
46 FeatureSwitch::DEFAULT_DISABLED), | 46 FeatureSwitch::DEFAULT_DISABLED), |
47 app_view(switches::kAppView, | 47 app_view(switches::kAppView, |
48 FeatureSwitch::DEFAULT_DISABLED) {} | 48 FeatureSwitch::DEFAULT_DISABLED), |
| 49 mime_handler_view(switches::kMimeHandlerView, |
| 50 FeatureSwitch::DEFAULT_DISABLED) {} |
49 | 51 |
50 // 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 |
51 // store. | 53 // store. |
52 FeatureSwitch easy_off_store_install; | 54 FeatureSwitch easy_off_store_install; |
53 | 55 |
54 FeatureSwitch force_dev_mode_highlighting; | 56 FeatureSwitch force_dev_mode_highlighting; |
55 | 57 |
56 // Should we prompt the user before allowing external extensions to install? | 58 // Should we prompt the user before allowing external extensions to install? |
57 // Default is yes. | 59 // Default is yes. |
58 FeatureSwitch prompt_for_external_extensions; | 60 FeatureSwitch prompt_for_external_extensions; |
59 | 61 |
60 FeatureSwitch error_console; | 62 FeatureSwitch error_console; |
61 FeatureSwitch enable_override_bookmarks_ui; | 63 FeatureSwitch enable_override_bookmarks_ui; |
62 FeatureSwitch extension_action_redesign; | 64 FeatureSwitch extension_action_redesign; |
63 FeatureSwitch scripts_require_action; | 65 FeatureSwitch scripts_require_action; |
64 FeatureSwitch embedded_extension_options; | 66 FeatureSwitch embedded_extension_options; |
65 FeatureSwitch app_view; | 67 FeatureSwitch app_view; |
| 68 FeatureSwitch mime_handler_view; |
66 }; | 69 }; |
67 | 70 |
68 base::LazyInstance<CommonSwitches> g_common_switches = | 71 base::LazyInstance<CommonSwitches> g_common_switches = |
69 LAZY_INSTANCE_INITIALIZER; | 72 LAZY_INSTANCE_INITIALIZER; |
70 | 73 |
71 } // namespace | 74 } // namespace |
72 | 75 |
73 FeatureSwitch* FeatureSwitch::force_dev_mode_highlighting() { | 76 FeatureSwitch* FeatureSwitch::force_dev_mode_highlighting() { |
74 return &g_common_switches.Get().force_dev_mode_highlighting; | 77 return &g_common_switches.Get().force_dev_mode_highlighting; |
75 } | 78 } |
(...skipping 14 matching lines...) Expand all Loading... |
90 } | 93 } |
91 FeatureSwitch* FeatureSwitch::scripts_require_action() { | 94 FeatureSwitch* FeatureSwitch::scripts_require_action() { |
92 return &g_common_switches.Get().scripts_require_action; | 95 return &g_common_switches.Get().scripts_require_action; |
93 } | 96 } |
94 FeatureSwitch* FeatureSwitch::embedded_extension_options() { | 97 FeatureSwitch* FeatureSwitch::embedded_extension_options() { |
95 return &g_common_switches.Get().embedded_extension_options; | 98 return &g_common_switches.Get().embedded_extension_options; |
96 } | 99 } |
97 FeatureSwitch* FeatureSwitch::app_view() { | 100 FeatureSwitch* FeatureSwitch::app_view() { |
98 return &g_common_switches.Get().app_view; | 101 return &g_common_switches.Get().app_view; |
99 } | 102 } |
| 103 FeatureSwitch* FeatureSwitch::mime_handler_view() { |
| 104 return &g_common_switches.Get().mime_handler_view; |
| 105 } |
100 | 106 |
101 FeatureSwitch::ScopedOverride::ScopedOverride(FeatureSwitch* feature, | 107 FeatureSwitch::ScopedOverride::ScopedOverride(FeatureSwitch* feature, |
102 bool override_value) | 108 bool override_value) |
103 : feature_(feature), | 109 : feature_(feature), |
104 previous_value_(feature->GetOverrideValue()) { | 110 previous_value_(feature->GetOverrideValue()) { |
105 feature_->SetOverrideValue( | 111 feature_->SetOverrideValue( |
106 override_value ? OVERRIDE_ENABLED : OVERRIDE_DISABLED); | 112 override_value ? OVERRIDE_ENABLED : OVERRIDE_DISABLED); |
107 } | 113 } |
108 | 114 |
109 FeatureSwitch::ScopedOverride::~ScopedOverride() { | 115 FeatureSwitch::ScopedOverride::~ScopedOverride() { |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 | 174 |
169 void FeatureSwitch::SetOverrideValue(OverrideValue override_value) { | 175 void FeatureSwitch::SetOverrideValue(OverrideValue override_value) { |
170 override_value_ = override_value; | 176 override_value_ = override_value; |
171 } | 177 } |
172 | 178 |
173 FeatureSwitch::OverrideValue FeatureSwitch::GetOverrideValue() const { | 179 FeatureSwitch::OverrideValue FeatureSwitch::GetOverrideValue() const { |
174 return override_value_; | 180 return override_value_; |
175 } | 181 } |
176 | 182 |
177 } // namespace extensions | 183 } // namespace extensions |
OLD | NEW |