| 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 "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" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 public ProtoDecoder::Observer, | 31 public ProtoDecoder::Observer, |
| 32 public device::BluetoothAdapter::Observer, | 32 public device::BluetoothAdapter::Observer, |
| 33 public device::BluetoothDevice::PairingDelegate { | 33 public device::BluetoothDevice::PairingDelegate { |
| 34 public: | 34 public: |
| 35 typedef HostPairingController::Observer Observer; | 35 typedef HostPairingController::Observer Observer; |
| 36 | 36 |
| 37 BluetoothHostPairingController(); | 37 BluetoothHostPairingController(); |
| 38 ~BluetoothHostPairingController() override; | 38 ~BluetoothHostPairingController() override; |
| 39 | 39 |
| 40 private: | 40 private: |
| 41 void ChangeStage(Stage new_stage); | |
| 42 void SendHostStatus(); | 41 void SendHostStatus(); |
| 43 void AbortWithError(int code, const std::string& message); | 42 void AbortWithError(int code, const std::string& message); |
| 44 void Reset(); | 43 void Reset(); |
| 45 | 44 |
| 46 void OnGetAdapter(scoped_refptr<device::BluetoothAdapter> adapter); | 45 void OnGetAdapter(scoped_refptr<device::BluetoothAdapter> adapter); |
| 47 void SetName(); | 46 void SetName(); |
| 48 void OnSetName(); | 47 void OnSetName(); |
| 49 void OnSetPowered(); | 48 void OnSetPowered(); |
| 50 void OnCreateService(scoped_refptr<device::BluetoothSocket> socket); | 49 void OnCreateService(scoped_refptr<device::BluetoothSocket> socket); |
| 51 void OnSetDiscoverable(bool change_stage); | 50 void OnSetDiscoverable(bool change_stage); |
| 52 void OnAccept(const device::BluetoothDevice* device, | 51 void OnAccept(const device::BluetoothDevice* device, |
| 53 scoped_refptr<device::BluetoothSocket> socket); | 52 scoped_refptr<device::BluetoothSocket> socket); |
| 54 void OnSendComplete(int bytes_sent); | 53 void OnSendComplete(int bytes_sent); |
| 55 void OnReceiveComplete(int bytes, scoped_refptr<net::IOBuffer> io_buffer); | 54 void OnReceiveComplete(int bytes, scoped_refptr<net::IOBuffer> io_buffer); |
| 56 | 55 |
| 57 void OnCreateServiceError(const std::string& message); | 56 void OnCreateServiceError(const std::string& message); |
| 58 void OnSetError(); | 57 void OnSetError(); |
| 59 void OnAcceptError(const std::string& error_message); | 58 void OnAcceptError(const std::string& error_message); |
| 60 void OnSendError(const std::string& error_message); | 59 void OnSendError(const std::string& error_message); |
| 61 void OnReceiveError(device::BluetoothSocket::ErrorReason reason, | 60 void OnReceiveError(device::BluetoothSocket::ErrorReason reason, |
| 62 const std::string& error_message); | 61 const std::string& error_message); |
| 63 | 62 |
| 64 // HostPairingController: | 63 // HostPairingController: |
| 65 void AddObserver(Observer* observer) override; | 64 void AddObserver(Observer* observer) override; |
| 66 void RemoveObserver(Observer* observer) override; | 65 void RemoveObserver(Observer* observer) override; |
| 67 Stage GetCurrentStage() override; | 66 Stage GetCurrentStage() override; |
| 67 void ChangeStage(Stage new_stage) override; |
| 68 void StartPairing() override; | 68 void StartPairing() override; |
| 69 std::string GetDeviceName() override; | 69 std::string GetDeviceName() override; |
| 70 std::string GetConfirmationCode() override; | 70 std::string GetConfirmationCode() override; |
| 71 std::string GetEnrollmentDomain() override; | 71 std::string GetEnrollmentDomain() override; |
| 72 void OnUpdateStatusChanged(UpdateStatus update_status) override; | 72 void OnUpdateStatusChanged(UpdateStatus update_status) override; |
| 73 void OnEnrollmentStatusChanged(EnrollmentStatus enrollment_status) override; | 73 void OnEnrollmentStatusChanged(EnrollmentStatus enrollment_status) override; |
| 74 void SetPermanentId(const std::string& permanent_id) override; | 74 void SetPermanentId(const std::string& permanent_id) override; |
| 75 | 75 |
| 76 // ProtoDecoder::Observer: | 76 // ProtoDecoder::Observer: |
| 77 void OnHostStatusMessage(const pairing_api::HostStatus& message) override; | 77 void OnHostStatusMessage(const pairing_api::HostStatus& message) override; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 base::ThreadChecker thread_checker_; | 113 base::ThreadChecker thread_checker_; |
| 114 base::ObserverList<Observer> observers_; | 114 base::ObserverList<Observer> observers_; |
| 115 base::WeakPtrFactory<BluetoothHostPairingController> ptr_factory_; | 115 base::WeakPtrFactory<BluetoothHostPairingController> ptr_factory_; |
| 116 | 116 |
| 117 DISALLOW_COPY_AND_ASSIGN(BluetoothHostPairingController); | 117 DISALLOW_COPY_AND_ASSIGN(BluetoothHostPairingController); |
| 118 }; | 118 }; |
| 119 | 119 |
| 120 } // namespace pairing_chromeos | 120 } // namespace pairing_chromeos |
| 121 | 121 |
| 122 #endif // COMPONENTS_PAIRING_BLUETOOTH_HOST_PAIRING_CONTROLLER_H_ | 122 #endif // COMPONENTS_PAIRING_BLUETOOTH_HOST_PAIRING_CONTROLLER_H_ |
| OLD | NEW |