| 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_controller_pairing_controller.h" | 5 #include "components/pairing/bluetooth_controller_pairing_controller.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 BluetoothControllerPairingController::GetCurrentStage() { | 234 BluetoothControllerPairingController::GetCurrentStage() { |
| 235 return current_stage_; | 235 return current_stage_; |
| 236 } | 236 } |
| 237 | 237 |
| 238 void BluetoothControllerPairingController::StartPairing() { | 238 void BluetoothControllerPairingController::StartPairing() { |
| 239 DCHECK(thread_checker_.CalledOnValidThread()); | 239 DCHECK(thread_checker_.CalledOnValidThread()); |
| 240 DCHECK(current_stage_ == STAGE_NONE || | 240 DCHECK(current_stage_ == STAGE_NONE || |
| 241 current_stage_ == STAGE_DEVICE_NOT_FOUND || | 241 current_stage_ == STAGE_DEVICE_NOT_FOUND || |
| 242 current_stage_ == STAGE_ESTABLISHING_CONNECTION_ERROR || | 242 current_stage_ == STAGE_ESTABLISHING_CONNECTION_ERROR || |
| 243 current_stage_ == STAGE_HOST_ENROLLMENT_ERROR); | 243 current_stage_ == STAGE_HOST_ENROLLMENT_ERROR); |
| 244 if (!device::BluetoothAdapterFactory::IsBluetoothAdapterAvailable()) { | 244 if (!device::BluetoothAdapterFactory::IsBluetoothSupported()) { |
| 245 ChangeStage(STAGE_INITIALIZATION_ERROR); | 245 ChangeStage(STAGE_INITIALIZATION_ERROR); |
| 246 return; | 246 return; |
| 247 } | 247 } |
| 248 | 248 |
| 249 device::BluetoothAdapterFactory::GetAdapter( | 249 device::BluetoothAdapterFactory::GetAdapter( |
| 250 base::Bind(&BluetoothControllerPairingController::OnGetAdapter, | 250 base::Bind(&BluetoothControllerPairingController::OnGetAdapter, |
| 251 ptr_factory_.GetWeakPtr())); | 251 ptr_factory_.GetWeakPtr())); |
| 252 | 252 |
| 253 } | 253 } |
| 254 | 254 |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 ChangeStage(STAGE_WAITING_FOR_CODE_CONFIRMATION); | 500 ChangeStage(STAGE_WAITING_FOR_CODE_CONFIRMATION); |
| 501 } | 501 } |
| 502 | 502 |
| 503 void BluetoothControllerPairingController::AuthorizePairing( | 503 void BluetoothControllerPairingController::AuthorizePairing( |
| 504 device::BluetoothDevice* device) { | 504 device::BluetoothDevice* device) { |
| 505 // Disallow unknown device. | 505 // Disallow unknown device. |
| 506 device->RejectPairing(); | 506 device->RejectPairing(); |
| 507 } | 507 } |
| 508 | 508 |
| 509 } // namespace pairing_chromeos | 509 } // namespace pairing_chromeos |
| OLD | NEW |