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

Unified Diff: third_party/WebKit/Source/core/origin_trials/OriginTrialContext.h

Issue 1828063002: Add support for origin trials in workers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@trial-token-in-header-blink-document
Patch Set: address 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: third_party/WebKit/Source/core/origin_trials/OriginTrialContext.h
diff --git a/third_party/WebKit/Source/core/origin_trials/OriginTrialContext.h b/third_party/WebKit/Source/core/origin_trials/OriginTrialContext.h
index 7f29843ee01b8eaed2237d98908e6813707d4147..012f028efa70c7c9cdb08a80119d738d9107c5ee 100644
--- a/third_party/WebKit/Source/core/origin_trials/OriginTrialContext.h
+++ b/third_party/WebKit/Source/core/origin_trials/OriginTrialContext.h
@@ -37,7 +37,11 @@ public:
explicit OriginTrialContext(ExecutionContext*);
static const char* supplementName();
- static OriginTrialContext* from(ExecutionContext*);
+
+ // Returns the OriginTrialContext for a specific ExecutionContext. If
+ // |create| is false, this returns null if no OriginTrialContext exists
+ // yet for the ExecutionContext.
+ static OriginTrialContext* from(ExecutionContext*, bool create = true);
kinuko 2016/04/29 09:43:05 nit: prefer enum over bool in general
Marijn Kruisselbrink 2016/05/02 23:19:31 Changed it to an enum.
// Parses an Origin-Trial header as specified in
// https://jpchase.github.io/OriginTrials/#header into individual tokens.
@@ -46,8 +50,14 @@ public:
static std::unique_ptr<Vector<String>> parseHeaderValue(const String& headerValue);
static void addTokensFromHeader(ExecutionContext*, const String& headerValue);
+ static void addTokens(ExecutionContext*, const Vector<String>* tokens);
+
+ // Returns the trial tokens that are active in a specific ExecutionContext.
+ // Returns null if no tokens were added to the ExecutionContext.
+ static std::unique_ptr<Vector<String>> getTokens(ExecutionContext*);
void addToken(const String& token);
+ void addTokens(const Vector<String>& tokens);
// Returns true if the feature should be considered enabled for the current
// execution context. This method usually makes use of the token validator

Powered by Google App Engine
This is Rietveld 408576698