| 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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 } else { | 353 } else { |
| 354 editor.SetString(kContextKeyKeyboardState, kUSBConnectedState); | 354 editor.SetString(kContextKeyKeyboardState, kUSBConnectedState); |
| 355 } | 355 } |
| 356 } | 356 } |
| 357 editor.SetString(kContextKeyKeyboardDeviceName, keyboard_device_name_) | 357 editor.SetString(kContextKeyKeyboardDeviceName, keyboard_device_name_) |
| 358 .SetBoolean( | 358 .SetBoolean( |
| 359 kContextKeyContinueButtonEnabled, | 359 kContextKeyContinueButtonEnabled, |
| 360 !(pointing_device_id_.empty() && keyboard_device_id_.empty())); | 360 !(pointing_device_id_.empty() && keyboard_device_id_.empty())); |
| 361 } | 361 } |
| 362 | 362 |
| 363 void HIDDetectionScreen::SetKeyboardDeviceName_(std::string name) { | 363 void HIDDetectionScreen::SetKeyboardDeviceName_(const std::string& name) { |
| 364 if (!(keyboard_device_id_.empty()) && name.empty()) | 364 keyboard_device_name_ = |
| 365 name = l10n_util::GetStringUTF8(IDS_HID_DETECTION_DEFAULT_KEYBOARD_NAME); | 365 keyboard_device_id_.empty() || !name.empty() |
| 366 keyboard_device_name_ = name; | 366 ? name |
| 367 : l10n_util::GetStringUTF8(IDS_HID_DETECTION_DEFAULT_KEYBOARD_NAME); |
| 367 } | 368 } |
| 368 | 369 |
| 369 void HIDDetectionScreen::DeviceAdded( | 370 void HIDDetectionScreen::DeviceAdded( |
| 370 device::BluetoothAdapter* adapter, device::BluetoothDevice* device) { | 371 device::BluetoothAdapter* adapter, device::BluetoothDevice* device) { |
| 371 VLOG(1) << "BT input device added id = " << device->GetDeviceID() << | 372 VLOG(1) << "BT input device added id = " << device->GetDeviceID() << |
| 372 " name = " << device->GetName(); | 373 " name = " << device->GetName(); |
| 373 TryPairingAsPointingDevice(device); | 374 TryPairingAsPointingDevice(device); |
| 374 TryPairingAsKeyboardDevice(device); | 375 TryPairingAsKeyboardDevice(device); |
| 375 } | 376 } |
| 376 | 377 |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 void HIDDetectionScreen::SetPoweredOffError() { | 541 void HIDDetectionScreen::SetPoweredOffError() { |
| 541 LOG(ERROR) << "Failed to power off BT adapter"; | 542 LOG(ERROR) << "Failed to power off BT adapter"; |
| 542 } | 543 } |
| 543 | 544 |
| 544 void HIDDetectionScreen::FindDevicesError() { | 545 void HIDDetectionScreen::FindDevicesError() { |
| 545 VLOG(1) << "Failed to start Bluetooth discovery."; | 546 VLOG(1) << "Failed to start Bluetooth discovery."; |
| 546 } | 547 } |
| 547 | 548 |
| 548 | 549 |
| 549 } // namespace chromeos | 550 } // namespace chromeos |
| OLD | NEW |