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 #include "core/experiments/Experiments.h" | 5 #include "core/experiments/Experiments.h" |
6 | 6 |
7 #include "core/dom/ElementTraversal.h" | 7 #include "core/dom/ElementTraversal.h" |
8 #include "core/dom/ExceptionCode.h" | 8 #include "core/dom/ExceptionCode.h" |
9 #include "core/html/HTMLHeadElement.h" | 9 #include "core/html/HTMLHeadElement.h" |
10 #include "core/html/HTMLMetaElement.h" | 10 #include "core/html/HTMLMetaElement.h" |
11 #include "platform/RuntimeEnabledFeatures.h" | 11 #include "platform/RuntimeEnabledFeatures.h" |
12 #include "platform/weborigin/SecurityOrigin.h" | 12 #include "platform/weborigin/SecurityOrigin.h" |
13 #include "public/platform/Platform.h" | 13 #include "public/platform/Platform.h" |
14 #include "public/platform/WebApiKeyValidator.h" | 14 #include "public/platform/WebApiKeyValidator.h" |
15 | 15 |
16 namespace blink { | 16 namespace blink { |
17 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
20 const char* kExperimentsMetaName = "api-experiments"; | 20 const char kExperimentsMetaName[] = "api-experiments"; |
21 | 21 |
22 String getCurrentOrigin(ExecutionContext* executionContext) | 22 String getCurrentOrigin(ExecutionContext* executionContext) |
23 { | 23 { |
24 return executionContext->securityOrigin()->toString(); | 24 return executionContext->securityOrigin()->toString(); |
25 } | 25 } |
26 | 26 |
27 String getDisabledMessage(const String& apiName) | 27 String getDisabledMessage(const String& apiName) |
28 { | 28 { |
29 // TODO(chasej): Update message with URL to experiments site, when live | 29 // TODO(chasej): Update message with URL to experiments site, when live |
30 return "The '" + apiName + "' API is currently enabled in limited experiment
s. Please see [Chrome experiments website URL] for information on enabling this
experiment on your site."; | 30 return "The '" + apiName + "' API is currently enabled in limited experiment
s. Please see [Chrome experiments website URL] for information on enabling this
experiment on your site."; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 return hasValidAPIKey(executionContext, apiName, errorMessage, validator); | 98 return hasValidAPIKey(executionContext, apiName, errorMessage, validator); |
99 } | 99 } |
100 | 100 |
101 // static | 101 // static |
102 DOMException* Experiments::createApiDisabledException(const String& apiName) | 102 DOMException* Experiments::createApiDisabledException(const String& apiName) |
103 { | 103 { |
104 return DOMException::create(NotSupportedError, getDisabledMessage(apiName)); | 104 return DOMException::create(NotSupportedError, getDisabledMessage(apiName)); |
105 } | 105 } |
106 | 106 |
107 } // namespace blink | 107 } // namespace blink |
OLD | NEW |