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

Side by Side 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: added signal strength indicator icon to WebBluetooth chooser 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 unified diff | Download patch
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 #ifndef CHROME_BROWSER_UI_BLUETOOTH_BLUETOOTH_CHOOSER_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_UI_BLUETOOTH_BLUETOOTH_CHOOSER_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_BLUETOOTH_BLUETOOTH_CHOOSER_CONTROLLER_H_ 6 #define CHROME_BROWSER_UI_BLUETOOTH_BLUETOOTH_CHOOSER_CONTROLLER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 10 matching lines...) Expand all
21 // It can be used by WebBluetooth API to get the user's permission to 21 // It can be used by WebBluetooth API to get the user's permission to
22 // access a Bluetooth device. It is owned by ChooserBubbleDelegate. 22 // access a Bluetooth device. It is owned by ChooserBubbleDelegate.
23 class BluetoothChooserController : public ChooserController { 23 class BluetoothChooserController : public ChooserController {
24 public: 24 public:
25 explicit BluetoothChooserController( 25 explicit BluetoothChooserController(
26 content::RenderFrameHost* owner, 26 content::RenderFrameHost* owner,
27 const content::BluetoothChooser::EventHandler& event_handler); 27 const content::BluetoothChooser::EventHandler& event_handler);
28 ~BluetoothChooserController() override; 28 ~BluetoothChooserController() override;
29 29
30 // ChooserController: 30 // ChooserController:
31 bool HasIconBeforeText() const override;
31 base::string16 GetNoOptionsText() const override; 32 base::string16 GetNoOptionsText() const override;
32 base::string16 GetOkButtonLabel() const override; 33 base::string16 GetOkButtonLabel() const override;
33 size_t NumOptions() const override; 34 size_t NumOptions() const override;
35 int GetSignalStrengthLevel(size_t index) const override;
34 base::string16 GetOption(size_t index) const override; 36 base::string16 GetOption(size_t index) const override;
35 void RefreshOptions() override; 37 void RefreshOptions() override;
36 base::string16 GetStatus() const override; 38 base::string16 GetStatus() const override;
37 void Select(size_t index) override; 39 void Select(size_t index) override;
38 void Cancel() override; 40 void Cancel() override;
39 void Close() override; 41 void Close() override;
40 void OpenHelpCenterUrl() const override; 42 void OpenHelpCenterUrl() const override;
41 43
42 // Update the state of the Bluetooth adapter. 44 // Update the state of the Bluetooth adapter.
43 void OnAdapterPresenceChanged( 45 void OnAdapterPresenceChanged(
(...skipping 14 matching lines...) Expand all
58 const int8_t* rssi); 60 const int8_t* rssi);
59 61
60 // Tells the chooser that a device is no longer available. 62 // Tells the chooser that a device is no longer available.
61 void RemoveDevice(const std::string& device_id); 63 void RemoveDevice(const std::string& device_id);
62 64
63 // Called when |event_handler_| is no longer valid and should not be used 65 // Called when |event_handler_| is no longer valid and should not be used
64 // any more. 66 // any more.
65 void ResetEventHandler(); 67 void ResetEventHandler();
66 68
67 private: 69 private:
70 struct BluetoothDeviceInfo {
71 std::string id;
72 int signal_level;
msw 2016/08/12 23:08:48 nit: |signal_strength_level|
juncai 2016/08/15 21:53:19 Done.
73 };
74
68 // Clears |device_names_and_ids_| and |device_name_map_|. Called when 75 // Clears |device_names_and_ids_| and |device_name_map_|. Called when
69 // Bluetooth adapter is turned on or off, or when re-scan happens. 76 // Bluetooth adapter is turned on or off, or when re-scan happens.
70 void ClearAllDevices(); 77 void ClearAllDevices();
71 78
72 std::vector<std::string> device_ids_; 79 std::vector<BluetoothDeviceInfo> devices_info_;
msw 2016/08/12 23:08:48 optional nit: |devices_|?
juncai 2016/08/15 21:53:19 Done.
73 std::unordered_map<std::string, base::string16> device_id_to_name_map_; 80 std::unordered_map<std::string, base::string16> device_id_to_name_map_;
74 // Maps from device name to number of devices. 81 // Maps from device name to number of devices.
75 std::unordered_map<base::string16, int> device_name_map_; 82 std::unordered_map<base::string16, int> device_name_map_;
76 83
77 content::BluetoothChooser::EventHandler event_handler_; 84 content::BluetoothChooser::EventHandler event_handler_;
78 base::string16 no_devices_text_; 85 base::string16 no_devices_text_;
79 base::string16 status_text_; 86 base::string16 status_text_;
80 87
81 DISALLOW_COPY_AND_ASSIGN(BluetoothChooserController); 88 DISALLOW_COPY_AND_ASSIGN(BluetoothChooserController);
82 }; 89 };
83 90
84 #endif // CHROME_BROWSER_UI_BLUETOOTH_BLUETOOTH_CHOOSER_CONTROLLER_H_ 91 #endif // CHROME_BROWSER_UI_BLUETOOTH_BLUETOOTH_CHOOSER_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698