Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(407)

Side by Side Diff: chrome/browser/ui/bluetooth/bluetooth_chooser_desktop.cc

Issue 1984923002: Refactor ChooserBubbleController (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/bluetooth/bluetooth_chooser_desktop.h ('k') | chrome/browser/ui/browser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/bluetooth/bluetooth_chooser_desktop.h ('k') | chrome/browser/ui/browser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698