Index: third_party/WebKit/Source/modules/bluetooth/Bluetooth.cpp |
diff --git a/third_party/WebKit/Source/modules/bluetooth/Bluetooth.cpp b/third_party/WebKit/Source/modules/bluetooth/Bluetooth.cpp |
index 55c97f33251159e4c3212e0430aab1f55b48dd37..41484167b4e8ddc75a8a4ca81e66e7213a052fd0 100644 |
--- a/third_party/WebKit/Source/modules/bluetooth/Bluetooth.cpp |
+++ b/third_party/WebKit/Source/modules/bluetooth/Bluetooth.cpp |
@@ -130,6 +130,18 @@ static void convertRequestDeviceOptions(const RequestDeviceOptions& options, Web |
// https://webbluetoothchrome.github.io/web-bluetooth/#dom-bluetooth-requestdevice |
ScriptPromise Bluetooth::requestDevice(ScriptState* scriptState, const RequestDeviceOptions& options, ExceptionState& exceptionState) |
{ |
+ |
+ // By adding the "OriginTrialEnabled" extended binding, we enable the |
+ // requestDevice function on all platforms for whitelisted domains. Since we |
+ // only support Chrome OS and Android for this experiment we reject any |
iclelland
2016/06/24 03:37:23
OS X is also supported, right?
ortuno
2016/06/24 16:01:31
Ah, I did change this to include macOS, but push o
|
+ // promises from other platforms unless they have the enable-web-bluetooth |
+ // flag on. |
+#if !OS(CHROMEOS) && !OS(ANDROID) && !OS(MACOSX) |
+ if (!RuntimeEnabledFeatures::webBluetoothEnabled()) { |
+ return ScriptPromise::rejectWithDOMException(scriptState, DOMException::create(NotSupportedError, "Web Bluetooth is not enabled on this platform. To find out how to enable it and the current implementation status visit https://goo.gl/HKa2If")); |
+ } |
+#endif |
+ |
// 1. If the incumbent settings object is not a secure context, reject promise with a SecurityError and abort these steps. |
String errorMessage; |
if (!scriptState->getExecutionContext()->isSecureContext(errorMessage)) { |