Chromium Code Reviews| Index: chrome/common/origin_trials/origin_trial_key_manager.cc |
| diff --git a/chrome/common/origin_trials/origin_trial_key_manager.cc b/chrome/common/origin_trials/origin_trial_key_manager.cc |
| index 12467d29e0300b0297cfa816715ff086e5894c25..42df061f284cda738dc5d4d8ab97168804b14527 100644 |
| --- a/chrome/common/origin_trials/origin_trial_key_manager.cc |
| +++ b/chrome/common/origin_trials/origin_trial_key_manager.cc |
| @@ -6,7 +6,10 @@ |
| #include <stdint.h> |
| +#include <vector> |
| + |
| #include "base/base64.h" |
| +#include "base/strings/string_split.h" |
| // This is the default public key used for validating signatures. |
| // TODO(iclelland): Provide a mechanism to allow for multiple signing keys. |
| @@ -38,3 +41,17 @@ bool OriginTrialKeyManager::SetPublicKeyFromASCIIString( |
| base::StringPiece OriginTrialKeyManager::GetPublicKey() const { |
| return base::StringPiece(public_key_); |
| } |
| + |
| +bool OriginTrialKeyManager::SetDisabledFeatures( |
| + const std::string& disabled_feature_list) { |
| + std::vector<std::string> features = |
|
Sorin Jianu
2016/06/07 17:20:24
can be const.
iclelland
2016/06/08 13:37:56
Done.
|
| + base::SplitString(disabled_feature_list, "|", base::TRIM_WHITESPACE, |
| + base::SPLIT_WANT_NONEMPTY); |
| + for (std::string feature : features) |
|
Sorin Jianu
2016/06/07 17:20:24
maybe use ref to const or const auto& for the rang
iclelland
2016/06/08 13:37:56
Done.
|
| + disabled_features_.insert(feature); |
|
chasej
2016/06/07 15:51:31
Is this intended to append to the existing set of
iclelland
2016/06/08 13:37:56
That's a good point. It should probably clear the
|
| + return true; |
| +} |
| + |
| +bool OriginTrialKeyManager::IsFeatureDisabled(base::StringPiece feature) { |
| + return disabled_features_.count(feature.as_string()) > 0; |
| +} |