Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1200)

Side by Side Diff: chrome/browser/ui/webui/chromeos/login/hid_detection_screen_handler.cc

Issue 561903002: Remove implicit conversions from scoped_refptr to T* in c/b/ui/webui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove dumb change Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/command_line.h" 8 #include "base/command_line.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 else 196 else
197 scenario_type = POINTING_DEVICE_ONLY_DETECTED; 197 scenario_type = POINTING_DEVICE_ONLY_DETECTED;
198 198
199 UMA_HISTOGRAM_ENUMERATION( 199 UMA_HISTOGRAM_ENUMERATION(
200 "HIDDetection.OOBEDevicesDetectedOnContinuePressed", 200 "HIDDetection.OOBEDevicesDetectedOnContinuePressed",
201 scenario_type, 201 scenario_type,
202 CONTINUE_SCENARIO_TYPE_SIZE); 202 CONTINUE_SCENARIO_TYPE_SIZE);
203 203
204 // Switch off BT adapter if it was off before the screen and no BT device 204 // Switch off BT adapter if it was off before the screen and no BT device
205 // connected. 205 // connected.
206 if (adapter_ && adapter_->IsPresent() && adapter_->IsPowered() && 206 if (adapter_.get() && adapter_->IsPresent() && adapter_->IsPowered() &&
207 !(pointing_device_connect_type_ == InputDeviceInfo::TYPE_BLUETOOTH || 207 !(pointing_device_connect_type_ == InputDeviceInfo::TYPE_BLUETOOTH ||
208 keyboard_device_connect_type_ == InputDeviceInfo::TYPE_BLUETOOTH) && 208 keyboard_device_connect_type_ == InputDeviceInfo::TYPE_BLUETOOTH) &&
209 adapter_initially_powered_ && !(*adapter_initially_powered_)) { 209 adapter_initially_powered_ && !(*adapter_initially_powered_)) {
210 VLOG(1) << "Switching off BT adapter after HID OOBE screen as unused."; 210 VLOG(1) << "Switching off BT adapter after HID OOBE screen as unused.";
211 adapter_->SetPowered( 211 adapter_->SetPowered(
212 false, 212 false,
213 base::Bind(&base::DoNothing), 213 base::Bind(&base::DoNothing),
214 base::Bind(&HIDDetectionScreenHandler::SetPoweredOffError, 214 base::Bind(&HIDDetectionScreenHandler::SetPoweredOffError,
215 weak_ptr_factory_.GetWeakPtr())); 215 weak_ptr_factory_.GetWeakPtr()));
216 } 216 }
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 registry->RegisterIntegerPref(prefs::kTimesHIDDialogShown, 0); 398 registry->RegisterIntegerPref(prefs::kTimesHIDDialogShown, 0);
399 } 399 }
400 400
401 void HIDDetectionScreenHandler::UpdateDevices() { 401 void HIDDetectionScreenHandler::UpdateDevices() {
402 input_service_proxy_.GetDevices( 402 input_service_proxy_.GetDevices(
403 base::Bind(&HIDDetectionScreenHandler::OnGetInputDevicesList, 403 base::Bind(&HIDDetectionScreenHandler::OnGetInputDevicesList,
404 weak_ptr_factory_.GetWeakPtr())); 404 weak_ptr_factory_.GetWeakPtr()));
405 } 405 }
406 406
407 void HIDDetectionScreenHandler::UpdateBTDevices() { 407 void HIDDetectionScreenHandler::UpdateBTDevices() {
408 if (!adapter_ || !adapter_->IsPresent() || !adapter_->IsPowered()) 408 if (!adapter_.get() || !adapter_->IsPresent() || !adapter_->IsPowered())
409 return; 409 return;
410 410
411 // If no connected devices found as pointing device and keyboard, we try to 411 // If no connected devices found as pointing device and keyboard, we try to
412 // connect some type-suitable active bluetooth device. 412 // connect some type-suitable active bluetooth device.
413 std::vector<device::BluetoothDevice*> bt_devices = adapter_->GetDevices(); 413 std::vector<device::BluetoothDevice*> bt_devices = adapter_->GetDevices();
414 for (std::vector<device::BluetoothDevice*>::const_iterator it = 414 for (std::vector<device::BluetoothDevice*>::const_iterator it =
415 bt_devices.begin(); 415 bt_devices.begin();
416 it != bt_devices.end() && 416 it != bt_devices.end() &&
417 (keyboard_device_id_.empty() || pointing_device_id_.empty()); 417 (keyboard_device_id_.empty() || pointing_device_id_.empty());
418 ++it) { 418 ++it) {
(...skipping 20 matching lines...) Expand all
439 keyboard_device_name_ = it->name; 439 keyboard_device_name_ = it->name;
440 keyboard_device_connect_type_ = it->type; 440 keyboard_device_connect_type_ = it->type;
441 if (page_is_ready()) 441 if (page_is_ready())
442 SendKeyboardDeviceNotification(NULL); 442 SendKeyboardDeviceNotification(NULL);
443 } 443 }
444 } 444 }
445 } 445 }
446 446
447 void HIDDetectionScreenHandler::TryInitiateBTDevicesUpdate() { 447 void HIDDetectionScreenHandler::TryInitiateBTDevicesUpdate() {
448 if ((pointing_device_id_.empty() || keyboard_device_id_.empty()) && 448 if ((pointing_device_id_.empty() || keyboard_device_id_.empty()) &&
449 adapter_) { 449 adapter_.get()) {
450 if (!adapter_->IsPresent()) { 450 if (!adapter_->IsPresent()) {
451 // Switch on BT adapter later when it's available. 451 // Switch on BT adapter later when it's available.
452 switch_on_adapter_when_ready_ = true; 452 switch_on_adapter_when_ready_ = true;
453 } else if (!adapter_->IsPowered()) { 453 } else if (!adapter_->IsPowered()) {
454 VLOG(1) << "Switching on BT adapter on HID OOBE screen."; 454 VLOG(1) << "Switching on BT adapter on HID OOBE screen.";
455 adapter_initially_powered_.reset(new bool(false)); 455 adapter_initially_powered_.reset(new bool(false));
456 adapter_->SetPowered( 456 adapter_->SetPowered(
457 true, 457 true,
458 base::Bind(&HIDDetectionScreenHandler::StartBTDiscoverySession, 458 base::Bind(&HIDDetectionScreenHandler::StartBTDiscoverySession,
459 weak_ptr_factory_.GetWeakPtr()), 459 weak_ptr_factory_.GetWeakPtr()),
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 l10n_util::GetStringFUTF16( 581 l10n_util::GetStringFUTF16(
582 IDS_HID_DETECTION_PAIRED_BLUETOOTH_KEYBOARD, 582 IDS_HID_DETECTION_PAIRED_BLUETOOTH_KEYBOARD,
583 base::UTF8ToUTF16(keyboard_device_name_))); 583 base::UTF8ToUTF16(keyboard_device_name_)));
584 } else { 584 } else {
585 state_info.SetString("state", kUSBConnectedState); 585 state_info.SetString("state", kUSBConnectedState);
586 } 586 }
587 CallJS("setKeyboardDeviceState", state_info); 587 CallJS("setKeyboardDeviceState", state_info);
588 } 588 }
589 589
590 } // namespace chromeos 590 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc ('k') | chrome/browser/ui/webui/chromeos/login/l10n_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698