| 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 default_value_ = default_value == DEFAULT_ENABLED; | 103 default_value_ = default_value == DEFAULT_ENABLED; |
| 104 override_value_ = OVERRIDE_NONE; | 104 override_value_ = OVERRIDE_NONE; |
| 105 } | 105 } |
| 106 | 106 |
| 107 bool FeatureSwitch::IsEnabled() const { | 107 bool FeatureSwitch::IsEnabled() const { |
| 108 if (override_value_ != OVERRIDE_NONE) | 108 if (override_value_ != OVERRIDE_NONE) |
| 109 return override_value_ == OVERRIDE_ENABLED; | 109 return override_value_ == OVERRIDE_ENABLED; |
| 110 | 110 |
| 111 std::string temp = command_line_->GetSwitchValueASCII(switch_name_); | 111 std::string temp = command_line_->GetSwitchValueASCII(switch_name_); |
| 112 std::string switch_value; | 112 std::string switch_value; |
| 113 TrimWhitespaceASCII(temp, TRIM_ALL, &switch_value); | 113 base::TrimWhitespaceASCII(temp, base::TRIM_ALL, &switch_value); |
| 114 | 114 |
| 115 if (switch_value == "1") | 115 if (switch_value == "1") |
| 116 return true; | 116 return true; |
| 117 | 117 |
| 118 if (switch_value == "0") | 118 if (switch_value == "0") |
| 119 return false; | 119 return false; |
| 120 | 120 |
| 121 if (!default_value_ && command_line_->HasSwitch(GetLegacyEnableFlag())) | 121 if (!default_value_ && command_line_->HasSwitch(GetLegacyEnableFlag())) |
| 122 return true; | 122 return true; |
| 123 | 123 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 137 | 137 |
| 138 void FeatureSwitch::SetOverrideValue(OverrideValue override_value) { | 138 void FeatureSwitch::SetOverrideValue(OverrideValue override_value) { |
| 139 override_value_ = override_value; | 139 override_value_ = override_value; |
| 140 } | 140 } |
| 141 | 141 |
| 142 FeatureSwitch::OverrideValue FeatureSwitch::GetOverrideValue() const { | 142 FeatureSwitch::OverrideValue FeatureSwitch::GetOverrideValue() const { |
| 143 return override_value_; | 143 return override_value_; |
| 144 } | 144 } |
| 145 | 145 |
| 146 } // namespace extensions | 146 } // namespace extensions |
| OLD | NEW |