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

Side by Side Diff: third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.cpp

Issue 1403323007: bluetooth: WIP Advertising Data (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-characteristic-properties
Patch Set: Created 5 years, 2 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "config.h" 5 #include "config.h"
6 #include "modules/bluetooth/BluetoothDevice.h" 6 #include "modules/bluetooth/BluetoothDevice.h"
7 7
8 #include "bindings/core/v8/CallbackPromiseAdapter.h" 8 #include "bindings/core/v8/CallbackPromiseAdapter.h"
9 #include "bindings/core/v8/ScriptPromise.h" 9 #include "bindings/core/v8/ScriptPromise.h"
10 #include "bindings/core/v8/ScriptPromiseResolver.h" 10 #include "bindings/core/v8/ScriptPromiseResolver.h"
11 #include "core/dom/DOMException.h" 11 #include "core/dom/DOMException.h"
12 #include "core/dom/ExceptionCode.h" 12 #include "core/dom/ExceptionCode.h"
13 #include "modules/bluetooth/BluetoothAdvertisingData.h"
13 #include "modules/bluetooth/BluetoothError.h" 14 #include "modules/bluetooth/BluetoothError.h"
14 #include "modules/bluetooth/BluetoothGATTRemoteServer.h" 15 #include "modules/bluetooth/BluetoothGATTRemoteServer.h"
15 #include "modules/bluetooth/BluetoothSupplement.h" 16 #include "modules/bluetooth/BluetoothSupplement.h"
16 #include "public/platform/modules/bluetooth/WebBluetooth.h" 17 #include "public/platform/modules/bluetooth/WebBluetooth.h"
17 18
18 namespace blink { 19 namespace blink {
19 20
20 BluetoothDevice::BluetoothDevice(PassOwnPtr<WebBluetoothDevice> webDevice) 21 BluetoothDevice::BluetoothDevice(PassOwnPtr<WebBluetoothDevice> webDevice)
21 : m_webDevice(webDevice) 22 : m_webDevice(webDevice)
23 , m_adData(BluetoothAdvertisingData::create())
22 { 24 {
23 } 25 }
24 26
25 BluetoothDevice* BluetoothDevice::take(ScriptPromiseResolver*, PassOwnPtr<WebBlu etoothDevice> webDevice) 27 BluetoothDevice* BluetoothDevice::take(ScriptPromiseResolver*, PassOwnPtr<WebBlu etoothDevice> webDevice)
26 { 28 {
27 ASSERT(webDevice); 29 ASSERT(webDevice);
28 return new BluetoothDevice(webDevice); 30 return new BluetoothDevice(webDevice);
29 } 31 }
30 32
31 unsigned BluetoothDevice::deviceClass(bool& isNull) 33 unsigned BluetoothDevice::deviceClass(bool& isNull)
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 WebBluetooth* webbluetooth = BluetoothSupplement::fromScriptState(scriptStat e); 83 WebBluetooth* webbluetooth = BluetoothSupplement::fromScriptState(scriptStat e);
82 if (!webbluetooth) 84 if (!webbluetooth)
83 return ScriptPromise::rejectWithDOMException(scriptState, DOMException:: create(NotSupportedError)); 85 return ScriptPromise::rejectWithDOMException(scriptState, DOMException:: create(NotSupportedError));
84 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ; 86 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ;
85 ScriptPromise promise = resolver->promise(); 87 ScriptPromise promise = resolver->promise();
86 webbluetooth->connectGATT(instanceID(), new CallbackPromiseAdapter<Bluetooth GATTRemoteServer, BluetoothError>(resolver)); 88 webbluetooth->connectGATT(instanceID(), new CallbackPromiseAdapter<Bluetooth GATTRemoteServer, BluetoothError>(resolver));
87 return promise; 89 return promise;
88 } 90 }
89 91
90 } // namespace blink 92 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698