Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/WebBluetoothDevice.h" | |
| 10 #include "wtf/text/WTFString.h" | 11 #include "wtf/text/WTFString.h" |
| 11 | 12 |
| 12 namespace blink { | 13 namespace blink { |
| 13 | 14 |
| 14 class ScriptPromiseResolver; | 15 class ScriptPromiseResolver; |
| 15 struct WebBluetoothDevice; | |
| 16 | 16 |
| 17 // BluetoothDevice represents a physical bluetooth device in the DOM. See IDL. | 17 // BluetoothDevice represents a physical bluetooth device in the DOM. See IDL. |
| 18 // | 18 // |
| 19 // Callbacks providing WebBluetoothDevice objects are handled by | 19 // Callbacks providing WebBluetoothDevice objects are handled by |
| 20 // CallbackPromiseAdapter templatized with this class. See this class's | 20 // CallbackPromiseAdapter templatized with this class. See this class's |
| 21 // "Interface required by CallbackPromiseAdapter" section and the | 21 // "Interface required by CallbackPromiseAdapter" section and the |
| 22 // CallbackPromiseAdapter class comments. | 22 // CallbackPromiseAdapter class comments. |
| 23 class BluetoothDevice final | 23 class BluetoothDevice final |
| 24 : public GarbageCollectedFinalized<BluetoothDevice> | 24 : public GarbageCollectedFinalized<BluetoothDevice> |
| 25 , public ScriptWrappable { | 25 , public ScriptWrappable { |
| 26 DEFINE_WRAPPERTYPEINFO(); | 26 DEFINE_WRAPPERTYPEINFO(); |
| 27 public: | 27 public: |
| 28 BluetoothDevice(const String& instanceId); | 28 BluetoothDevice(const WebBluetoothDevice&); |
| 29 | 29 |
| 30 static BluetoothDevice* create(const WebBluetoothDevice&); | 30 static BluetoothDevice* create(const WebBluetoothDevice&); |
| 31 | 31 |
| 32 // Interface required by CallbackPromiseAdapter: | 32 // Interface required by CallbackPromiseAdapter: |
| 33 typedef WebBluetoothDevice WebType; | 33 typedef WebBluetoothDevice WebType; |
| 34 static BluetoothDevice* take(ScriptPromiseResolver*, WebBluetoothDevice*); | 34 static BluetoothDevice* take(ScriptPromiseResolver*, WebBluetoothDevice*); |
| 35 static void dispose(blink::WebBluetoothDevice*); | 35 static void dispose(blink::WebBluetoothDevice*); |
|
Marijn Kruisselbrink
2015/01/28 21:18:37
(unrelated to this CL, but no need for the blink::
scheib
2015/01/28 21:29:13
Done.
| |
| 36 | 36 |
| 37 // Interface required by Garbage Collection: | 37 // Interface required by Garbage Collection: |
| 38 void trace(Visitor*) { } | 38 void trace(Visitor*) { } |
| 39 | 39 |
| 40 // IDL exposed interface: | 40 // IDL exposed interface: |
| 41 String instanceId() { return m_instanceId; } | 41 String instanceID() { return m_webDevice.instanceID; } |
| 42 | 42 |
| 43 private: | 43 private: |
| 44 String m_instanceId; | 44 WebBluetoothDevice m_webDevice; |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 } // namespace blink | 47 } // namespace blink |
| 48 | 48 |
| 49 #endif // BluetoothDevice_h | 49 #endif // BluetoothDevice_h |
| OLD | NEW |