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

Side by Side Diff: components/pairing/bluetooth_host_pairing_controller.h

Issue 552983003: Wait for the Bluetooth adapter to be present before starting pairing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add missing OVERRIDE 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
« no previous file with comments | « no previous file | components/pairing/bluetooth_host_pairing_controller.cc » ('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 #ifndef CHROMEOS_PAIRING_BLUETOOTH_HOST_PAIRING_CONTROLLER_H_ 5 #ifndef CHROMEOS_PAIRING_BLUETOOTH_HOST_PAIRING_CONTROLLER_H_
6 #define CHROMEOS_PAIRING_BLUETOOTH_HOST_PAIRING_CONTROLLER_H_ 6 #define CHROMEOS_PAIRING_BLUETOOTH_HOST_PAIRING_CONTROLLER_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "base/observer_list.h" 11 #include "base/observer_list.h"
12 #include "base/threading/thread_checker.h" 12 #include "base/threading/thread_checker.h"
13 #include "components/pairing/host_pairing_controller.h" 13 #include "components/pairing/host_pairing_controller.h"
14 #include "components/pairing/proto_decoder.h" 14 #include "components/pairing/proto_decoder.h"
15 #include "device/bluetooth/bluetooth_adapter.h"
15 #include "device/bluetooth/bluetooth_device.h" 16 #include "device/bluetooth/bluetooth_device.h"
16 #include "device/bluetooth/bluetooth_socket.h" 17 #include "device/bluetooth/bluetooth_socket.h"
17 18
18 namespace device { 19 namespace device {
19 class BluetoothAdapter; 20 class BluetoothAdapter;
20 } 21 }
21 22
22 namespace net { 23 namespace net {
23 class IOBuffer; 24 class IOBuffer;
24 } 25 }
25 26
26 namespace pairing_chromeos { 27 namespace pairing_chromeos {
27 28
28 class BluetoothHostPairingController 29 class BluetoothHostPairingController
29 : public HostPairingController, 30 : public HostPairingController,
30 public ProtoDecoder::Observer, 31 public ProtoDecoder::Observer,
32 public device::BluetoothAdapter::Observer,
31 public device::BluetoothDevice::PairingDelegate { 33 public device::BluetoothDevice::PairingDelegate {
32 public: 34 public:
33 typedef HostPairingController::Observer Observer; 35 typedef HostPairingController::Observer Observer;
34 36
35 BluetoothHostPairingController(); 37 BluetoothHostPairingController();
36 virtual ~BluetoothHostPairingController(); 38 virtual ~BluetoothHostPairingController();
37 39
38 private: 40 private:
39 void ChangeStage(Stage new_stage); 41 void ChangeStage(Stage new_stage);
40 void SendHostStatus(); 42 void SendHostStatus();
41 void AbortWithError(int code, const std::string& message); 43 void AbortWithError(int code, const std::string& message);
42 void Reset(); 44 void Reset();
43 45
44 void OnGetAdapter(scoped_refptr<device::BluetoothAdapter> adapter); 46 void OnGetAdapter(scoped_refptr<device::BluetoothAdapter> adapter);
47 void SetName();
45 void OnSetName(); 48 void OnSetName();
46 void OnSetPowered(); 49 void OnSetPowered();
47 void OnCreateService(scoped_refptr<device::BluetoothSocket> socket); 50 void OnCreateService(scoped_refptr<device::BluetoothSocket> socket);
48 void OnSetDiscoverable(bool change_stage); 51 void OnSetDiscoverable(bool change_stage);
49 void OnAccept(const device::BluetoothDevice* device, 52 void OnAccept(const device::BluetoothDevice* device,
50 scoped_refptr<device::BluetoothSocket> socket); 53 scoped_refptr<device::BluetoothSocket> socket);
51 void OnSendComplete(int bytes_sent); 54 void OnSendComplete(int bytes_sent);
52 void OnReceiveComplete(int bytes, scoped_refptr<net::IOBuffer> io_buffer); 55 void OnReceiveComplete(int bytes, scoped_refptr<net::IOBuffer> io_buffer);
53 56
54 void OnCreateServiceError(const std::string& message); 57 void OnCreateServiceError(const std::string& message);
(...skipping 18 matching lines...) Expand all
73 virtual void OnHostStatusMessage( 76 virtual void OnHostStatusMessage(
74 const pairing_api::HostStatus& message) OVERRIDE; 77 const pairing_api::HostStatus& message) OVERRIDE;
75 virtual void OnConfigureHostMessage( 78 virtual void OnConfigureHostMessage(
76 const pairing_api::ConfigureHost& message) OVERRIDE; 79 const pairing_api::ConfigureHost& message) OVERRIDE;
77 virtual void OnPairDevicesMessage( 80 virtual void OnPairDevicesMessage(
78 const pairing_api::PairDevices& message) OVERRIDE; 81 const pairing_api::PairDevices& message) OVERRIDE;
79 virtual void OnCompleteSetupMessage( 82 virtual void OnCompleteSetupMessage(
80 const pairing_api::CompleteSetup& message) OVERRIDE; 83 const pairing_api::CompleteSetup& message) OVERRIDE;
81 virtual void OnErrorMessage(const pairing_api::Error& message) OVERRIDE; 84 virtual void OnErrorMessage(const pairing_api::Error& message) OVERRIDE;
82 85
86 // BluetoothAdapter::Observer:
87 virtual void AdapterPresentChanged(device::BluetoothAdapter* adapter,
88 bool present) OVERRIDE;
89
83 // device::BluetoothDevice::PairingDelegate: 90 // device::BluetoothDevice::PairingDelegate:
84 virtual void RequestPinCode(device::BluetoothDevice* device) OVERRIDE; 91 virtual void RequestPinCode(device::BluetoothDevice* device) OVERRIDE;
85 virtual void RequestPasskey(device::BluetoothDevice* device) OVERRIDE; 92 virtual void RequestPasskey(device::BluetoothDevice* device) OVERRIDE;
86 virtual void DisplayPinCode(device::BluetoothDevice* device, 93 virtual void DisplayPinCode(device::BluetoothDevice* device,
87 const std::string& pincode) OVERRIDE; 94 const std::string& pincode) OVERRIDE;
88 virtual void DisplayPasskey(device::BluetoothDevice* device, 95 virtual void DisplayPasskey(device::BluetoothDevice* device,
89 uint32 passkey) OVERRIDE; 96 uint32 passkey) OVERRIDE;
90 virtual void KeysEntered(device::BluetoothDevice* device, 97 virtual void KeysEntered(device::BluetoothDevice* device,
91 uint32 entered) OVERRIDE; 98 uint32 entered) OVERRIDE;
92 virtual void ConfirmPasskey(device::BluetoothDevice* device, 99 virtual void ConfirmPasskey(device::BluetoothDevice* device,
(...skipping 14 matching lines...) Expand all
107 base::ThreadChecker thread_checker_; 114 base::ThreadChecker thread_checker_;
108 ObserverList<Observer> observers_; 115 ObserverList<Observer> observers_;
109 base::WeakPtrFactory<BluetoothHostPairingController> ptr_factory_; 116 base::WeakPtrFactory<BluetoothHostPairingController> ptr_factory_;
110 117
111 DISALLOW_COPY_AND_ASSIGN(BluetoothHostPairingController); 118 DISALLOW_COPY_AND_ASSIGN(BluetoothHostPairingController);
112 }; 119 };
113 120
114 } // namespace pairing_chromeos 121 } // namespace pairing_chromeos
115 122
116 #endif // CHROMEOS_PAIRING_BLUETOOTH_HOST_PAIRING_CONTROLLER_H_ 123 #endif // CHROMEOS_PAIRING_BLUETOOTH_HOST_PAIRING_CONTROLLER_H_
OLDNEW
« no previous file with comments | « no previous file | components/pairing/bluetooth_host_pairing_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698