| 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( |
| 90 const web_bluetooth::WebBluetoothDeviceId& device_id) override; |
| 90 | 91 |
| 91 // Callbacks for WebBluetoothService calls: | 92 // Callbacks for WebBluetoothService calls: |
| 92 void OnRequestDeviceComplete( | 93 void OnRequestDeviceComplete( |
| 93 std::unique_ptr<blink::WebBluetoothRequestDeviceCallbacks> callbacks, | 94 std::unique_ptr<blink::WebBluetoothRequestDeviceCallbacks> callbacks, |
| 94 const blink::mojom::WebBluetoothError error, | 95 const blink::mojom::WebBluetoothError error, |
| 95 blink::mojom::WebBluetoothDevicePtr device); | 96 blink::mojom::WebBluetoothDevicePtr device); |
| 96 void OnConnectComplete( | 97 void OnConnectComplete( |
| 97 std::unique_ptr<blink::WebBluetoothRemoteGATTServerConnectCallbacks> | 98 std::unique_ptr<blink::WebBluetoothRemoteGATTServerConnectCallbacks> |
| 98 callbacks, | 99 callbacks, |
| 99 blink::mojom::WebBluetoothError error); | 100 blink::mojom::WebBluetoothError error); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 // Map of characteristic_instance_ids to | 134 // Map of characteristic_instance_ids to |
| 134 // WebBluetoothRemoteGATTCharacteristics. When characteristicObjectRemoved is | 135 // WebBluetoothRemoteGATTCharacteristics. When characteristicObjectRemoved is |
| 135 // called the characteristic should be removed from the map. | 136 // called the characteristic should be removed from the map. |
| 136 // Keeps track of what characteristics have listeners. | 137 // Keeps track of what characteristics have listeners. |
| 137 std::unordered_map<std::string, blink::WebBluetoothRemoteGATTCharacteristic*> | 138 std::unordered_map<std::string, blink::WebBluetoothRemoteGATTCharacteristic*> |
| 138 active_characteristics_; | 139 active_characteristics_; |
| 139 | 140 |
| 140 // Map of device_ids to WebBluetoothDevices. Added in connect() and removed in | 141 // 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 | 142 // 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. | 143 // this map, but that it will definitely be removed when the page navigates. |
| 143 std::unordered_map<std::string, blink::WebBluetoothDevice*> | 144 std::unordered_map<web_bluetooth::WebBluetoothDeviceId, |
| 145 blink::WebBluetoothDevice*, |
| 146 web_bluetooth::WebBluetoothDeviceIdHash> |
| 144 connected_devices_; | 147 connected_devices_; |
| 145 | 148 |
| 146 // Binding associated with |web_bluetooth_service_|. | 149 // Binding associated with |web_bluetooth_service_|. |
| 147 mojo::AssociatedBinding<blink::mojom::WebBluetoothServiceClient> binding_; | 150 mojo::AssociatedBinding<blink::mojom::WebBluetoothServiceClient> binding_; |
| 148 | 151 |
| 149 DISALLOW_COPY_AND_ASSIGN(WebBluetoothImpl); | 152 DISALLOW_COPY_AND_ASSIGN(WebBluetoothImpl); |
| 150 }; | 153 }; |
| 151 | 154 |
| 152 } // namespace content | 155 } // namespace content |
| 153 | 156 |
| 154 #endif // CONTENT_RENDERER_BLUETOOTH_WEB_BLUETOOTH_IMPL_H_ | 157 #endif // CONTENT_RENDERER_BLUETOOTH_WEB_BLUETOOTH_IMPL_H_ |
| OLD | NEW |