| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 adapter_->RemoveObserver(this); | 64 adapter_->RemoveObserver(this); |
| 65 adapter_ = NULL; | 65 adapter_ = NULL; |
| 66 } | 66 } |
| 67 } | 67 } |
| 68 | 68 |
| 69 void BluetoothControllerPairingController::DeviceFound( | 69 void BluetoothControllerPairingController::DeviceFound( |
| 70 device::BluetoothDevice* device) { | 70 device::BluetoothDevice* device) { |
| 71 DCHECK_EQ(current_stage_, STAGE_DEVICES_DISCOVERY); | 71 DCHECK_EQ(current_stage_, STAGE_DEVICES_DISCOVERY); |
| 72 DCHECK(thread_checker_.CalledOnValidThread()); | 72 DCHECK(thread_checker_.CalledOnValidThread()); |
| 73 if (base::StartsWith(device->GetName(), base::ASCIIToUTF16(kDeviceNamePrefix), | 73 if (base::StartsWith(device->GetName(), base::ASCIIToUTF16(kDeviceNamePrefix), |
| 74 false)) { | 74 base::CompareCase::INSENSITIVE_ASCII)) { |
| 75 discovered_devices_.insert(device->GetAddress()); | 75 discovered_devices_.insert(device->GetAddress()); |
| 76 FOR_EACH_OBSERVER(ControllerPairingController::Observer, observers_, | 76 FOR_EACH_OBSERVER(ControllerPairingController::Observer, observers_, |
| 77 DiscoveredDevicesListChanged()); | 77 DiscoveredDevicesListChanged()); |
| 78 } | 78 } |
| 79 } | 79 } |
| 80 | 80 |
| 81 void BluetoothControllerPairingController::DeviceLost( | 81 void BluetoothControllerPairingController::DeviceLost( |
| 82 device::BluetoothDevice* device) { | 82 device::BluetoothDevice* device) { |
| 83 DCHECK_EQ(current_stage_, STAGE_DEVICES_DISCOVERY); | 83 DCHECK_EQ(current_stage_, STAGE_DEVICES_DISCOVERY); |
| 84 DCHECK(thread_checker_.CalledOnValidThread()); | 84 DCHECK(thread_checker_.CalledOnValidThread()); |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 ChangeStage(STAGE_WAITING_FOR_CODE_CONFIRMATION); | 476 ChangeStage(STAGE_WAITING_FOR_CODE_CONFIRMATION); |
| 477 } | 477 } |
| 478 | 478 |
| 479 void BluetoothControllerPairingController::AuthorizePairing( | 479 void BluetoothControllerPairingController::AuthorizePairing( |
| 480 device::BluetoothDevice* device) { | 480 device::BluetoothDevice* device) { |
| 481 // Disallow unknown device. | 481 // Disallow unknown device. |
| 482 device->RejectPairing(); | 482 device->RejectPairing(); |
| 483 } | 483 } |
| 484 | 484 |
| 485 } // namespace pairing_chromeos | 485 } // namespace pairing_chromeos |
| OLD | NEW |