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

Side by Side Diff: chrome/browser/ui/bluetooth/bluetooth_chooser_controller.h

Issue 2304213002: Show device connection and paired status in chooser on Mac (Closed)
Patch Set: added comments Created 4 years, 3 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 15 matching lines...) Expand all
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 ShouldShowIconBeforeText() const override; 31 bool ShouldShowIconBeforeText() const override;
32 base::string16 GetNoOptionsText() const override; 32 base::string16 GetNoOptionsText() const override;
33 base::string16 GetOkButtonLabel() const override; 33 base::string16 GetOkButtonLabel() const override;
34 size_t NumOptions() const override; 34 size_t NumOptions() const override;
35 int GetSignalStrengthLevel(size_t index) const override; 35 int GetSignalStrengthLevel(size_t index) const override;
36 bool IsConnected(size_t index) const override;
37 bool IsPaired(size_t index) const override;
36 base::string16 GetOption(size_t index) const override; 38 base::string16 GetOption(size_t index) const override;
37 void RefreshOptions() override; 39 void RefreshOptions() override;
38 base::string16 GetStatus() const override; 40 base::string16 GetStatus() const override;
39 void Select(size_t index) override; 41 void Select(size_t index) override;
40 void Cancel() override; 42 void Cancel() override;
41 void Close() override; 43 void Close() override;
42 void OpenHelpCenterUrl() const override; 44 void OpenHelpCenterUrl() const override;
43 45
44 // Update the state of the Bluetooth adapter. 46 // Update the state of the Bluetooth adapter.
45 void OnAdapterPresenceChanged( 47 void OnAdapterPresenceChanged(
(...skipping 16 matching lines...) Expand all
62 void RemoveDevice(const std::string& device_id); 64 void RemoveDevice(const std::string& device_id);
63 65
64 // Called when |event_handler_| is no longer valid and should not be used 66 // Called when |event_handler_| is no longer valid and should not be used
65 // any more. 67 // any more.
66 void ResetEventHandler(); 68 void ResetEventHandler();
67 69
68 private: 70 private:
69 struct BluetoothDeviceInfo { 71 struct BluetoothDeviceInfo {
70 std::string id; 72 std::string id;
71 int signal_strength_level; 73 int signal_strength_level;
74 bool is_connected;
75 bool is_paired;
72 }; 76 };
73 77
74 // Clears |device_names_and_ids_| and |device_name_counts_|. Called when 78 // Clears |device_names_and_ids_| and |device_name_counts_|. Called when
75 // Bluetooth adapter is turned on or off, or when re-scan happens. 79 // Bluetooth adapter is turned on or off, or when re-scan happens.
76 void ClearAllDevices(); 80 void ClearAllDevices();
77 81
78 std::vector<BluetoothDeviceInfo> devices_; 82 std::vector<BluetoothDeviceInfo> devices_;
79 std::unordered_map<std::string, base::string16> device_id_to_name_map_; 83 std::unordered_map<std::string, base::string16> device_id_to_name_map_;
80 // Maps from device name to number of devices with that name. 84 // Maps from device name to number of devices with that name.
81 std::unordered_map<base::string16, int> device_name_counts_; 85 std::unordered_map<base::string16, int> device_name_counts_;
82 86
83 content::BluetoothChooser::EventHandler event_handler_; 87 content::BluetoothChooser::EventHandler event_handler_;
84 base::string16 no_devices_text_; 88 base::string16 no_devices_text_;
85 base::string16 status_text_; 89 base::string16 status_text_;
86 90
87 DISALLOW_COPY_AND_ASSIGN(BluetoothChooserController); 91 DISALLOW_COPY_AND_ASSIGN(BluetoothChooserController);
88 }; 92 };
89 93
90 #endif // CHROME_BROWSER_UI_BLUETOOTH_BLUETOOTH_CHOOSER_CONTROLLER_H_ 94 #endif // CHROME_BROWSER_UI_BLUETOOTH_BLUETOOTH_CHOOSER_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698