| 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 #include "components/arc/bluetooth/arc_bluetooth_bridge.h" | 5 #include "components/arc/bluetooth/arc_bluetooth_bridge.h" |
| 6 | 6 |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <iomanip> | 10 #include <iomanip> |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 return; | 382 return; |
| 383 } | 383 } |
| 384 | 384 |
| 385 discovery_session_->Stop(base::Bind(&ArcBluetoothBridge::OnDiscoveryStopped, | 385 discovery_session_->Stop(base::Bind(&ArcBluetoothBridge::OnDiscoveryStopped, |
| 386 weak_factory_.GetWeakPtr()), | 386 weak_factory_.GetWeakPtr()), |
| 387 base::Bind(&ArcBluetoothBridge::OnDiscoveryError, | 387 base::Bind(&ArcBluetoothBridge::OnDiscoveryError, |
| 388 weak_factory_.GetWeakPtr())); | 388 weak_factory_.GetWeakPtr())); |
| 389 } | 389 } |
| 390 | 390 |
| 391 void ArcBluetoothBridge::OnPoweredOn( | 391 void ArcBluetoothBridge::OnPoweredOn( |
| 392 const base::Callback<void(mojom::BluetoothAdapterState)>& callback) const { | 392 const mojo::Callback<void(mojom::BluetoothAdapterState)>& callback) const { |
| 393 callback.Run(mojom::BluetoothAdapterState::ON); | 393 callback.Run(mojom::BluetoothAdapterState::ON); |
| 394 SendCachedPairedDevices(); | 394 SendCachedPairedDevices(); |
| 395 } | 395 } |
| 396 | 396 |
| 397 void ArcBluetoothBridge::OnPoweredOff( | 397 void ArcBluetoothBridge::OnPoweredOff( |
| 398 const base::Callback<void(mojom::BluetoothAdapterState)>& callback) const { | 398 const mojo::Callback<void(mojom::BluetoothAdapterState)>& callback) const { |
| 399 callback.Run(mojom::BluetoothAdapterState::OFF); | 399 callback.Run(mojom::BluetoothAdapterState::OFF); |
| 400 } | 400 } |
| 401 | 401 |
| 402 void ArcBluetoothBridge::OnPoweredError( | 402 void ArcBluetoothBridge::OnPoweredError( |
| 403 const base::Callback<void(mojom::BluetoothAdapterState)>& callback) const { | 403 const mojo::Callback<void(mojom::BluetoothAdapterState)>& callback) const { |
| 404 LOG(WARNING) << "failed to change power state"; | 404 LOG(WARNING) << "failed to change power state"; |
| 405 | 405 |
| 406 callback.Run(bluetooth_adapter_->IsPowered() | 406 callback.Run(bluetooth_adapter_->IsPowered() |
| 407 ? mojom::BluetoothAdapterState::ON | 407 ? mojom::BluetoothAdapterState::ON |
| 408 : mojom::BluetoothAdapterState::OFF); | 408 : mojom::BluetoothAdapterState::OFF); |
| 409 } | 409 } |
| 410 | 410 |
| 411 void ArcBluetoothBridge::OnDiscoveryStarted( | 411 void ArcBluetoothBridge::OnDiscoveryStarted( |
| 412 std::unique_ptr<BluetoothDiscoverySession> session) { | 412 std::unique_ptr<BluetoothDiscoverySession> session) { |
| 413 if (!HasBluetoothInstance()) | 413 if (!HasBluetoothInstance()) |
| (...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1311 // to | 1311 // to |
| 1312 // make sure the bond state machine on Android is ready to take the | 1312 // make sure the bond state machine on Android is ready to take the |
| 1313 // pair-done event. Otherwise the pair-done event will be dropped as an | 1313 // pair-done event. Otherwise the pair-done event will be dropped as an |
| 1314 // invalid change of paired status. | 1314 // invalid change of paired status. |
| 1315 OnPairing(addr->Clone()); | 1315 OnPairing(addr->Clone()); |
| 1316 OnPairedDone(std::move(addr)); | 1316 OnPairedDone(std::move(addr)); |
| 1317 } | 1317 } |
| 1318 } | 1318 } |
| 1319 | 1319 |
| 1320 } // namespace arc | 1320 } // namespace arc |
| OLD | NEW |