| 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 "chrome/browser/ui/bluetooth/bluetooth_chooser_bubble_controller.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/browser/ui/bluetooth/bluetooth_chooser_controller.h" |
| 8 | 9 |
| 9 BluetoothChooserDesktop::BluetoothChooserDesktop( | 10 BluetoothChooserDesktop::BluetoothChooserDesktop( |
| 10 const content::BluetoothChooser::EventHandler& event_handler) | 11 BluetoothChooserController* bluetooth_chooser_controller) |
| 11 : event_handler_(event_handler), | 12 : bluetooth_chooser_controller_(bluetooth_chooser_controller) { |
| 12 bluetooth_chooser_bubble_controller_(nullptr) {} | 13 DCHECK(bluetooth_chooser_controller_); |
| 14 } |
| 13 | 15 |
| 14 BluetoothChooserDesktop::~BluetoothChooserDesktop() { | 16 BluetoothChooserDesktop::~BluetoothChooserDesktop() {} |
| 15 if (bluetooth_chooser_bubble_controller_) | |
| 16 bluetooth_chooser_bubble_controller_->set_bluetooth_chooser(nullptr); | |
| 17 } | |
| 18 | 17 |
| 19 void BluetoothChooserDesktop::SetAdapterPresence(AdapterPresence presence) {} | 18 void BluetoothChooserDesktop::SetAdapterPresence(AdapterPresence presence) {} |
| 20 | 19 |
| 21 void BluetoothChooserDesktop::ShowDiscoveryState(DiscoveryState state) {} | 20 void BluetoothChooserDesktop::ShowDiscoveryState(DiscoveryState state) {} |
| 22 | 21 |
| 23 void BluetoothChooserDesktop::AddDevice(const std::string& device_id, | 22 void BluetoothChooserDesktop::AddDevice(const std::string& device_id, |
| 24 const base::string16& device_name) { | 23 const base::string16& device_name) { |
| 25 if (bluetooth_chooser_bubble_controller_) | 24 bluetooth_chooser_controller_->AddDevice(device_id, device_name); |
| 26 bluetooth_chooser_bubble_controller_->AddDevice(device_id, device_name); | |
| 27 } | 25 } |
| 28 | 26 |
| 29 void BluetoothChooserDesktop::RemoveDevice(const std::string& device_id) { | 27 void BluetoothChooserDesktop::RemoveDevice(const std::string& device_id) { |
| 30 if (bluetooth_chooser_bubble_controller_) | 28 bluetooth_chooser_controller_->RemoveDevice(device_id); |
| 31 bluetooth_chooser_bubble_controller_->RemoveDevice(device_id); | |
| 32 } | 29 } |
| 33 | |
| 34 void BluetoothChooserDesktop::CallEventHandler( | |
| 35 content::BluetoothChooser::Event event, | |
| 36 const std::string& device_id) { | |
| 37 event_handler_.Run(event, device_id); | |
| 38 } | |
| OLD | NEW |