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

Unified Diff: chrome/browser/ui/bluetooth/bluetooth_chooser_controller.h

Issue 2210873003: bluetooth: Allow updates on chooser items. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-fix-advertised-services
Patch Set: Fix content_shell Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/bluetooth/bluetooth_chooser_controller.h
diff --git a/chrome/browser/ui/bluetooth/bluetooth_chooser_controller.h b/chrome/browser/ui/bluetooth/bluetooth_chooser_controller.h
index 35becbf0630361bb1392d759fd1eaba6dca89104..a6469afc8ca7c7c22233a19ad86c3e7a3f947f76 100644
--- a/chrome/browser/ui/bluetooth/bluetooth_chooser_controller.h
+++ b/chrome/browser/ui/bluetooth/bluetooth_chooser_controller.h
@@ -48,8 +48,8 @@ class BluetoothChooserController : public ChooserController {
void OnDiscoveryStateChanged(content::BluetoothChooser::DiscoveryState state);
// Shows a new device in the chooser.
juncai 2016/08/04 21:52:25 nit: update the comments.
ortuno 2016/08/05 02:16:09 Done.
- void AddDevice(const std::string& device_id,
- const base::string16& device_name);
+ void AddOrUpdateDevice(const std::string& device_id,
+ const base::string16& device_name);
// Tells the chooser that a device is no longer available.
void RemoveDevice(const std::string& device_id);
@@ -59,11 +59,12 @@ class BluetoothChooserController : public ChooserController {
// Bluetooth adapter is turned on or off, or when re-scan happens.
void ClearAllDevices();
- // Each pair is a (device name, device id).
- std::vector<std::pair<base::string16, std::string>> device_names_and_ids_;
- content::BluetoothChooser::EventHandler event_handler_;
+ std::vector<std::string> device_ids_;
+ std::unordered_map<std::string, base::string16> device_id_to_name_map_;
// Maps from device name to number of devices.
std::unordered_map<base::string16, int> device_name_map_;
+
+ content::BluetoothChooser::EventHandler event_handler_;
base::string16 no_devices_text_;
base::string16 status_text_;

Powered by Google App Engine
This is Rietveld 408576698