| 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_HOST_PAIRING_CONTROLLER_H_ | 5 #ifndef COMPONENTS_PAIRING_BLUETOOTH_HOST_PAIRING_CONTROLLER_H_ |
| 6 #define COMPONENTS_PAIRING_BLUETOOTH_HOST_PAIRING_CONTROLLER_H_ | 6 #define COMPONENTS_PAIRING_BLUETOOTH_HOST_PAIRING_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 | 67 |
| 68 // These functions should be only used in tests. | 68 // These functions should be only used in tests. |
| 69 void SetDelegateForTesting(TestDelegate* delegate); | 69 void SetDelegateForTesting(TestDelegate* delegate); |
| 70 scoped_refptr<device::BluetoothAdapter> GetAdapterForTesting(); | 70 scoped_refptr<device::BluetoothAdapter> GetAdapterForTesting(); |
| 71 | 71 |
| 72 private: | 72 private: |
| 73 friend class chromeos::BluetoothHostPairingNoInputTest; | 73 friend class chromeos::BluetoothHostPairingNoInputTest; |
| 74 | 74 |
| 75 void ChangeStage(Stage new_stage); | 75 void ChangeStage(Stage new_stage); |
| 76 void SendHostStatus(); | 76 void SendHostStatus(); |
| 77 void SendErrorCodeAndMessage(); |
| 77 | 78 |
| 78 void OnGetAdapter(scoped_refptr<device::BluetoothAdapter> adapter); | 79 void OnGetAdapter(scoped_refptr<device::BluetoothAdapter> adapter); |
| 79 void SetName(); | 80 void SetName(); |
| 80 void OnSetName(); | 81 void OnSetName(); |
| 81 void OnSetPowered(); | 82 void OnSetPowered(); |
| 82 void OnCreateService(scoped_refptr<device::BluetoothSocket> socket); | 83 void OnCreateService(scoped_refptr<device::BluetoothSocket> socket); |
| 83 void OnSetDiscoverable(bool change_stage); | 84 void OnSetDiscoverable(bool change_stage); |
| 84 void OnAccept(const device::BluetoothDevice* device, | 85 void OnAccept(const device::BluetoothDevice* device, |
| 85 scoped_refptr<device::BluetoothSocket> socket); | 86 scoped_refptr<device::BluetoothSocket> socket); |
| 86 void OnSendComplete(int bytes_sent); | 87 void OnSendComplete(int bytes_sent); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 103 void RemoveObserver(Observer* observer) override; | 104 void RemoveObserver(Observer* observer) override; |
| 104 Stage GetCurrentStage() override; | 105 Stage GetCurrentStage() override; |
| 105 void StartPairing() override; | 106 void StartPairing() override; |
| 106 std::string GetDeviceName() override; | 107 std::string GetDeviceName() override; |
| 107 std::string GetConfirmationCode() override; | 108 std::string GetConfirmationCode() override; |
| 108 std::string GetEnrollmentDomain() override; | 109 std::string GetEnrollmentDomain() override; |
| 109 void OnNetworkConnectivityChanged(Connectivity connectivity_status) override; | 110 void OnNetworkConnectivityChanged(Connectivity connectivity_status) override; |
| 110 void OnUpdateStatusChanged(UpdateStatus update_status) override; | 111 void OnUpdateStatusChanged(UpdateStatus update_status) override; |
| 111 void OnEnrollmentStatusChanged(EnrollmentStatus enrollment_status) override; | 112 void OnEnrollmentStatusChanged(EnrollmentStatus enrollment_status) override; |
| 112 void SetPermanentId(const std::string& permanent_id) override; | 113 void SetPermanentId(const std::string& permanent_id) override; |
| 114 void SetErrorCodeAndMessage(int error_code, |
| 115 const std::string& error_message) override; |
| 113 void Reset() override; | 116 void Reset() override; |
| 114 | 117 |
| 115 // ProtoDecoder::Observer: | 118 // ProtoDecoder::Observer: |
| 116 void OnHostStatusMessage(const pairing_api::HostStatus& message) override; | 119 void OnHostStatusMessage(const pairing_api::HostStatus& message) override; |
| 117 void OnConfigureHostMessage( | 120 void OnConfigureHostMessage( |
| 118 const pairing_api::ConfigureHost& message) override; | 121 const pairing_api::ConfigureHost& message) override; |
| 119 void OnPairDevicesMessage(const pairing_api::PairDevices& message) override; | 122 void OnPairDevicesMessage(const pairing_api::PairDevices& message) override; |
| 120 void OnCompleteSetupMessage( | 123 void OnCompleteSetupMessage( |
| 121 const pairing_api::CompleteSetup& message) override; | 124 const pairing_api::CompleteSetup& message) override; |
| 122 void OnErrorMessage(const pairing_api::Error& message) override; | 125 void OnErrorMessage(const pairing_api::Error& message) override; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 142 std::string device_name_; | 145 std::string device_name_; |
| 143 std::string confirmation_code_; | 146 std::string confirmation_code_; |
| 144 std::string enrollment_domain_; | 147 std::string enrollment_domain_; |
| 145 Connectivity connectivity_status_; | 148 Connectivity connectivity_status_; |
| 146 UpdateStatus update_status_; | 149 UpdateStatus update_status_; |
| 147 EnrollmentStatus enrollment_status_; | 150 EnrollmentStatus enrollment_status_; |
| 148 std::string permanent_id_; | 151 std::string permanent_id_; |
| 149 std::string controller_device_address_; | 152 std::string controller_device_address_; |
| 150 bool was_powered_ = false; | 153 bool was_powered_ = false; |
| 151 | 154 |
| 155 int error_code_ = 0; |
| 156 std::string error_message_; |
| 157 |
| 152 scoped_refptr<device::BluetoothAdapter> adapter_; | 158 scoped_refptr<device::BluetoothAdapter> adapter_; |
| 153 scoped_refptr<device::BluetoothSocket> service_socket_; | 159 scoped_refptr<device::BluetoothSocket> service_socket_; |
| 154 scoped_refptr<device::BluetoothSocket> controller_socket_; | 160 scoped_refptr<device::BluetoothSocket> controller_socket_; |
| 155 std::unique_ptr<ProtoDecoder> proto_decoder_; | 161 std::unique_ptr<ProtoDecoder> proto_decoder_; |
| 156 TestDelegate* delegate_ = nullptr; | 162 TestDelegate* delegate_ = nullptr; |
| 157 | 163 |
| 158 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_; | 164 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_; |
| 159 base::ThreadChecker thread_checker_; | 165 base::ThreadChecker thread_checker_; |
| 160 base::ObserverList<Observer> observers_; | 166 base::ObserverList<Observer> observers_; |
| 161 base::WeakPtrFactory<BluetoothHostPairingController> ptr_factory_; | 167 base::WeakPtrFactory<BluetoothHostPairingController> ptr_factory_; |
| 162 | 168 |
| 163 DISALLOW_COPY_AND_ASSIGN(BluetoothHostPairingController); | 169 DISALLOW_COPY_AND_ASSIGN(BluetoothHostPairingController); |
| 164 }; | 170 }; |
| 165 | 171 |
| 166 } // namespace pairing_chromeos | 172 } // namespace pairing_chromeos |
| 167 | 173 |
| 168 #endif // COMPONENTS_PAIRING_BLUETOOTH_HOST_PAIRING_CONTROLLER_H_ | 174 #endif // COMPONENTS_PAIRING_BLUETOOTH_HOST_PAIRING_CONTROLLER_H_ |
| OLD | NEW |