| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 if (adapter_.get()) { | 65 if (adapter_.get()) { |
| 66 adapter_->RemoveObserver(this); | 66 adapter_->RemoveObserver(this); |
| 67 adapter_ = NULL; | 67 adapter_ = NULL; |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 | 70 |
| 71 void BluetoothControllerPairingController::DeviceFound( | 71 void BluetoothControllerPairingController::DeviceFound( |
| 72 device::BluetoothDevice* device) { | 72 device::BluetoothDevice* device) { |
| 73 DCHECK_EQ(current_stage_, STAGE_DEVICES_DISCOVERY); | 73 DCHECK_EQ(current_stage_, STAGE_DEVICES_DISCOVERY); |
| 74 DCHECK(thread_checker_.CalledOnValidThread()); | 74 DCHECK(thread_checker_.CalledOnValidThread()); |
| 75 if (base::StartsWith(device->GetName(), base::ASCIIToUTF16(kDeviceNamePrefix), | 75 if (base::StartsWith(device->GetNameForDisplay(), |
| 76 base::ASCIIToUTF16(kDeviceNamePrefix), |
| 76 base::CompareCase::INSENSITIVE_ASCII)) { | 77 base::CompareCase::INSENSITIVE_ASCII)) { |
| 77 discovered_devices_.insert(device->GetAddress()); | 78 discovered_devices_.insert(device->GetAddress()); |
| 78 FOR_EACH_OBSERVER(ControllerPairingController::Observer, observers_, | 79 FOR_EACH_OBSERVER(ControllerPairingController::Observer, observers_, |
| 79 DiscoveredDevicesListChanged()); | 80 DiscoveredDevicesListChanged()); |
| 80 } | 81 } |
| 81 } | 82 } |
| 82 | 83 |
| 83 void BluetoothControllerPairingController::DeviceLost( | 84 void BluetoothControllerPairingController::DeviceLost( |
| 84 device::BluetoothDevice* device) { | 85 device::BluetoothDevice* device) { |
| 85 DCHECK_EQ(current_stage_, STAGE_DEVICES_DISCOVERY); | 86 DCHECK_EQ(current_stage_, STAGE_DEVICES_DISCOVERY); |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 ChangeStage(STAGE_WAITING_FOR_CODE_CONFIRMATION); | 500 ChangeStage(STAGE_WAITING_FOR_CODE_CONFIRMATION); |
| 500 } | 501 } |
| 501 | 502 |
| 502 void BluetoothControllerPairingController::AuthorizePairing( | 503 void BluetoothControllerPairingController::AuthorizePairing( |
| 503 device::BluetoothDevice* device) { | 504 device::BluetoothDevice* device) { |
| 504 // Disallow unknown device. | 505 // Disallow unknown device. |
| 505 device->RejectPairing(); | 506 device->RejectPairing(); |
| 506 } | 507 } |
| 507 | 508 |
| 508 } // namespace pairing_chromeos | 509 } // namespace pairing_chromeos |
| OLD | NEW |