Chromium Code Reviews| 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 #include "components/pairing/bluetooth_host_pairing_controller.h" | 5 #include "components/pairing/bluetooth_host_pairing_controller.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/hash.h" | 8 #include "base/hash.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 464 void BluetoothHostPairingController::RemoveObserver(Observer* observer) { | 464 void BluetoothHostPairingController::RemoveObserver(Observer* observer) { |
| 465 observers_.RemoveObserver(observer); | 465 observers_.RemoveObserver(observer); |
| 466 } | 466 } |
| 467 | 467 |
| 468 HostPairingController::Stage BluetoothHostPairingController::GetCurrentStage() { | 468 HostPairingController::Stage BluetoothHostPairingController::GetCurrentStage() { |
| 469 return current_stage_; | 469 return current_stage_; |
| 470 } | 470 } |
| 471 | 471 |
| 472 void BluetoothHostPairingController::StartPairing() { | 472 void BluetoothHostPairingController::StartPairing() { |
| 473 DCHECK_EQ(current_stage_, STAGE_NONE); | 473 DCHECK_EQ(current_stage_, STAGE_NONE); |
| 474 bool bluetooth_available = | 474 bool bluetooth_supported = |
|
achuithb
2017/04/18 07:38:57
nit: const
ortuno
2017/04/19 23:19:44
Done.
| |
| 475 device::BluetoothAdapterFactory::IsBluetoothAdapterAvailable(); | 475 device::BluetoothAdapterFactory::IsBluetoothSupported(); |
| 476 if (!bluetooth_available) { | 476 if (!bluetooth_supported) { |
| 477 ChangeStage(STAGE_INITIALIZATION_ERROR); | 477 ChangeStage(STAGE_INITIALIZATION_ERROR); |
| 478 return; | 478 return; |
| 479 } | 479 } |
| 480 | 480 |
| 481 device::BluetoothAdapterFactory::GetAdapter( | 481 device::BluetoothAdapterFactory::GetAdapter( |
| 482 base::Bind(&BluetoothHostPairingController::OnGetAdapter, | 482 base::Bind(&BluetoothHostPairingController::OnGetAdapter, |
| 483 ptr_factory_.GetWeakPtr())); | 483 ptr_factory_.GetWeakPtr())); |
| 484 } | 484 } |
| 485 | 485 |
| 486 std::string BluetoothHostPairingController::GetDeviceName() { | 486 std::string BluetoothHostPairingController::GetDeviceName() { |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 577 ChangeStage(STAGE_WAITING_FOR_CODE_CONFIRMATION); | 577 ChangeStage(STAGE_WAITING_FOR_CODE_CONFIRMATION); |
| 578 } | 578 } |
| 579 | 579 |
| 580 void BluetoothHostPairingController::AuthorizePairing( | 580 void BluetoothHostPairingController::AuthorizePairing( |
| 581 device::BluetoothDevice* device) { | 581 device::BluetoothDevice* device) { |
| 582 // Disallow unknown device. | 582 // Disallow unknown device. |
| 583 device->RejectPairing(); | 583 device->RejectPairing(); |
| 584 } | 584 } |
| 585 | 585 |
| 586 } // namespace pairing_chromeos | 586 } // namespace pairing_chromeos |
| OLD | NEW |