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

Side by Side Diff: third_party/WebKit/Source/core/experiments/Experiments.h

Issue 1635593004: Rename Experimental Framework classes and concepts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 10 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef Experiments_h
6 #define Experiments_h
7
8 #include "core/CoreExport.h"
9 #include "core/dom/DOMException.h"
10 #include "core/dom/ExecutionContext.h"
11 #include "wtf/text/WTFString.h"
12
13 namespace blink {
14
15 class WebApiKeyValidator;
16
17 // The Experimental Framework (EF) provides limited access to experimental APIs,
18 // on a per-origin basis. This class provides the implementation to check if
19 // the experimental API should be enabled for the current context. This class
20 // is not for direct use by API implementers. Instead, the ExperimentalFeatures
21 // generated class provides a static method for each API to check if it is
22 // enabled. Experimental APIs must be defined in RuntimeEnabledFeatures.in,
23 // which is used to generate ExperimentalFeatures.h/cpp.
24 //
25 // Experimental APIs are defined by string names, provided by the implementers.
26 // The EF code does not maintain an enum or constant list for experiment names.
27 // Instead, the EF validates the name provided by the API implementation against
28 // any provided API keys.
29 //
30 // This class is not intended to be instantiated. Any required state is kept
31 // with a WebApiKeyValidator object held in the Platform object.
32 // The static methods in this class may be called either from the main thread
33 // or from a worker thread.
34 //
35 // TODO(chasej): Link to documentation, or provide more detail on keys, .etc
36 class CORE_EXPORT Experiments {
37 public:
38 // Creates a NotSupportedError exception with a message explaining to
39 // external developers why the API is disabled and how to join API
40 // experiments.
41 static DOMException* createApiDisabledException(const String& apiName);
42
43 private:
44 friend class ExperimentalFeatures;
45 friend class ExperimentsTest;
46
47 Experiments();
48
49 // Returns true if the API should be considered enabled for the current
50 // execution context. This method usually makes use of the API key validator
51 // object in the platform, but this may be overridden if a custom validator
52 // is required (for testing, for instance).
53 static bool isApiEnabled(ExecutionContext*, const String& apiName, String* e rrorMessage, WebApiKeyValidator* = nullptr);
54 };
55
56 } // namespace blink
57
58 #endif // Experiments_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/core_generated.gypi ('k') | third_party/WebKit/Source/core/experiments/Experiments.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698