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 CONTENT_RENDERER_BLUETOOTH_WEB_BLUETOOTH_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_BLUETOOTH_WEB_BLUETOOTH_IMPL_H_ |
6 #define CONTENT_RENDERER_BLUETOOTH_WEB_BLUETOOTH_IMPL_H_ | 6 #define CONTENT_RENDERER_BLUETOOTH_WEB_BLUETOOTH_IMPL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 void registerCharacteristicObject( | 79 void registerCharacteristicObject( |
80 const blink::WebString& characteristic_instance_id, | 80 const blink::WebString& characteristic_instance_id, |
81 blink::WebBluetoothRemoteGATTCharacteristic* characteristic) override; | 81 blink::WebBluetoothRemoteGATTCharacteristic* characteristic) override; |
82 | 82 |
83 private: | 83 private: |
84 struct GetCharacteristicsCallback; | 84 struct GetCharacteristicsCallback; |
85 // WebBluetoothServiceClient methods: | 85 // WebBluetoothServiceClient methods: |
86 void RemoteCharacteristicValueChanged( | 86 void RemoteCharacteristicValueChanged( |
87 const mojo::String& characteristic_instance_id, | 87 const mojo::String& characteristic_instance_id, |
88 mojo::Array<uint8_t> value) override; | 88 mojo::Array<uint8_t> value) override; |
89 void GattServerDisconnected(const mojo::String& device_id) override; | 89 void GattServerDisconnected(const WebBluetoothDeviceId& device_id) override; |
90 | 90 |
91 // Callbacks for WebBluetoothService calls: | 91 // Callbacks for WebBluetoothService calls: |
92 void OnRequestDeviceComplete( | 92 void OnRequestDeviceComplete( |
93 std::unique_ptr<blink::WebBluetoothRequestDeviceCallbacks> callbacks, | 93 std::unique_ptr<blink::WebBluetoothRequestDeviceCallbacks> callbacks, |
94 const blink::mojom::WebBluetoothError error, | 94 const blink::mojom::WebBluetoothError error, |
95 blink::mojom::WebBluetoothDevicePtr device); | 95 blink::mojom::WebBluetoothDevicePtr device); |
96 void OnConnectComplete( | 96 void OnConnectComplete( |
97 std::unique_ptr<blink::WebBluetoothRemoteGATTServerConnectCallbacks> | 97 std::unique_ptr<blink::WebBluetoothRemoteGATTServerConnectCallbacks> |
98 callbacks, | 98 callbacks, |
99 blink::mojom::WebBluetoothError error); | 99 blink::mojom::WebBluetoothError error); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 // Map of characteristic_instance_ids to | 133 // Map of characteristic_instance_ids to |
134 // WebBluetoothRemoteGATTCharacteristics. When characteristicObjectRemoved is | 134 // WebBluetoothRemoteGATTCharacteristics. When characteristicObjectRemoved is |
135 // called the characteristic should be removed from the map. | 135 // called the characteristic should be removed from the map. |
136 // Keeps track of what characteristics have listeners. | 136 // Keeps track of what characteristics have listeners. |
137 std::unordered_map<std::string, blink::WebBluetoothRemoteGATTCharacteristic*> | 137 std::unordered_map<std::string, blink::WebBluetoothRemoteGATTCharacteristic*> |
138 active_characteristics_; | 138 active_characteristics_; |
139 | 139 |
140 // Map of device_ids to WebBluetoothDevices. Added in connect() and removed in | 140 // Map of device_ids to WebBluetoothDevices. Added in connect() and removed in |
141 // disconnect(). This means a device may not actually be connected while in | 141 // disconnect(). This means a device may not actually be connected while in |
142 // this map, but that it will definitely be removed when the page navigates. | 142 // this map, but that it will definitely be removed when the page navigates. |
143 std::unordered_map<std::string, blink::WebBluetoothDevice*> | 143 std::unordered_map<WebBluetoothDeviceId, |
| 144 blink::WebBluetoothDevice*, |
| 145 WebBluetoothDeviceIdHash> |
144 connected_devices_; | 146 connected_devices_; |
145 | 147 |
146 // Binding associated with |web_bluetooth_service_|. | 148 // Binding associated with |web_bluetooth_service_|. |
147 mojo::AssociatedBinding<blink::mojom::WebBluetoothServiceClient> binding_; | 149 mojo::AssociatedBinding<blink::mojom::WebBluetoothServiceClient> binding_; |
148 | 150 |
149 DISALLOW_COPY_AND_ASSIGN(WebBluetoothImpl); | 151 DISALLOW_COPY_AND_ASSIGN(WebBluetoothImpl); |
150 }; | 152 }; |
151 | 153 |
152 } // namespace content | 154 } // namespace content |
153 | 155 |
154 #endif // CONTENT_RENDERER_BLUETOOTH_WEB_BLUETOOTH_IMPL_H_ | 156 #endif // CONTENT_RENDERER_BLUETOOTH_WEB_BLUETOOTH_IMPL_H_ |
OLD | NEW |