Chromium Code Reviews| Index: components/pairing/bluetooth_host_pairing_controller.cc |
| diff --git a/components/pairing/bluetooth_host_pairing_controller.cc b/components/pairing/bluetooth_host_pairing_controller.cc |
| index 1d3562802588361a164e0b9f49bfac5c5dc068a6..5a9c9904665ee12402063ebb8355bd55b65f1546 100644 |
| --- a/components/pairing/bluetooth_host_pairing_controller.cc |
| +++ b/components/pairing/bluetooth_host_pairing_controller.cc |
| @@ -65,8 +65,7 @@ BluetoothHostPairingController::BluetoothHostPairingController() |
| } |
| BluetoothHostPairingController::~BluetoothHostPairingController() { |
| - if (adapter_.get()) |
| - adapter_->RemoveObserver(this); |
| + Reset(); |
|
achuithb
2014/10/27 21:32:34
This also calls ChangeStage, which calls the obser
|
| } |
| void BluetoothHostPairingController::ChangeStage(Stage new_stage) { |
| @@ -141,6 +140,15 @@ void BluetoothHostPairingController::Reset() { |
| service_socket_->Close(); |
| service_socket_ = NULL; |
| } |
| + |
| + if (adapter_.get()) { |
| + if (adapter_->IsDiscoverable()) { |
| + adapter_->SetDiscoverable(false, base::Closure(), base::Closure()); |
| + } |
| + adapter_->RemoveObserver(this); |
| + adapter_ = NULL; |
| + } |
| + |
| ChangeStage(STAGE_NONE); |
|
achuithb
2014/10/27 21:32:34
Should we get rid of this?
|
| } |
| @@ -282,7 +290,6 @@ void BluetoothHostPairingController::OnSetError() { |
| void BluetoothHostPairingController::OnAcceptError( |
| const std::string& error_message) { |
| LOG(ERROR) << error_message; |
| - Reset(); |
| } |
| void BluetoothHostPairingController::OnSendError( |
| @@ -294,7 +301,6 @@ void BluetoothHostPairingController::OnReceiveError( |
| device::BluetoothSocket::ErrorReason reason, |
| const std::string& error_message) { |
| LOG(ERROR) << reason << ", " << error_message; |
| - Reset(); |
| } |
| void BluetoothHostPairingController::OnHostStatusMessage( |