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 "chrome/browser/chromeos/login/screens/hid_detection_screen.h" | 5 #include "chrome/browser/chromeos/login/screens/hid_detection_screen.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 | 175 |
176 void HIDDetectionScreen::DisplayPinCode(device::BluetoothDevice* device, | 176 void HIDDetectionScreen::DisplayPinCode(device::BluetoothDevice* device, |
177 const std::string& pincode) { | 177 const std::string& pincode) { |
178 VLOG(1) << "DisplayPinCode id = " << device->GetDeviceID() | 178 VLOG(1) << "DisplayPinCode id = " << device->GetDeviceID() |
179 << " name = " << device->GetName(); | 179 << " name = " << device->GetName(); |
180 GetContextEditor().SetString(kContextKeyPinCode, pincode); | 180 GetContextEditor().SetString(kContextKeyPinCode, pincode); |
181 SetKeyboardDeviceName_(base::UTF16ToUTF8(device->GetName())); | 181 SetKeyboardDeviceName_(base::UTF16ToUTF8(device->GetName())); |
182 SendKeyboardDeviceNotification(); | 182 SendKeyboardDeviceNotification(); |
183 } | 183 } |
184 | 184 |
185 void HIDDetectionScreen::DisplayPasskey( | 185 void HIDDetectionScreen::DisplayPasskey(device::BluetoothDevice* device, |
186 device::BluetoothDevice* device, uint32 passkey) { | 186 uint32_t passkey) { |
187 VLOG(1) << "DisplayPassKey id = " << device->GetDeviceID() | 187 VLOG(1) << "DisplayPassKey id = " << device->GetDeviceID() |
188 << " name = " << device->GetName(); | 188 << " name = " << device->GetName(); |
189 std::string pincode = base::UintToString(passkey); | 189 std::string pincode = base::UintToString(passkey); |
190 pincode = std::string(kPincodeLength - pincode.length(), '0').append(pincode); | 190 pincode = std::string(kPincodeLength - pincode.length(), '0').append(pincode); |
191 // No differences in UI for passkey and pincode authentication calls. | 191 // No differences in UI for passkey and pincode authentication calls. |
192 DisplayPinCode(device, pincode); | 192 DisplayPinCode(device, pincode); |
193 } | 193 } |
194 | 194 |
195 void HIDDetectionScreen::KeysEntered( | 195 void HIDDetectionScreen::KeysEntered(device::BluetoothDevice* device, |
196 device::BluetoothDevice* device, uint32 entered) { | 196 uint32_t entered) { |
197 VLOG(1) << "Number of keys entered " << entered; | 197 VLOG(1) << "Number of keys entered " << entered; |
198 GetContextEditor() | 198 GetContextEditor() |
199 .SetBoolean(kContextKeyNumKeysEnteredExpected, true) | 199 .SetBoolean(kContextKeyNumKeysEnteredExpected, true) |
200 .SetInteger(kContextKeyNumKeysEnteredPinCode, entered); | 200 .SetInteger(kContextKeyNumKeysEnteredPinCode, entered); |
201 SendKeyboardDeviceNotification(); | 201 SendKeyboardDeviceNotification(); |
202 } | 202 } |
203 | 203 |
204 void HIDDetectionScreen::ConfirmPasskey( | 204 void HIDDetectionScreen::ConfirmPasskey(device::BluetoothDevice* device, |
205 device::BluetoothDevice* device, uint32 passkey) { | 205 uint32_t passkey) { |
206 VLOG(1) << "Confirm Passkey"; | 206 VLOG(1) << "Confirm Passkey"; |
207 device->CancelPairing(); | 207 device->CancelPairing(); |
208 } | 208 } |
209 | 209 |
210 void HIDDetectionScreen::AuthorizePairing(device::BluetoothDevice* device) { | 210 void HIDDetectionScreen::AuthorizePairing(device::BluetoothDevice* device) { |
211 // There is never any circumstance where this will be called, since the | 211 // There is never any circumstance where this will be called, since the |
212 // HID detection screen will only be used for outgoing pairing | 212 // HID detection screen will only be used for outgoing pairing |
213 // requests, but play it safe. | 213 // requests, but play it safe. |
214 VLOG(1) << "Authorize pairing"; | 214 VLOG(1) << "Authorize pairing"; |
215 device->ConfirmPairing(); | 215 device->ConfirmPairing(); |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 void HIDDetectionScreen::SetPoweredOffError() { | 544 void HIDDetectionScreen::SetPoweredOffError() { |
545 LOG(ERROR) << "Failed to power off BT adapter"; | 545 LOG(ERROR) << "Failed to power off BT adapter"; |
546 } | 546 } |
547 | 547 |
548 void HIDDetectionScreen::FindDevicesError() { | 548 void HIDDetectionScreen::FindDevicesError() { |
549 VLOG(1) << "Failed to start Bluetooth discovery."; | 549 VLOG(1) << "Failed to start Bluetooth discovery."; |
550 } | 550 } |
551 | 551 |
552 | 552 |
553 } // namespace chromeos | 553 } // namespace chromeos |
OLD | NEW |