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 d9c210d4046278d487627576869de12d06c1b371..ed38734970f71eff848fccfc56379c324faeae1a 100644 |
--- a/content/common/origin_trials/trial_token_validator.cc |
+++ b/content/common/origin_trials/trial_token_validator.cc |
@@ -7,6 +7,8 @@ |
#include "base/time/time.h" |
#include "content/common/origin_trials/trial_token.h" |
#include "content/public/common/content_client.h" |
+#include "net/http/http_response_headers.h" |
+#include "net/url_request/url_request.h" |
namespace content { |
@@ -23,4 +25,17 @@ bool TrialTokenValidator::ValidateToken(const std::string& token, |
trial_token->IsValid(base::Time::Now(), public_key); |
} |
+bool TrialTokenValidator::RequestEnablesFeature(const net::URLRequest* request, |
+ base::StringPiece featureName) { |
+ url::Origin origin(request->url()); |
+ size_t iter = 0; |
+ std::string token; |
+ while (request->response_headers()->EnumerateHeader(&iter, "Origin-Trial", |
+ &token)) { |
+ if (ValidateToken(token, origin, featureName)) |
+ return true; |
+ } |
+ return false; |
+} |
+ |
} // namespace content |