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

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

Issue 2376403004: Store Origin-Trial tokens to ServiceWorkerDataBase (Closed)
Patch Set: incorporated iclelland's comment Created 4 years, 2 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.h
diff --git a/content/common/origin_trials/trial_token_validator.h b/content/common/origin_trials/trial_token_validator.h
index 1997985cb4e4cc013324748b94997c25562c6c79..9a8cce9f1bcda59272630037b66ece0d3dd608e2 100644
--- a/content/common/origin_trials/trial_token_validator.h
+++ b/content/common/origin_trials/trial_token_validator.h
@@ -5,7 +5,10 @@
#ifndef CONTENT_COMMON_ORIGIN_TRIALS_TRIAL_TOKEN_VALIDATOR_H_
#define CONTENT_COMMON_ORIGIN_TRIALS_TRIAL_TOKEN_VALIDATOR_H_
+#include <map>
+#include <memory>
#include <string>
+#include <vector>
#include "base/strings/string_piece.h"
#include "content/common/content_export.h"
#include "url/origin.h"
@@ -23,6 +26,9 @@ namespace content {
namespace TrialTokenValidator {
+using FeatureToTokensMap = std::map<std::string /* feature_name */,
+ std::vector<std::string /* token */>>;
+
// If token validates, |*feature_name| is set to the name of the feature the
// token enables.
// This method is thread-safe.
@@ -39,6 +45,17 @@ CONTENT_EXPORT bool RequestEnablesFeature(
const net::HttpResponseHeaders* response_headers,
base::StringPiece feature_name);
+// Returns all valid tokens in |headers|.
+CONTENT_EXPORT std::unique_ptr<FeatureToTokensMap> GetValidTokensFromHeaders(
+ const url::Origin& origin,
+ const net::HttpResponseHeaders* headers);
+
+// Returns all valid tokens in |tokens|. This method is used to re-validate
+// previously stored tokens.
+CONTENT_EXPORT std::unique_ptr<FeatureToTokensMap> GetValidTokens(
+ const url::Origin& origin,
+ const FeatureToTokensMap& tokens);
+
} // namespace TrialTokenValidator
} // namespace content
« no previous file with comments | « content/browser/service_worker/service_worker_version.cc ('k') | content/common/origin_trials/trial_token_validator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698