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

Unified Diff: content/renderer/origin_trials/web_trial_token_validator_impl.cc

Issue 1909633003: Collect UMA data for Origin Trials (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address some comments 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/renderer/origin_trials/web_trial_token_validator_impl.cc
diff --git a/content/renderer/origin_trials/web_trial_token_validator_impl.cc b/content/renderer/origin_trials/web_trial_token_validator_impl.cc
index 01078edf5649f85dfc592e2bd51dc53d185639f4..e6b78f0fb289cd272dba8cd351275debaff2b72c 100644
--- a/content/renderer/origin_trials/web_trial_token_validator_impl.cc
+++ b/content/renderer/origin_trials/web_trial_token_validator_impl.cc
@@ -11,12 +11,38 @@ namespace content {
WebTrialTokenValidatorImpl::WebTrialTokenValidatorImpl() {}
WebTrialTokenValidatorImpl::~WebTrialTokenValidatorImpl() {}
-bool WebTrialTokenValidatorImpl::validateToken(
+#define STATIC_ASSERT_ENUM(a, b) \
+ static_assert(static_cast<int>(a) == static_cast<int>(b), \
+ "mismatching enums: " #a)
+
+STATIC_ASSERT_ENUM(TRIAL_TOKEN_STATUS_SUCCESS,
+ blink::WebTrialTokenValidator::TokenValidationResultSuccess);
+STATIC_ASSERT_ENUM(TRIAL_TOKEN_STATUS_EXPIRED,
+ blink::WebTrialTokenValidator::TokenValidationResultExpired);
+STATIC_ASSERT_ENUM(
+ TRIAL_TOKEN_STATUS_INVALID_SIGNATURE,
+ blink::WebTrialTokenValidator::TokenValidationResultInvalidSignature);
+STATIC_ASSERT_ENUM(
+ TRIAL_TOKEN_STATUS_MALFORMED,
+ blink::WebTrialTokenValidator::TokenValidationResultMalformed);
+STATIC_ASSERT_ENUM(
+ TRIAL_TOKEN_STATUS_NOT_SUPPORTED,
+ blink::WebTrialTokenValidator::TokenValidationResultNotSupported);
+STATIC_ASSERT_ENUM(
+ TRIAL_TOKEN_STATUS_WRONG_FEATURE,
+ blink::WebTrialTokenValidator::TokenValidationResultWrongFeature);
+STATIC_ASSERT_ENUM(
+ TRIAL_TOKEN_STATUS_WRONG_ORIGIN,
+ blink::WebTrialTokenValidator::TokenValidationResultWrongOrigin);
+
+blink::WebTrialTokenValidator::TokenValidationResult
+WebTrialTokenValidatorImpl::validateToken(
const blink::WebString& token,
const blink::WebSecurityOrigin& origin,
const blink::WebString& featureName) {
- return TrialTokenValidator::ValidateToken(token.utf8(), origin,
- featureName.utf8());
+ return static_cast<blink::WebTrialTokenValidator::TokenValidationResult>(
+ TrialTokenValidator::ValidateToken(token.utf8(), origin,
+ featureName.utf8()));
}
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698