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

Side by Side Diff: third_party/WebKit/Source/core/origin_trials/OriginTrialContext.h

Issue 2005433002: [Origin Trials] Install origin trial bindings on V8 context conditionally (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@track-ef-install
Patch Set: Clean up Created 4 years, 6 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 unified diff | Download patch
OLDNEW
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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
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. If non-null, the 70 // to provide a message for features that are not enabled. If non-null, the
71 // optional WebTrialTokenValidator parameter will override the platform 71 // optional WebTrialTokenValidator parameter will override the platform
72 // token validator object that is normally used (e.g. for testing). 72 // token validator object that is normally used (e.g. for testing).
73 bool isFeatureEnabled(const String& featureName, String* errorMessage, WebTr ialTokenValidator* = nullptr); 73 bool isFeatureEnabled(const String& featureName, String* errorMessage, WebTr ialTokenValidator* = nullptr);
74 74
75 // Installs JavaScript bindings for any features which should be enabled by
76 // the current set of trial tokens. This method is idempotent; only features
77 // which have been enabled since the last time it was run will be installed.
78 // If the V8 context for the host execution context has not been
79 // initialized, then this method will return without doing anything.
80 void initializePendingTrials();
81
75 void setFeatureBindingsInstalled(const String& featureName); 82 void setFeatureBindingsInstalled(const String& featureName);
76 bool featureBindingsInstalled(const String& featureName); 83 bool featureBindingsInstalled(const String& featureName);
77 84
78 DECLARE_VIRTUAL_TRACE(); 85 DECLARE_VIRTUAL_TRACE();
79 86
80 private: 87 private:
81 Member<ExecutionContext> m_host; 88 Member<ExecutionContext> m_host;
82 Vector<String> m_tokens; 89 Vector<String> m_tokens;
83 90
84 // The public isFeatureEnabled method delegates to this method to do the 91 // The public isFeatureEnabled method delegates to this method to do the
(...skipping 17 matching lines...) Expand all
102 109
103 // Records whether an error message has been generated, for each feature 110 // Records whether an error message has been generated, for each feature
104 // name. Since these messages are generally written to the console, this is 111 // name. Since these messages are generally written to the console, this is
105 // used to avoid cluttering the console with messages on every access. 112 // used to avoid cluttering the console with messages on every access.
106 HashSet<String> m_errorMessageGeneratedForFeature; 113 HashSet<String> m_errorMessageGeneratedForFeature;
107 }; 114 };
108 115
109 } // namespace blink 116 } // namespace blink
110 117
111 #endif // OriginTrialContext_h 118 #endif // OriginTrialContext_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698