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/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 11 matching lines...) Expand all Loading... |
22 FeatureSwitch::DEFAULT_DISABLED), | 22 FeatureSwitch::DEFAULT_DISABLED), |
23 script_badges( | 23 script_badges( |
24 switches::kScriptBadges, | 24 switches::kScriptBadges, |
25 FeatureSwitch::DEFAULT_DISABLED), | 25 FeatureSwitch::DEFAULT_DISABLED), |
26 script_bubble( | 26 script_bubble( |
27 switches::kScriptBubble, | 27 switches::kScriptBubble, |
28 FeatureSwitch::DEFAULT_DISABLED), | 28 FeatureSwitch::DEFAULT_DISABLED), |
29 prompt_for_external_extensions( | 29 prompt_for_external_extensions( |
30 switches::kPromptForExternalExtensions, | 30 switches::kPromptForExternalExtensions, |
31 #if defined(OS_WIN) | 31 #if defined(OS_WIN) |
32 FeatureSwitch::DEFAULT_ENABLED), | 32 FeatureSwitch::DEFAULT_ENABLED) {} |
33 #else | 33 #else |
34 FeatureSwitch::DEFAULT_DISABLED), | 34 FeatureSwitch::DEFAULT_DISABLED) {} |
35 #endif | 35 #endif |
36 tab_capture( | |
37 switches::kTabCapture, | |
38 FeatureSwitch::DEFAULT_ENABLED) {} | |
39 | 36 |
40 FeatureSwitch easy_off_store_install; | 37 FeatureSwitch easy_off_store_install; |
41 FeatureSwitch script_badges; | 38 FeatureSwitch script_badges; |
42 FeatureSwitch script_bubble; | 39 FeatureSwitch script_bubble; |
43 FeatureSwitch prompt_for_external_extensions; | 40 FeatureSwitch prompt_for_external_extensions; |
44 FeatureSwitch tab_capture; | |
45 }; | 41 }; |
46 | 42 |
47 base::LazyInstance<CommonSwitches> g_common_switches = | 43 base::LazyInstance<CommonSwitches> g_common_switches = |
48 LAZY_INSTANCE_INITIALIZER; | 44 LAZY_INSTANCE_INITIALIZER; |
49 | 45 |
50 } // namespace | 46 } // namespace |
51 | 47 |
52 FeatureSwitch* FeatureSwitch::easy_off_store_install() { | 48 FeatureSwitch* FeatureSwitch::easy_off_store_install() { |
53 return &g_common_switches.Get().easy_off_store_install; | 49 return &g_common_switches.Get().easy_off_store_install; |
54 } | 50 } |
55 FeatureSwitch* FeatureSwitch::script_badges() { | 51 FeatureSwitch* FeatureSwitch::script_badges() { |
56 return &g_common_switches.Get().script_badges; | 52 return &g_common_switches.Get().script_badges; |
57 } | 53 } |
58 FeatureSwitch* FeatureSwitch::script_bubble() { | 54 FeatureSwitch* FeatureSwitch::script_bubble() { |
59 return &g_common_switches.Get().script_bubble; | 55 return &g_common_switches.Get().script_bubble; |
60 } | 56 } |
61 FeatureSwitch* FeatureSwitch::prompt_for_external_extensions() { | 57 FeatureSwitch* FeatureSwitch::prompt_for_external_extensions() { |
62 return &g_common_switches.Get().prompt_for_external_extensions; | 58 return &g_common_switches.Get().prompt_for_external_extensions; |
63 } | 59 } |
64 FeatureSwitch* FeatureSwitch::tab_capture() { | |
65 return &g_common_switches.Get().tab_capture; | |
66 } | |
67 | |
68 | 60 |
69 FeatureSwitch::ScopedOverride::ScopedOverride(FeatureSwitch* feature, | 61 FeatureSwitch::ScopedOverride::ScopedOverride(FeatureSwitch* feature, |
70 bool override_value) | 62 bool override_value) |
71 : feature_(feature), | 63 : feature_(feature), |
72 previous_value_(feature->GetOverrideValue()) { | 64 previous_value_(feature->GetOverrideValue()) { |
73 feature_->SetOverrideValue( | 65 feature_->SetOverrideValue( |
74 override_value ? OVERRIDE_ENABLED : OVERRIDE_DISABLED); | 66 override_value ? OVERRIDE_ENABLED : OVERRIDE_DISABLED); |
75 } | 67 } |
76 | 68 |
77 FeatureSwitch::ScopedOverride::~ScopedOverride() { | 69 FeatureSwitch::ScopedOverride::~ScopedOverride() { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 | 123 |
132 void FeatureSwitch::SetOverrideValue(OverrideValue override_value) { | 124 void FeatureSwitch::SetOverrideValue(OverrideValue override_value) { |
133 override_value_ = override_value; | 125 override_value_ = override_value; |
134 } | 126 } |
135 | 127 |
136 FeatureSwitch::OverrideValue FeatureSwitch::GetOverrideValue() const { | 128 FeatureSwitch::OverrideValue FeatureSwitch::GetOverrideValue() const { |
137 return override_value_; | 129 return override_value_; |
138 } | 130 } |
139 | 131 |
140 } // namespace extensions | 132 } // namespace extensions |
OLD | NEW |