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

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

Issue 2577183002: Add UMA for the number of devices in the chooser when a device is paired (Closed)
Patch Set: address comments Created 4 years 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>
11 #include <unordered_map> 11 #include <unordered_map>
12 #include <utility> 12 #include <utility>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "chrome/browser/chooser_controller/chooser_controller.h" 16 #include "chrome/browser/chooser_controller/chooser_controller.h"
17 #include "content/public/browser/bluetooth_chooser.h" 17 #include "content/public/browser/bluetooth_chooser.h"
18 18
19 // BluetoothChooserController is a chooser that presents a list of 19 // BluetoothChooserController is a chooser that presents a list of
20 // Bluetooth device names, which come from |bluetooth_chooser_desktop_|. 20 // Bluetooth device names, which come from |bluetooth_chooser_desktop_|.
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 BluetoothChooserController(
26 content::RenderFrameHost* owner, 26 content::RenderFrameHost* owner,
27 const content::BluetoothChooser::EventHandler& event_handler); 27 const content::BluetoothChooser::EventHandler& event_handler,
28 bool accept_all_devices);
28 ~BluetoothChooserController() override; 29 ~BluetoothChooserController() override;
29 30
30 // ChooserController: 31 // ChooserController:
31 bool ShouldShowIconBeforeText() const override; 32 bool ShouldShowIconBeforeText() const override;
32 base::string16 GetNoOptionsText() const override; 33 base::string16 GetNoOptionsText() const override;
33 base::string16 GetOkButtonLabel() const override; 34 base::string16 GetOkButtonLabel() const override;
34 size_t NumOptions() const override; 35 size_t NumOptions() const override;
35 int GetSignalStrengthLevel(size_t index) const override; 36 int GetSignalStrengthLevel(size_t index) const override;
36 bool IsConnected(size_t index) const override; 37 bool IsConnected(size_t index) const override;
37 bool IsPaired(size_t index) const override; 38 bool IsPaired(size_t index) const override;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 // Bluetooth adapter is turned on or off, or when re-scan happens. 81 // Bluetooth adapter is turned on or off, or when re-scan happens.
81 void ClearAllDevices(); 82 void ClearAllDevices();
82 83
83 std::vector<BluetoothDeviceInfo> devices_; 84 std::vector<BluetoothDeviceInfo> devices_;
84 std::unordered_map<std::string, base::string16> device_id_to_name_map_; 85 std::unordered_map<std::string, base::string16> device_id_to_name_map_;
85 // Maps from device name to number of devices with that name. 86 // Maps from device name to number of devices with that name.
86 std::unordered_map<base::string16, int> device_name_counts_; 87 std::unordered_map<base::string16, int> device_name_counts_;
87 88
88 content::BluetoothChooser::EventHandler event_handler_; 89 content::BluetoothChooser::EventHandler event_handler_;
89 base::string16 status_text_; 90 base::string16 status_text_;
91 bool accept_all_devices_;
90 92
91 DISALLOW_COPY_AND_ASSIGN(BluetoothChooserController); 93 DISALLOW_COPY_AND_ASSIGN(BluetoothChooserController);
92 }; 94 };
93 95
94 #endif // CHROME_BROWSER_UI_BLUETOOTH_BLUETOOTH_CHOOSER_CONTROLLER_H_ 96 #endif // CHROME_BROWSER_UI_BLUETOOTH_BLUETOOTH_CHOOSER_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698