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

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

Issue 2123323004: Simplify OriginTrialContext and the way it validates tokens. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mark enum as obsolete Created 4 years, 5 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 d73766e13ebe8ab04f6559774df57170bfb0459e..472c880dfb9e7f0bb995becc090f58228d8b5cac 100644
--- a/third_party/WebKit/Source/core/origin_trials/OriginTrialContext.h
+++ b/third_party/WebKit/Source/core/origin_trials/OriginTrialContext.h
@@ -66,9 +66,8 @@ public:
void addTokens(const Vector<String>& tokens);
// Returns true if the feature should be considered enabled for the current
- // execution context. If non-null, the |errorMessage| parameter will be used
- // to provide a message for features that are not enabled.
- bool isFeatureEnabled(const String& featureName, String* errorMessage);
+ // execution context.
+ bool isFeatureEnabled(const String& featureName);
// Installs JavaScript bindings for any features which should be enabled by
// the current set of trial tokens. This method is idempotent; only features
@@ -83,33 +82,16 @@ public:
DECLARE_VIRTUAL_TRACE();
private:
+ void validateToken(const String& token);
+
Member<ExecutionContext> m_host;
Vector<String> m_tokens;
+ HashSet<String> m_enabledFeatures;
WebTrialTokenValidator* m_trialTokenValidator;
- // The public isFeatureEnabled method delegates to this method to do the
- // core logic to check if the feature can be enabled for the current
- // context. Returns a code to indicate if the feature is enabled, or to
- // indicate a specific reason why the feature is disabled. If the
- // |errorMessage| parameter is non-null, and the feature is disabled due to
- // an insecure context, it will be updated with a message. For other
- // disabled reasons, the |errorMessage| parameter will not be updated. The
- // caller is responsible for providing a message as appropriate.
- WebOriginTrialTokenStatus checkFeatureEnabled(const String& featureName, String* errorMessage);
-
// Records whether a feature has been installed into the host's V8 context,
// for each feature name.
HashSet<String> m_bindingsInstalled;
-
- // Records whether metrics about the enabled status have been recorded, for
- // each feature name. Only one result should be recorded per context,
- // regardless of how many times the enabled check is actually done.
- HashSet<String> m_enabledResultCountedForFeature;
-
- // Records whether an error message has been generated, for each feature
- // name. Since these messages are generally written to the console, this is
- // used to avoid cluttering the console with messages on every access.
- HashSet<String> m_errorMessageGeneratedForFeature;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698