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

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

Issue 460663002: Merge 288079 "BT adapter is switched to initial state after HID ..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/2062/src/
Patch Set: Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/webui/chromeos/login/hid_detection_screen_handler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/chromeos/login/hid_detection_screen_handler.cc
===================================================================
--- chrome/browser/ui/webui/chromeos/login/hid_detection_screen_handler.cc (revision 288696)
+++ chrome/browser/ui/webui/chromeos/login/hid_detection_screen_handler.cc (working copy)
@@ -71,13 +71,16 @@
core_oobe_actor_(core_oobe_actor),
show_on_init_(false),
mouse_is_pairing_(false),
+ pointing_device_connect_type_(InputDeviceInfo::TYPE_UNKNOWN),
keyboard_is_pairing_(false),
+ keyboard_device_connect_type_(InputDeviceInfo::TYPE_UNKNOWN),
switch_on_adapter_when_ready_(false),
first_time_screen_show_(true),
weak_ptr_factory_(this) {
}
HIDDetectionScreenHandler::~HIDDetectionScreenHandler() {
+ adapter_initially_powered_.reset();
if (adapter_.get())
adapter_->RemoveObserver(this);
input_service_proxy_.RemoveObserver(this);
@@ -96,6 +99,10 @@
LOG(ERROR) << "Failed to power BT adapter";
}
+void HIDDetectionScreenHandler::SetPoweredOffError() {
+ LOG(ERROR) << "Failed to power off BT adapter";
+}
+
void HIDDetectionScreenHandler::FindDevicesError() {
VLOG(1) << "Failed to start Bluetooth discovery.";
}
@@ -177,6 +184,20 @@
scenario_type,
CONTINUE_SCENARIO_TYPE_SIZE);
}
+ // Switch off BT adapter if it was off before the screen and no BT device
+ // connected.
+ if (adapter_ && adapter_->IsPresent() && adapter_->IsPowered() &&
+ !(pointing_device_connect_type_ == InputDeviceInfo::TYPE_BLUETOOTH ||
+ keyboard_device_connect_type_ == InputDeviceInfo::TYPE_BLUETOOTH) &&
+ adapter_initially_powered_ && !(*adapter_initially_powered_)) {
+ VLOG(1) << "Switching off BT adapter after HID OOBE screen as unused.";
+ adapter_->SetPowered(
+ false,
+ base::Bind(&base::DoNothing),
+ base::Bind(&HIDDetectionScreenHandler::SetPoweredOffError,
+ weak_ptr_factory_.GetWeakPtr()));
+ }
+
core_oobe_actor_->StopDemoModeDetection();
if (delegate_)
delegate_->OnExit();
@@ -267,6 +288,8 @@
void HIDDetectionScreenHandler::AdapterPresentChanged(
device::BluetoothAdapter* adapter, bool present) {
if (present && switch_on_adapter_when_ready_) {
+ VLOG(1) << "Switching on BT adapter on HID OOBE screen.";
+ adapter_initially_powered_.reset(new bool(adapter_->IsPowered()));
adapter_->SetPowered(
true,
base::Bind(&HIDDetectionScreenHandler::StartBTDiscoverySession,
@@ -415,6 +438,8 @@
// Switch on BT adapter later when it's available.
switch_on_adapter_when_ready_ = true;
} else if (!adapter_->IsPowered()) {
+ VLOG(1) << "Switching on BT adapter on HID OOBE screen.";
+ adapter_initially_powered_.reset(new bool(false));
adapter_->SetPowered(
true,
base::Bind(&HIDDetectionScreenHandler::StartBTDiscoverySession,
« no previous file with comments | « chrome/browser/ui/webui/chromeos/login/hid_detection_screen_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698