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

Side by Side Diff: components/pairing/shark_connection_listener.cc

Issue 1957953003: [Merge to M50] [Chrome OS Bootstrapping]: Do not always power off the Bluetooth adapter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
Patch Set: Created 4 years, 7 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
« no previous file with comments | « components/pairing/shark_connection_listener.h ('k') | device/hid/fake_input_service_linux.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "components/pairing/shark_connection_listener.h" 5 #include "components/pairing/shark_connection_listener.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/threading/thread_restrictions.h" 10 #include "base/threading/thread_restrictions.h"
11 #include "components/pairing/bluetooth_host_pairing_controller.h" 11 #include "components/pairing/bluetooth_host_pairing_controller.h"
12 12
13 namespace pairing_chromeos { 13 namespace pairing_chromeos {
14 14
15 SharkConnectionListener::SharkConnectionListener(OnConnectedCallback callback) 15 SharkConnectionListener::SharkConnectionListener(
16 const scoped_refptr<base::SingleThreadTaskRunner>& file_task_runner,
17 OnConnectedCallback callback)
16 : callback_(callback) { 18 : callback_(callback) {
17 controller_.reset(new BluetoothHostPairingController()); 19 controller_.reset(new BluetoothHostPairingController(file_task_runner));
18 controller_->AddObserver(this); 20 controller_->AddObserver(this);
19 controller_->StartPairing(); 21 controller_->StartPairing();
20 } 22 }
21 23
22 SharkConnectionListener::~SharkConnectionListener() { 24 SharkConnectionListener::~SharkConnectionListener() {
23 if (controller_) 25 if (controller_)
24 controller_->RemoveObserver(this); 26 controller_->RemoveObserver(this);
25 } 27 }
26 28
27 void SharkConnectionListener::PairingStageChanged(Stage new_stage) { 29 void SharkConnectionListener::PairingStageChanged(Stage new_stage) {
28 if (new_stage == HostPairingController::STAGE_WAITING_FOR_CODE_CONFIRMATION 30 if (new_stage == HostPairingController::STAGE_WAITING_FOR_CODE_CONFIRMATION
29 // Code confirmation stage can be skipped if devices were paired before. 31 // Code confirmation stage can be skipped if devices were paired before.
30 || new_stage == HostPairingController::STAGE_SETUP_BASIC_CONFIGURATION) { 32 || new_stage == HostPairingController::STAGE_SETUP_BASIC_CONFIGURATION) {
31 controller_->RemoveObserver(this); 33 controller_->RemoveObserver(this);
32 callback_.Run(std::move(controller_)); 34 callback_.Run(std::move(controller_));
33 callback_.Reset(); 35 callback_.Reset();
34 } else if (new_stage != HostPairingController::STAGE_WAITING_FOR_CONTROLLER) { 36 } else if (new_stage != HostPairingController::STAGE_WAITING_FOR_CONTROLLER) {
35 LOG(ERROR) << "Unexpected stage " << new_stage; 37 LOG(ERROR) << "Unexpected stage " << new_stage;
36 } 38 }
37 } 39 }
38 40
39 } // namespace pairing_chromeos 41 } // namespace pairing_chromeos
OLDNEW
« no previous file with comments | « components/pairing/shark_connection_listener.h ('k') | device/hid/fake_input_service_linux.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698