Chromium Code Reviews| 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 |