Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef OriginTrialContext_h | 5 #ifndef OriginTrialContext_h |
| 6 #define OriginTrialContext_h | 6 #define OriginTrialContext_h |
| 7 | 7 |
| 8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
| 9 #include "platform/Supplementable.h" | 9 #include "platform/Supplementable.h" |
| 10 #include "wtf/HashSet.h" | 10 #include "wtf/HashSet.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 63 static std::unique_ptr<Vector<String>> getTokens(ExecutionContext*); | 63 static std::unique_ptr<Vector<String>> getTokens(ExecutionContext*); |
| 64 | 64 |
| 65 void addToken(const String& token); | 65 void addToken(const String& token); |
| 66 void addTokens(const Vector<String>& tokens); | 66 void addTokens(const Vector<String>& tokens); |
| 67 | 67 |
| 68 // Returns true if the feature should be considered enabled for the current | 68 // Returns true if the feature should be considered enabled for the current |
| 69 // execution context. If non-null, the |errorMessage| parameter will be used | 69 // execution context. If non-null, the |errorMessage| parameter will be used |
| 70 // to provide a message for features that are not enabled. | 70 // to provide a message for features that are not enabled. |
| 71 bool isFeatureEnabled(const String& featureName, String* errorMessage); | 71 bool isFeatureEnabled(const String& featureName, String* errorMessage); |
| 72 | 72 |
| 73 // Installs JavaScript bindings for any features which should be enabled by | |
| 74 // the current set of trial tokens. This method is idempotent; only features | |
| 75 // which have been enabled since the last time it was run will be installed. | |
| 76 // If the V8 context for the host execution context has not been | |
| 77 // initialized, then this method will return without doing anything. | |
| 78 void initializePendingTrials(); | |
|
chasej
2016/05/31 15:42:13
Nit: maybe this should be named "initializePending
iclelland
2016/05/31 16:03:44
Done.
| |
| 79 | |
| 73 void setFeatureBindingsInstalled(const String& featureName); | 80 void setFeatureBindingsInstalled(const String& featureName); |
| 74 bool featureBindingsInstalled(const String& featureName); | 81 bool featureBindingsInstalled(const String& featureName); |
| 75 | 82 |
| 76 DECLARE_VIRTUAL_TRACE(); | 83 DECLARE_VIRTUAL_TRACE(); |
| 77 | 84 |
| 78 private: | 85 private: |
| 79 Member<ExecutionContext> m_host; | 86 Member<ExecutionContext> m_host; |
| 80 Vector<String> m_tokens; | 87 Vector<String> m_tokens; |
| 81 WebTrialTokenValidator* m_trialTokenValidator; | 88 WebTrialTokenValidator* m_trialTokenValidator; |
| 82 | 89 |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 101 | 108 |
| 102 // Records whether an error message has been generated, for each feature | 109 // Records whether an error message has been generated, for each feature |
| 103 // name. Since these messages are generally written to the console, this is | 110 // name. Since these messages are generally written to the console, this is |
| 104 // used to avoid cluttering the console with messages on every access. | 111 // used to avoid cluttering the console with messages on every access. |
| 105 HashSet<String> m_errorMessageGeneratedForFeature; | 112 HashSet<String> m_errorMessageGeneratedForFeature; |
| 106 }; | 113 }; |
| 107 | 114 |
| 108 } // namespace blink | 115 } // namespace blink |
| 109 | 116 |
| 110 #endif // OriginTrialContext_h | 117 #endif // OriginTrialContext_h |
| OLD | NEW |