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