| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 COMPONENTS_ARC_BLUETOOTH_ARC_BLUETOOTH_BRIDGE_H_ | 5 #ifndef COMPONENTS_ARC_BLUETOOTH_ARC_BLUETOOTH_BRIDGE_H_ |
| 6 #define COMPONENTS_ARC_BLUETOOTH_ARC_BLUETOOTH_BRIDGE_H_ | 6 #define COMPONENTS_ARC_BLUETOOTH_ARC_BLUETOOTH_BRIDGE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> |
| 10 #include <string> | 11 #include <string> |
| 11 #include <vector> | 12 #include <vector> |
| 12 | 13 |
| 13 #include "components/arc/arc_bridge_service.h" | 14 #include "components/arc/arc_bridge_service.h" |
| 14 #include "components/arc/arc_service.h" | 15 #include "components/arc/arc_service.h" |
| 15 #include "components/arc/common/bluetooth.mojom.h" | 16 #include "components/arc/common/bluetooth.mojom.h" |
| 16 #include "device/bluetooth/bluetooth_adapter.h" | 17 #include "device/bluetooth/bluetooth_adapter.h" |
| 17 #include "device/bluetooth/bluetooth_adapter_factory.h" | 18 #include "device/bluetooth/bluetooth_adapter_factory.h" |
| 18 #include "device/bluetooth/bluetooth_device.h" | 19 #include "device/bluetooth/bluetooth_device.h" |
| 19 #include "device/bluetooth/bluetooth_discovery_session.h" | 20 #include "device/bluetooth/bluetooth_discovery_session.h" |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 const GetConnectionStateCallback& callback) override; | 137 const GetConnectionStateCallback& callback) override; |
| 137 | 138 |
| 138 // Chrome observer callbacks | 139 // Chrome observer callbacks |
| 139 void OnPoweredOn( | 140 void OnPoweredOn( |
| 140 const mojo::Callback<void(mojom::BluetoothAdapterState)>& callback) const; | 141 const mojo::Callback<void(mojom::BluetoothAdapterState)>& callback) const; |
| 141 void OnPoweredOff( | 142 void OnPoweredOff( |
| 142 const mojo::Callback<void(mojom::BluetoothAdapterState)>& callback) const; | 143 const mojo::Callback<void(mojom::BluetoothAdapterState)>& callback) const; |
| 143 void OnPoweredError( | 144 void OnPoweredError( |
| 144 const mojo::Callback<void(mojom::BluetoothAdapterState)>& callback) const; | 145 const mojo::Callback<void(mojom::BluetoothAdapterState)>& callback) const; |
| 145 void OnDiscoveryStarted( | 146 void OnDiscoveryStarted( |
| 146 scoped_ptr<device::BluetoothDiscoverySession> session); | 147 std::unique_ptr<device::BluetoothDiscoverySession> session); |
| 147 void OnDiscoveryStopped(); | 148 void OnDiscoveryStopped(); |
| 148 void OnDiscoveryError(); | 149 void OnDiscoveryError(); |
| 149 void OnPairing(mojom::BluetoothAddressPtr addr) const; | 150 void OnPairing(mojom::BluetoothAddressPtr addr) const; |
| 150 void OnPairedDone(mojom::BluetoothAddressPtr addr) const; | 151 void OnPairedDone(mojom::BluetoothAddressPtr addr) const; |
| 151 void OnPairedError( | 152 void OnPairedError( |
| 152 mojom::BluetoothAddressPtr addr, | 153 mojom::BluetoothAddressPtr addr, |
| 153 device::BluetoothDevice::ConnectErrorCode error_code) const; | 154 device::BluetoothDevice::ConnectErrorCode error_code) const; |
| 154 void OnForgetDone(mojom::BluetoothAddressPtr addr) const; | 155 void OnForgetDone(mojom::BluetoothAddressPtr addr) const; |
| 155 void OnForgetError(mojom::BluetoothAddressPtr addr) const; | 156 void OnForgetError(mojom::BluetoothAddressPtr addr) const; |
| 156 | 157 |
| 157 private: | 158 private: |
| 158 mojo::Array<mojom::BluetoothPropertyPtr> GetDeviceProperties( | 159 mojo::Array<mojom::BluetoothPropertyPtr> GetDeviceProperties( |
| 159 mojom::BluetoothPropertyType type, | 160 mojom::BluetoothPropertyType type, |
| 160 device::BluetoothDevice* device) const; | 161 device::BluetoothDevice* device) const; |
| 161 mojo::Array<mojom::BluetoothPropertyPtr> GetAdapterProperties( | 162 mojo::Array<mojom::BluetoothPropertyPtr> GetAdapterProperties( |
| 162 mojom::BluetoothPropertyType type) const; | 163 mojom::BluetoothPropertyType type) const; |
| 163 | 164 |
| 164 void SendCachedDevicesFound() const; | 165 void SendCachedDevicesFound() const; |
| 165 bool HasBluetoothInstance() const; | 166 bool HasBluetoothInstance() const; |
| 166 | 167 |
| 167 // Propagates the list of paired device to Android. | 168 // Propagates the list of paired device to Android. |
| 168 void SendCachedPairedDevices() const; | 169 void SendCachedPairedDevices() const; |
| 169 | 170 |
| 170 mojo::Binding<mojom::BluetoothHost> binding_; | 171 mojo::Binding<mojom::BluetoothHost> binding_; |
| 171 | 172 |
| 172 scoped_refptr<device::BluetoothAdapter> bluetooth_adapter_; | 173 scoped_refptr<device::BluetoothAdapter> bluetooth_adapter_; |
| 173 scoped_ptr<device::BluetoothDiscoverySession> discovery_session_; | 174 std::unique_ptr<device::BluetoothDiscoverySession> discovery_session_; |
| 174 | 175 |
| 175 // WeakPtrFactory to use for callbacks. | 176 // WeakPtrFactory to use for callbacks. |
| 176 base::WeakPtrFactory<ArcBluetoothBridge> weak_factory_; | 177 base::WeakPtrFactory<ArcBluetoothBridge> weak_factory_; |
| 177 | 178 |
| 178 DISALLOW_COPY_AND_ASSIGN(ArcBluetoothBridge); | 179 DISALLOW_COPY_AND_ASSIGN(ArcBluetoothBridge); |
| 179 }; | 180 }; |
| 180 | 181 |
| 181 } // namespace arc | 182 } // namespace arc |
| 182 | 183 |
| 183 #endif // COMPONENTS_ARC_BLUETOOTH_ARC_BLUETOOTH_BRIDGE_H_ | 184 #endif // COMPONENTS_ARC_BLUETOOTH_ARC_BLUETOOTH_BRIDGE_H_ |
| OLD | NEW |