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

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

Issue 2466223002: Implement WebBluetooth getDescriptor[s] (Closed)
Patch Set: Implement WebBluetooth getDescriptor[s] Created 3 years, 11 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 #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 "core/dom/ContextLifecycleObserver.h" 9 #include "core/dom/ContextLifecycleObserver.h"
10 #include "modules/EventTargetModules.h" 10 #include "modules/EventTargetModules.h"
11 #include "modules/bluetooth/BluetoothRemoteGATTServer.h" 11 #include "modules/bluetooth/BluetoothRemoteGATTServer.h"
12 #include "platform/heap/Heap.h" 12 #include "platform/heap/Heap.h"
13 #include "public/platform/modules/bluetooth/web_bluetooth.mojom-blink.h" 13 #include "public/platform/modules/bluetooth/web_bluetooth.mojom-blink.h"
14 #include "wtf/text/WTFString.h" 14 #include "wtf/text/WTFString.h"
15 #include <memory> 15 #include <memory>
16 16
17 namespace blink { 17 namespace blink {
18 18
19 class Bluetooth; 19 class Bluetooth;
20 class BluetoothAttributeInstanceMap; 20 class BluetoothAttributeInstanceMap;
21 class BluetoothRemoteGATTCharacteristic; 21 class BluetoothRemoteGATTCharacteristic;
22 class BluetoothRemoteGATTDescriptor;
22 class BluetoothRemoteGATTServer; 23 class BluetoothRemoteGATTServer;
23 class BluetoothRemoteGATTService; 24 class BluetoothRemoteGATTService;
24 class ScriptPromiseResolver; 25 class ScriptPromiseResolver;
25 26
26 // BluetoothDevice represents a physical bluetooth device in the DOM. See IDL. 27 // BluetoothDevice represents a physical bluetooth device in the DOM. See IDL.
27 // 28 //
28 // Callbacks providing WebBluetoothDevice objects are handled by 29 // Callbacks providing WebBluetoothDevice objects are handled by
29 // CallbackPromiseAdapter templatized with this class. See this class's 30 // CallbackPromiseAdapter templatized with this class. See this class's
30 // "Interface required by CallbackPromiseAdapter" section and the 31 // "Interface required by CallbackPromiseAdapter" section and the
31 // CallbackPromiseAdapter class comments. 32 // CallbackPromiseAdapter class comments.
(...skipping 18 matching lines...) Expand all
50 bool isPrimary, 51 bool isPrimary,
51 const String& deviceInstanceId); 52 const String& deviceInstanceId);
52 bool isValidService(const String& serviceInstanceId); 53 bool isValidService(const String& serviceInstanceId);
53 54
54 BluetoothRemoteGATTCharacteristic* getOrCreateRemoteGATTCharacteristic( 55 BluetoothRemoteGATTCharacteristic* getOrCreateRemoteGATTCharacteristic(
55 ExecutionContext*, 56 ExecutionContext*,
56 mojom::blink::WebBluetoothRemoteGATTCharacteristicPtr, 57 mojom::blink::WebBluetoothRemoteGATTCharacteristicPtr,
57 BluetoothRemoteGATTService*); 58 BluetoothRemoteGATTService*);
58 bool isValidCharacteristic(const String& characteristicInstanceId); 59 bool isValidCharacteristic(const String& characteristicInstanceId);
59 60
61 BluetoothRemoteGATTDescriptor* getOrCreateBluetoothRemoteGATTDescriptor(
62 mojom::blink::WebBluetoothRemoteGATTDescriptorPtr,
63 BluetoothRemoteGATTCharacteristic*);
64
60 // We should disconnect from the device in all of the following cases: 65 // We should disconnect from the device in all of the following cases:
61 // 1. When the object gets GarbageCollected e.g. it went out of scope. 66 // 1. When the object gets GarbageCollected e.g. it went out of scope.
62 // dispose() is called in this case. 67 // dispose() is called in this case.
63 // 2. When the parent document gets detached e.g. reloading a page. 68 // 2. When the parent document gets detached e.g. reloading a page.
64 // stop() is called in this case. 69 // stop() is called in this case.
65 // TODO(ortuno): Users should be able to turn on notifications for 70 // TODO(ortuno): Users should be able to turn on notifications for
66 // events on navigator.bluetooth and still remain connected even if the 71 // events on navigator.bluetooth and still remain connected even if the
67 // BluetoothDevice object is garbage collected. 72 // BluetoothDevice object is garbage collected.
68 73
69 // USING_PRE_FINALIZER interface. 74 // USING_PRE_FINALIZER interface.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 Member<BluetoothAttributeInstanceMap> m_attributeInstanceMap; 111 Member<BluetoothAttributeInstanceMap> m_attributeInstanceMap;
107 112
108 mojom::blink::WebBluetoothDevicePtr m_device; 113 mojom::blink::WebBluetoothDevicePtr m_device;
109 Member<BluetoothRemoteGATTServer> m_gatt; 114 Member<BluetoothRemoteGATTServer> m_gatt;
110 Member<Bluetooth> m_bluetooth; 115 Member<Bluetooth> m_bluetooth;
111 }; 116 };
112 117
113 } // namespace blink 118 } // namespace blink
114 119
115 #endif // BluetoothDevice_h 120 #endif // BluetoothDevice_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698