| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "chrome/browser/ui/bluetooth/bluetooth_chooser_desktop.h" | 5 #include "chrome/browser/ui/bluetooth/bluetooth_chooser_desktop.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/browser/ui/bluetooth/bluetooth_chooser_controller.h" | 8 #include "chrome/browser/ui/bluetooth/bluetooth_chooser_controller.h" |
| 9 | 9 |
| 10 BluetoothChooserDesktop::BluetoothChooserDesktop( | 10 BluetoothChooserDesktop::BluetoothChooserDesktop( |
| 11 BluetoothChooserController* bluetooth_chooser_controller) | 11 BluetoothChooserController* bluetooth_chooser_controller) |
| 12 : bluetooth_chooser_controller_(bluetooth_chooser_controller) { | 12 : bluetooth_chooser_controller_(bluetooth_chooser_controller) { |
| 13 DCHECK(bluetooth_chooser_controller_); | 13 DCHECK(bluetooth_chooser_controller_); |
| 14 } | 14 } |
| 15 | 15 |
| 16 BluetoothChooserDesktop::~BluetoothChooserDesktop() {} | 16 BluetoothChooserDesktop::~BluetoothChooserDesktop() { |
| 17 // This satisfies the WebContentsDelegate::RunBluetoothChooser() requirement |
| 18 // that the EventHandler can be destroyed any time after the BluetoothChooser |
| 19 // instance. |
| 20 bluetooth_chooser_controller_->ResetEventHandler(); |
| 21 } |
| 17 | 22 |
| 18 void BluetoothChooserDesktop::SetAdapterPresence(AdapterPresence presence) { | 23 void BluetoothChooserDesktop::SetAdapterPresence(AdapterPresence presence) { |
| 19 bluetooth_chooser_controller_->OnAdapterPresenceChanged(presence); | 24 bluetooth_chooser_controller_->OnAdapterPresenceChanged(presence); |
| 20 } | 25 } |
| 21 | 26 |
| 22 void BluetoothChooserDesktop::ShowDiscoveryState(DiscoveryState state) { | 27 void BluetoothChooserDesktop::ShowDiscoveryState(DiscoveryState state) { |
| 23 bluetooth_chooser_controller_->OnDiscoveryStateChanged(state); | 28 bluetooth_chooser_controller_->OnDiscoveryStateChanged(state); |
| 24 } | 29 } |
| 25 | 30 |
| 26 void BluetoothChooserDesktop::AddDevice(const std::string& device_id, | 31 void BluetoothChooserDesktop::AddDevice(const std::string& device_id, |
| 27 const base::string16& device_name) { | 32 const base::string16& device_name) { |
| 28 bluetooth_chooser_controller_->AddDevice(device_id, device_name); | 33 bluetooth_chooser_controller_->AddDevice(device_id, device_name); |
| 29 } | 34 } |
| 30 | 35 |
| 31 void BluetoothChooserDesktop::RemoveDevice(const std::string& device_id) { | 36 void BluetoothChooserDesktop::RemoveDevice(const std::string& device_id) { |
| 32 bluetooth_chooser_controller_->RemoveDevice(device_id); | 37 bluetooth_chooser_controller_->RemoveDevice(device_id); |
| 33 } | 38 } |
| OLD | NEW |