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

Unified Diff: third_party/WebKit/Source/modules/bluetooth/Bluetooth.cpp

Issue 2080553002: bluetooth: Enable Web Bluetooth in Origin Trials (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Rebase and fix bindings 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 side-by-side diff with in-line comments
Download patch
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..00ace3c6760423696c40eab14ab16eb7d07945e4 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 websites that contain an
+ // origin trial token. Since we only support Chrome OS, Android and macOS
iclelland 2016/06/24 18:36:32 nit: MacOS
ortuno 2016/06/24 19:16:33 I think it's macOS, like in iOS O_O. https://9to5m
iclelland 2016/06/24 19:46:35 Maybe --or Mac OS X, or MacOSX, or just 'OS X' ;)
ortuno 2016/06/27 20:22:42 Ah I guess we are not using the new name yet. I'll
+ // for this experiment we reject any 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)) {

Powered by Google App Engine
This is Rietveld 408576698