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

Unified Diff: content/common/origin_trials/trial_token_validator.cc

Issue 1858763003: Change origin trial token format (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase; fix param name Created 4 years, 8 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: content/common/origin_trials/trial_token_validator.cc
diff --git a/content/common/origin_trials/trial_token_validator.cc b/content/common/origin_trials/trial_token_validator.cc
index 2dd4d8aaa46db22c5a7be6f2ed8f23eefcdfee02..cced57b58dd91243424d20124e3fda31166401ef 100644
--- a/content/common/origin_trials/trial_token_validator.cc
+++ b/content/common/origin_trials/trial_token_validator.cc
@@ -13,16 +13,17 @@ namespace content {
bool TrialTokenValidator::ValidateToken(const std::string& token,
const url::Origin& origin,
base::StringPiece featureName) {
Marijn Kruisselbrink 2016/04/13 23:07:37 nit (and unrelated to this CL): featureName should
iclelland 2016/04/14 16:15:22 Totally should. It must have snuck in from the bli
- std::unique_ptr<TrialToken> trial_token = TrialToken::Parse(token);
-
// TODO(iclelland): Allow for multiple signing keys, and iterate over all
// active keys here. https://crbug.com/543220
ContentClient* content_client = GetContentClient();
base::StringPiece public_key = content_client->GetOriginTrialPublicKey();
+ if (public_key.empty()) {
+ return false;
+ }
+ std::unique_ptr<TrialToken> trial_token = TrialToken::From(token, public_key);
- return !public_key.empty() && trial_token &&
- trial_token->IsAppropriate(origin, featureName) &&
- trial_token->IsValid(base::Time::Now(), public_key);
+ return trial_token &&
+ trial_token->IsValidForFeature(origin, featureName, base::Time::Now());
}
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698