Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4951)

Unified Diff: chrome/common/origin_trials/origin_trial_key_manager.cc

Issue 1741783002: Add disabled origin trial feature list (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ef-finch
Patch Set: Separate the introduction of preference-persistence into a different CL Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;
+}

Powered by Google App Engine
This is Rietveld 408576698