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/ui/webui/chromeos/login/hid_detection_screen_handler.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/hid_detection_screen_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
57 | 57 |
58 bool DeviceIsKeyboard(device::BluetoothDevice::DeviceType device_type) { | 58 bool DeviceIsKeyboard(device::BluetoothDevice::DeviceType device_type) { |
59 return device_type == device::BluetoothDevice::DEVICE_KEYBOARD || | 59 return device_type == device::BluetoothDevice::DEVICE_KEYBOARD || |
60 device_type == device::BluetoothDevice::DEVICE_KEYBOARD_MOUSE_COMBO; | 60 device_type == device::BluetoothDevice::DEVICE_KEYBOARD_MOUSE_COMBO; |
61 } | 61 } |
62 | 62 |
63 } // namespace | 63 } // namespace |
64 | 64 |
65 namespace chromeos { | 65 namespace chromeos { |
66 | 66 |
67 HIDDetectionScreenHandler::HIDDetectionScreenHandler() | 67 HIDDetectionScreenHandler::HIDDetectionScreenHandler( |
68 CoreOobeActor* core_oobe_actor) | |
68 : BaseScreenHandler(kJsScreenPath), | 69 : BaseScreenHandler(kJsScreenPath), |
69 delegate_(NULL), | 70 delegate_(NULL), |
71 core_oobe_actor_(core_oobe_actor), | |
70 show_on_init_(false), | 72 show_on_init_(false), |
71 mouse_is_pairing_(false), | 73 mouse_is_pairing_(false), |
72 keyboard_is_pairing_(false), | 74 keyboard_is_pairing_(false), |
73 switch_on_adapter_when_ready_(false), | 75 switch_on_adapter_when_ready_(false), |
74 first_time_screen_show_(true), | 76 first_time_screen_show_(true), |
75 weak_ptr_factory_(this) { | 77 weak_ptr_factory_(this) { |
76 } | 78 } |
77 | 79 |
78 HIDDetectionScreenHandler::~HIDDetectionScreenHandler() { | 80 HIDDetectionScreenHandler::~HIDDetectionScreenHandler() { |
79 if (adapter_.get()) | 81 if (adapter_.get()) |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
429 | 431 |
430 // Skip screen if both devices are present. | 432 // Skip screen if both devices are present. |
431 bool all_devices_autodetected = !pointing_device_id_.empty() && | 433 bool all_devices_autodetected = !pointing_device_id_.empty() && |
432 !keyboard_device_id_.empty(); | 434 !keyboard_device_id_.empty(); |
433 UMA_HISTOGRAM_BOOLEAN("HIDDetection.OOBEDialogShown", | 435 UMA_HISTOGRAM_BOOLEAN("HIDDetection.OOBEDialogShown", |
434 !all_devices_autodetected); | 436 !all_devices_autodetected); |
435 if (all_devices_autodetected) { | 437 if (all_devices_autodetected) { |
436 HandleOnContinue(); | 438 HandleOnContinue(); |
437 return; | 439 return; |
438 } | 440 } |
441 core_oobe_actor_->InitDemoModeDetection(); | |
Nikita (slow)
2014/06/11 12:51:21
nit: As discussed, please use these methods in pai
merkulova
2014/06/11 15:46:44
Done.
| |
439 PrefService* local_state = g_browser_process->local_state(); | 442 PrefService* local_state = g_browser_process->local_state(); |
440 int num_of_times_dialog_was_shown = local_state->GetInteger( | 443 int num_of_times_dialog_was_shown = local_state->GetInteger( |
441 prefs::kTimesHIDDialogShown); | 444 prefs::kTimesHIDDialogShown); |
442 local_state->SetInteger(prefs::kTimesHIDDialogShown, | 445 local_state->SetInteger(prefs::kTimesHIDDialogShown, |
443 num_of_times_dialog_was_shown + 1); | 446 num_of_times_dialog_was_shown + 1); |
444 first_time_screen_show_ = false; | 447 first_time_screen_show_ = false; |
445 | 448 |
446 TryInitiateBTDevicesUpdate(); | 449 TryInitiateBTDevicesUpdate(); |
447 } | 450 } |
448 | 451 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
548 l10n_util::GetStringFUTF16( | 551 l10n_util::GetStringFUTF16( |
549 IDS_HID_DETECTION_PAIRED_BLUETOOTH_KEYBOARD, | 552 IDS_HID_DETECTION_PAIRED_BLUETOOTH_KEYBOARD, |
550 base::UTF8ToUTF16(keyboard_device_name_))); | 553 base::UTF8ToUTF16(keyboard_device_name_))); |
551 } else { | 554 } else { |
552 state_info.SetString("state", kUSBConnectedState); | 555 state_info.SetString("state", kUSBConnectedState); |
553 } | 556 } |
554 CallJS("setKeyboardDeviceState", state_info); | 557 CallJS("setKeyboardDeviceState", state_info); |
555 } | 558 } |
556 | 559 |
557 } // namespace chromeos | 560 } // namespace chromeos |
OLD | NEW |