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

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

Issue 2245603003: Add signal strength indicator icon to WebBluetooth chooser on non-Mac desktops (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address more comments 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 55f655e7b4df4608a889152a0746ef6552147cb1..37b1f9684deb7a378b88b7ba45c16f4f33342fc6 100644
--- a/chrome/browser/ui/bluetooth/bluetooth_chooser_controller.h
+++ b/chrome/browser/ui/bluetooth/bluetooth_chooser_controller.h
@@ -28,9 +28,11 @@ class BluetoothChooserController : public ChooserController {
~BluetoothChooserController() override;
// ChooserController:
+ bool ShouldShowIconBeforeText() const override;
base::string16 GetNoOptionsText() const override;
base::string16 GetOkButtonLabel() const override;
size_t NumOptions() const override;
+ int GetSignalStrengthLevel(size_t index) const override;
base::string16 GetOption(size_t index) const override;
void RefreshOptions() override;
base::string16 GetStatus() const override;
@@ -48,12 +50,13 @@ class BluetoothChooserController : public ChooserController {
void OnDiscoveryStateChanged(content::BluetoothChooser::DiscoveryState state);
// Shows a new device in the chooser or updates its information.
+ // The range of |signal_strength_level| is -1 to 4 inclusively.
void AddOrUpdateDevice(const std::string& device_id,
bool should_update_name,
const base::string16& device_name,
bool is_gatt_connected,
bool is_paired,
- const int8_t* rssi);
+ int signal_strength_level);
// Tells the chooser that a device is no longer available.
void RemoveDevice(const std::string& device_id);
@@ -63,11 +66,16 @@ class BluetoothChooserController : public ChooserController {
void ResetEventHandler();
private:
+ struct BluetoothDeviceInfo {
+ std::string id;
+ int signal_strength_level;
+ };
+
// Clears |device_names_and_ids_| and |device_name_counts_|. Called when
// Bluetooth adapter is turned on or off, or when re-scan happens.
void ClearAllDevices();
- std::vector<std::string> device_ids_;
+ std::vector<BluetoothDeviceInfo> devices_;
std::unordered_map<std::string, base::string16> device_id_to_name_map_;
// Maps from device name to number of devices with that name.
std::unordered_map<base::string16, int> device_name_counts_;
« no previous file with comments | « chrome/browser/ui/android/bluetooth_chooser_android.cc ('k') | chrome/browser/ui/bluetooth/bluetooth_chooser_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698