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> |
| 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "base/logging.h" | 10 #include "base/logging.h" |
9 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
10 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
11 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
12 #include "components/pairing/bluetooth_pairing_constants.h" | 14 #include "components/pairing/bluetooth_pairing_constants.h" |
13 #include "components/pairing/pairing_api.pb.h" | 15 #include "components/pairing/pairing_api.pb.h" |
14 #include "device/bluetooth/bluetooth_adapter_factory.h" | 16 #include "device/bluetooth/bluetooth_adapter_factory.h" |
15 #include "device/bluetooth/bluetooth_discovery_session.h" | 17 #include "device/bluetooth/bluetooth_discovery_session.h" |
16 #include "net/base/io_buffer.h" | 18 #include "net/base/io_buffer.h" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 base::Bind(&BluetoothControllerPairingController::OnSetPowered, | 127 base::Bind(&BluetoothControllerPairingController::OnSetPowered, |
126 ptr_factory_.GetWeakPtr()), | 128 ptr_factory_.GetWeakPtr()), |
127 base::Bind(&BluetoothControllerPairingController::OnError, | 129 base::Bind(&BluetoothControllerPairingController::OnError, |
128 ptr_factory_.GetWeakPtr())); | 130 ptr_factory_.GetWeakPtr())); |
129 } | 131 } |
130 } | 132 } |
131 | 133 |
132 void BluetoothControllerPairingController::OnStartDiscoverySession( | 134 void BluetoothControllerPairingController::OnStartDiscoverySession( |
133 scoped_ptr<device::BluetoothDiscoverySession> discovery_session) { | 135 scoped_ptr<device::BluetoothDiscoverySession> discovery_session) { |
134 DCHECK(thread_checker_.CalledOnValidThread()); | 136 DCHECK(thread_checker_.CalledOnValidThread()); |
135 discovery_session_ = discovery_session.Pass(); | 137 discovery_session_ = std::move(discovery_session); |
136 ChangeStage(STAGE_DEVICES_DISCOVERY); | 138 ChangeStage(STAGE_DEVICES_DISCOVERY); |
137 | 139 |
138 for (const auto& device : adapter_->GetDevices()) | 140 for (const auto& device : adapter_->GetDevices()) |
139 DeviceFound(device); | 141 DeviceFound(device); |
140 } | 142 } |
141 | 143 |
142 void BluetoothControllerPairingController::OnConnect() { | 144 void BluetoothControllerPairingController::OnConnect() { |
143 DCHECK(thread_checker_.CalledOnValidThread()); | 145 DCHECK(thread_checker_.CalledOnValidThread()); |
144 device::BluetoothDevice* device = GetController(); | 146 device::BluetoothDevice* device = GetController(); |
145 if (device) { | 147 if (device) { |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 ChangeStage(STAGE_WAITING_FOR_CODE_CONFIRMATION); | 492 ChangeStage(STAGE_WAITING_FOR_CODE_CONFIRMATION); |
491 } | 493 } |
492 | 494 |
493 void BluetoothControllerPairingController::AuthorizePairing( | 495 void BluetoothControllerPairingController::AuthorizePairing( |
494 device::BluetoothDevice* device) { | 496 device::BluetoothDevice* device) { |
495 // Disallow unknown device. | 497 // Disallow unknown device. |
496 device->RejectPairing(); | 498 device->RejectPairing(); |
497 } | 499 } |
498 | 500 |
499 } // namespace pairing_chromeos | 501 } // namespace pairing_chromeos |
OLD | NEW |