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

Side by Side Diff: Source/modules/bluetooth/BluetoothDevice.h

Issue 1234603003: CallbackPromiseAdapter types should be more compatible with WebCallbacks (1/3). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: retry! Created 5 years, 4 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 | Annotate | Revision Log
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 #ifndef BluetoothDevice_h 5 #ifndef BluetoothDevice_h
6 #define BluetoothDevice_h 6 #define BluetoothDevice_h
7 7
8 #include "bindings/core/v8/ScriptWrappable.h" 8 #include "bindings/core/v8/ScriptWrappable.h"
9 #include "platform/heap/Heap.h" 9 #include "platform/heap/Heap.h"
10 #include "public/platform/modules/bluetooth/WebBluetoothDevice.h" 10 #include "public/platform/modules/bluetooth/WebBluetoothDevice.h"
11 #include "wtf/OwnPtr.h"
11 #include "wtf/PassOwnPtr.h" 12 #include "wtf/PassOwnPtr.h"
12 #include "wtf/text/WTFString.h" 13 #include "wtf/text/WTFString.h"
13 14
14 namespace blink { 15 namespace blink {
15 16
16 class ScriptPromise; 17 class ScriptPromise;
17 class ScriptPromiseResolver; 18 class ScriptPromiseResolver;
18 class ScriptState; 19 class ScriptState;
19 20
20 // BluetoothDevice represents a physical bluetooth device in the DOM. See IDL. 21 // BluetoothDevice represents a physical bluetooth device in the DOM. See IDL.
21 // 22 //
22 // Callbacks providing WebBluetoothDevice objects are handled by 23 // Callbacks providing WebBluetoothDevice objects are handled by
23 // CallbackPromiseAdapter templatized with this class. See this class's 24 // CallbackPromiseAdapter templatized with this class. See this class's
24 // "Interface required by CallbackPromiseAdapter" section and the 25 // "Interface required by CallbackPromiseAdapter" section and the
25 // CallbackPromiseAdapter class comments. 26 // CallbackPromiseAdapter class comments.
26 class BluetoothDevice final 27 class BluetoothDevice final
27 : public GarbageCollectedFinalized<BluetoothDevice> 28 : public GarbageCollectedFinalized<BluetoothDevice>
28 , public ScriptWrappable { 29 , public ScriptWrappable {
29 DEFINE_WRAPPERTYPEINFO(); 30 DEFINE_WRAPPERTYPEINFO();
30 public: 31 public:
31 BluetoothDevice(PassOwnPtr<WebBluetoothDevice>); 32 BluetoothDevice(PassOwnPtr<WebBluetoothDevice>);
32 33
33 ScriptPromise connectGATT(ScriptState*); 34 ScriptPromise connectGATT(ScriptState*);
34 35
35 // Interface required by CallbackPromiseAdapter: 36 // Interface required by CallbackPromiseAdapter:
36 typedef WebBluetoothDevice WebType; 37 using WebType = OwnPtr<WebBluetoothDevice>;
37 static BluetoothDevice* take(ScriptPromiseResolver*, PassOwnPtr<WebBluetooth Device>); 38 static BluetoothDevice* take(ScriptPromiseResolver*, PassOwnPtr<WebBluetooth Device>);
38 39
39 // Interface required by Garbage Collection: 40 // Interface required by Garbage Collection:
40 DEFINE_INLINE_TRACE() { } 41 DEFINE_INLINE_TRACE() { }
41 42
42 // IDL exposed interface: 43 // IDL exposed interface:
43 String instanceID() { return m_webDevice->instanceID; } 44 String instanceID() { return m_webDevice->instanceID; }
44 String name() { return m_webDevice->name; } 45 String name() { return m_webDevice->name; }
45 unsigned deviceClass(bool& isNull); 46 unsigned deviceClass(bool& isNull);
46 String vendorIDSource(); 47 String vendorIDSource();
47 unsigned vendorID(bool& isNull); 48 unsigned vendorID(bool& isNull);
48 unsigned productID(bool& isNull); 49 unsigned productID(bool& isNull);
49 unsigned productVersion(bool& isNull); 50 unsigned productVersion(bool& isNull);
50 bool paired(); 51 bool paired();
51 Vector<String> uuids(); 52 Vector<String> uuids();
52 53
53 private: 54 private:
54 OwnPtr<WebBluetoothDevice> m_webDevice; 55 OwnPtr<WebBluetoothDevice> m_webDevice;
55 }; 56 };
56 57
57 } // namespace blink 58 } // namespace blink
58 59
59 #endif // BluetoothDevice_h 60 #endif // BluetoothDevice_h
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/CallbackPromiseAdapter.h ('k') | Source/modules/bluetooth/BluetoothError.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698