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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 ptr_factory_.GetWeakPtr())); | 131 ptr_factory_.GetWeakPtr())); |
132 } | 132 } |
133 } | 133 } |
134 | 134 |
135 void BluetoothControllerPairingController::OnStartDiscoverySession( | 135 void BluetoothControllerPairingController::OnStartDiscoverySession( |
136 std::unique_ptr<device::BluetoothDiscoverySession> discovery_session) { | 136 std::unique_ptr<device::BluetoothDiscoverySession> discovery_session) { |
137 DCHECK(thread_checker_.CalledOnValidThread()); | 137 DCHECK(thread_checker_.CalledOnValidThread()); |
138 discovery_session_ = std::move(discovery_session); | 138 discovery_session_ = std::move(discovery_session); |
139 ChangeStage(STAGE_DEVICES_DISCOVERY); | 139 ChangeStage(STAGE_DEVICES_DISCOVERY); |
140 | 140 |
141 for (const auto& device : adapter_->GetDevices()) | 141 for (auto* device : adapter_->GetDevices()) |
142 DeviceFound(device); | 142 DeviceFound(device); |
143 } | 143 } |
144 | 144 |
145 void BluetoothControllerPairingController::OnConnect() { | 145 void BluetoothControllerPairingController::OnConnect() { |
146 DCHECK(thread_checker_.CalledOnValidThread()); | 146 DCHECK(thread_checker_.CalledOnValidThread()); |
147 device::BluetoothDevice* device = GetController(); | 147 device::BluetoothDevice* device = GetController(); |
148 if (device) { | 148 if (device) { |
149 device->ConnectToService( | 149 device->ConnectToService( |
150 device::BluetoothUUID(kPairingServiceUUID), | 150 device::BluetoothUUID(kPairingServiceUUID), |
151 base::Bind(&BluetoothControllerPairingController::OnConnectToService, | 151 base::Bind(&BluetoothControllerPairingController::OnConnectToService, |
(...skipping 348 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 |