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 #ifndef COMPONENTS_PAIRING_BLUETOOTH_CONTROLLER_PAIRING_CONTROLLER_H_ | 5 #ifndef COMPONENTS_PAIRING_BLUETOOTH_CONTROLLER_PAIRING_CONTROLLER_H_ |
6 #define COMPONENTS_PAIRING_BLUETOOTH_CONTROLLER_PAIRING_CONTROLLER_H_ | 6 #define COMPONENTS_PAIRING_BLUETOOTH_CONTROLLER_PAIRING_CONTROLLER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
| 10 #include <memory> |
10 #include <set> | 11 #include <set> |
11 | 12 |
12 #include "base/macros.h" | 13 #include "base/macros.h" |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
15 #include "base/threading/thread_checker.h" | 15 #include "base/threading/thread_checker.h" |
16 #include "components/pairing/controller_pairing_controller.h" | 16 #include "components/pairing/controller_pairing_controller.h" |
17 #include "components/pairing/proto_decoder.h" | 17 #include "components/pairing/proto_decoder.h" |
18 #include "device/bluetooth/bluetooth_adapter.h" | 18 #include "device/bluetooth/bluetooth_adapter.h" |
19 #include "device/bluetooth/bluetooth_device.h" | 19 #include "device/bluetooth/bluetooth_device.h" |
20 #include "device/bluetooth/bluetooth_socket.h" | 20 #include "device/bluetooth/bluetooth_socket.h" |
21 | 21 |
22 namespace net { | 22 namespace net { |
23 class IOBuffer; | 23 class IOBuffer; |
(...skipping 15 matching lines...) Expand all Loading... |
39 device::BluetoothDevice* GetController(); | 39 device::BluetoothDevice* GetController(); |
40 void Reset(); | 40 void Reset(); |
41 void DeviceFound(device::BluetoothDevice* device); | 41 void DeviceFound(device::BluetoothDevice* device); |
42 void DeviceLost(device::BluetoothDevice* device); | 42 void DeviceLost(device::BluetoothDevice* device); |
43 void SendBuffer(scoped_refptr<net::IOBuffer> io_buffer, int size); | 43 void SendBuffer(scoped_refptr<net::IOBuffer> io_buffer, int size); |
44 void CompleteSetup(); | 44 void CompleteSetup(); |
45 | 45 |
46 void OnSetPowered(); | 46 void OnSetPowered(); |
47 void OnGetAdapter(scoped_refptr<device::BluetoothAdapter> adapter); | 47 void OnGetAdapter(scoped_refptr<device::BluetoothAdapter> adapter); |
48 void OnStartDiscoverySession( | 48 void OnStartDiscoverySession( |
49 scoped_ptr<device::BluetoothDiscoverySession> discovery_session); | 49 std::unique_ptr<device::BluetoothDiscoverySession> discovery_session); |
50 void OnConnect(); | 50 void OnConnect(); |
51 void OnConnectToService(scoped_refptr<device::BluetoothSocket> socket); | 51 void OnConnectToService(scoped_refptr<device::BluetoothSocket> socket); |
52 void OnSendComplete(int bytes_sent); | 52 void OnSendComplete(int bytes_sent); |
53 void OnReceiveComplete(int bytes, scoped_refptr<net::IOBuffer> io_buffer); | 53 void OnReceiveComplete(int bytes, scoped_refptr<net::IOBuffer> io_buffer); |
54 | 54 |
55 void OnError(); | 55 void OnError(); |
56 void OnErrorWithMessage(const std::string& message); | 56 void OnErrorWithMessage(const std::string& message); |
57 void OnConnectError(device::BluetoothDevice::ConnectErrorCode error_code); | 57 void OnConnectError(device::BluetoothDevice::ConnectErrorCode error_code); |
58 void OnReceiveError(device::BluetoothSocket::ErrorReason reason, | 58 void OnReceiveError(device::BluetoothSocket::ErrorReason reason, |
59 const std::string& error_message); | 59 const std::string& error_message); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 const std::string& pincode) override; | 101 const std::string& pincode) override; |
102 void DisplayPasskey(device::BluetoothDevice* device, | 102 void DisplayPasskey(device::BluetoothDevice* device, |
103 uint32_t passkey) override; | 103 uint32_t passkey) override; |
104 void KeysEntered(device::BluetoothDevice* device, uint32_t entered) override; | 104 void KeysEntered(device::BluetoothDevice* device, uint32_t entered) override; |
105 void ConfirmPasskey(device::BluetoothDevice* device, | 105 void ConfirmPasskey(device::BluetoothDevice* device, |
106 uint32_t passkey) override; | 106 uint32_t passkey) override; |
107 void AuthorizePairing(device::BluetoothDevice* device) override; | 107 void AuthorizePairing(device::BluetoothDevice* device) override; |
108 | 108 |
109 Stage current_stage_; | 109 Stage current_stage_; |
110 scoped_refptr<device::BluetoothAdapter> adapter_; | 110 scoped_refptr<device::BluetoothAdapter> adapter_; |
111 scoped_ptr<device::BluetoothDiscoverySession> discovery_session_; | 111 std::unique_ptr<device::BluetoothDiscoverySession> discovery_session_; |
112 scoped_refptr<device::BluetoothSocket> socket_; | 112 scoped_refptr<device::BluetoothSocket> socket_; |
113 std::string controller_device_id_; | 113 std::string controller_device_id_; |
114 | 114 |
115 std::string confirmation_code_; | 115 std::string confirmation_code_; |
116 std::set<std::string> discovered_devices_; | 116 std::set<std::string> discovered_devices_; |
117 | 117 |
118 scoped_ptr<ProtoDecoder> proto_decoder_; | 118 std::unique_ptr<ProtoDecoder> proto_decoder_; |
119 | 119 |
120 base::ThreadChecker thread_checker_; | 120 base::ThreadChecker thread_checker_; |
121 base::ObserverList<ControllerPairingController::Observer> observers_; | 121 base::ObserverList<ControllerPairingController::Observer> observers_; |
122 base::WeakPtrFactory<BluetoothControllerPairingController> ptr_factory_; | 122 base::WeakPtrFactory<BluetoothControllerPairingController> ptr_factory_; |
123 | 123 |
124 DISALLOW_COPY_AND_ASSIGN(BluetoothControllerPairingController); | 124 DISALLOW_COPY_AND_ASSIGN(BluetoothControllerPairingController); |
125 }; | 125 }; |
126 | 126 |
127 } // namespace pairing_chromeos | 127 } // namespace pairing_chromeos |
128 | 128 |
129 #endif // COMPONENTS_PAIRING_BLUETOOTH_CONTROLLER_PAIRING_CONTROLLER_H_ | 129 #endif // COMPONENTS_PAIRING_BLUETOOTH_CONTROLLER_PAIRING_CONTROLLER_H_ |
OLD | NEW |