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

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

Issue 1833063002: Store the list of trial tokens in OriginTrialContext (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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/OriginTrialsBase.h
diff --git a/third_party/WebKit/Source/core/origin_trials/OriginTrialsBase.h b/third_party/WebKit/Source/core/origin_trials/OriginTrialsBase.h
new file mode 100644
index 0000000000000000000000000000000000000000..2042ca943f3fc0e9cfbfdd1ea8575fe45720be46
--- /dev/null
+++ b/third_party/WebKit/Source/core/origin_trials/OriginTrialsBase.h
@@ -0,0 +1,49 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
iclelland 2016/03/31 15:00:00 2016?
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef OriginTrialsBase_h
+#define OriginTrialsBase_h
+
+#include "core/CoreExport.h"
+#include "platform/Supplementable.h"
+#include "wtf/HashSet.h"
+#include "wtf/Vector.h"
+#include "wtf/text/WTFString.h"
+
+namespace blink {
+
+class ExecutionContext;
+class WebTrialTokenValidator;
+
+class CORE_EXPORT OriginTrialsBase : public NoBaseWillBeGarbageCollectedFinalized<OriginTrialsBase> {
iclelland 2016/03/31 15:00:00 Are we still using WillBe types? I think they're a
Marijn Kruisselbrink 2016/03/31 19:01:48 We definitely were still using them last week, and
iclelland 2016/04/01 15:19:09 Got it. I thought those had landed; hadn't finishe
+public:
+ virtual ~OriginTrialsBase();
+
+ void addToken(const String& token);
+
+ DECLARE_VIRTUAL_TRACE();
+
+protected:
+ explicit OriginTrialsBase(ExecutionContext*);
+
+ // Returns true if the feature should be considered enabled for the current
+ // execution context. This method usually makes use of the token validator
+ // object in the platform, but this may be overridden if a custom validator
+ // is required (for testing, for instance).
+ bool isFeatureEnabled(const String& featureName, String* errorMessage, WebTrialTokenValidator* = nullptr);
+
+private:
+
+ RawPtrWillBeMember<ExecutionContext> m_host;
+ Vector<String> m_tokens;
+
+ // 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
+
+#endif // OriginTrialsBase_h

Powered by Google App Engine
This is Rietveld 408576698