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 25 matching lines...) Expand all Loading... |
36 enable_override_bookmarks_ui( | 36 enable_override_bookmarks_ui( |
37 switches::kEnableOverrideBookmarksUI, | 37 switches::kEnableOverrideBookmarksUI, |
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, |
| 48 FeatureSwitch::DEFAULT_DISABLED) {} |
47 | 49 |
48 // Enables extensions to be easily installed from sites other than the web | 50 // Enables extensions to be easily installed from sites other than the web |
49 // store. | 51 // store. |
50 FeatureSwitch easy_off_store_install; | 52 FeatureSwitch easy_off_store_install; |
51 | 53 |
52 FeatureSwitch force_dev_mode_highlighting; | 54 FeatureSwitch force_dev_mode_highlighting; |
53 | 55 |
54 // Should we prompt the user before allowing external extensions to install? | 56 // Should we prompt the user before allowing external extensions to install? |
55 // Default is yes. | 57 // Default is yes. |
56 FeatureSwitch prompt_for_external_extensions; | 58 FeatureSwitch prompt_for_external_extensions; |
57 | 59 |
58 FeatureSwitch error_console; | 60 FeatureSwitch error_console; |
59 FeatureSwitch enable_override_bookmarks_ui; | 61 FeatureSwitch enable_override_bookmarks_ui; |
60 FeatureSwitch extension_action_redesign; | 62 FeatureSwitch extension_action_redesign; |
61 FeatureSwitch scripts_require_action; | 63 FeatureSwitch scripts_require_action; |
62 FeatureSwitch embedded_extension_options; | 64 FeatureSwitch embedded_extension_options; |
| 65 FeatureSwitch app_view; |
63 }; | 66 }; |
64 | 67 |
65 base::LazyInstance<CommonSwitches> g_common_switches = | 68 base::LazyInstance<CommonSwitches> g_common_switches = |
66 LAZY_INSTANCE_INITIALIZER; | 69 LAZY_INSTANCE_INITIALIZER; |
67 | 70 |
68 } // namespace | 71 } // namespace |
69 | 72 |
70 FeatureSwitch* FeatureSwitch::force_dev_mode_highlighting() { | 73 FeatureSwitch* FeatureSwitch::force_dev_mode_highlighting() { |
71 return &g_common_switches.Get().force_dev_mode_highlighting; | 74 return &g_common_switches.Get().force_dev_mode_highlighting; |
72 } | 75 } |
(...skipping 11 matching lines...) Expand all Loading... |
84 } | 87 } |
85 FeatureSwitch* FeatureSwitch::extension_action_redesign() { | 88 FeatureSwitch* FeatureSwitch::extension_action_redesign() { |
86 return &g_common_switches.Get().extension_action_redesign; | 89 return &g_common_switches.Get().extension_action_redesign; |
87 } | 90 } |
88 FeatureSwitch* FeatureSwitch::scripts_require_action() { | 91 FeatureSwitch* FeatureSwitch::scripts_require_action() { |
89 return &g_common_switches.Get().scripts_require_action; | 92 return &g_common_switches.Get().scripts_require_action; |
90 } | 93 } |
91 FeatureSwitch* FeatureSwitch::embedded_extension_options() { | 94 FeatureSwitch* FeatureSwitch::embedded_extension_options() { |
92 return &g_common_switches.Get().embedded_extension_options; | 95 return &g_common_switches.Get().embedded_extension_options; |
93 } | 96 } |
| 97 FeatureSwitch* FeatureSwitch::app_view() { |
| 98 return &g_common_switches.Get().app_view; |
| 99 } |
94 | 100 |
95 FeatureSwitch::ScopedOverride::ScopedOverride(FeatureSwitch* feature, | 101 FeatureSwitch::ScopedOverride::ScopedOverride(FeatureSwitch* feature, |
96 bool override_value) | 102 bool override_value) |
97 : feature_(feature), | 103 : feature_(feature), |
98 previous_value_(feature->GetOverrideValue()) { | 104 previous_value_(feature->GetOverrideValue()) { |
99 feature_->SetOverrideValue( | 105 feature_->SetOverrideValue( |
100 override_value ? OVERRIDE_ENABLED : OVERRIDE_DISABLED); | 106 override_value ? OVERRIDE_ENABLED : OVERRIDE_DISABLED); |
101 } | 107 } |
102 | 108 |
103 FeatureSwitch::ScopedOverride::~ScopedOverride() { | 109 FeatureSwitch::ScopedOverride::~ScopedOverride() { |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 | 168 |
163 void FeatureSwitch::SetOverrideValue(OverrideValue override_value) { | 169 void FeatureSwitch::SetOverrideValue(OverrideValue override_value) { |
164 override_value_ = override_value; | 170 override_value_ = override_value; |
165 } | 171 } |
166 | 172 |
167 FeatureSwitch::OverrideValue FeatureSwitch::GetOverrideValue() const { | 173 FeatureSwitch::OverrideValue FeatureSwitch::GetOverrideValue() const { |
168 return override_value_; | 174 return override_value_; |
169 } | 175 } |
170 | 176 |
171 } // namespace extensions | 177 } // namespace extensions |
OLD | NEW |