OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_CHOOSER_CONTROLLER_CHOOSER_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_CHOOSER_CONTROLLER_CHOOSER_CONTROLLER_H_ |
6 #define CHROME_BROWSER_CHOOSER_CONTROLLER_CHOOSER_CONTROLLER_H_ | 6 #define CHROME_BROWSER_CHOOSER_CONTROLLER_CHOOSER_CONTROLLER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
10 | 10 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 // Called when refreshing options is in progress or complete. | 55 // Called when refreshing options is in progress or complete. |
56 virtual void OnRefreshStateChanged(bool refreshing) = 0; | 56 virtual void OnRefreshStateChanged(bool refreshing) = 0; |
57 | 57 |
58 protected: | 58 protected: |
59 virtual ~View() {} | 59 virtual ~View() {} |
60 }; | 60 }; |
61 | 61 |
62 // Returns the text to be displayed in the chooser title. | 62 // Returns the text to be displayed in the chooser title. |
63 base::string16 GetTitle() const; | 63 base::string16 GetTitle() const; |
64 | 64 |
| 65 // Returns if the chooser needs to show an icon before the text. |
| 66 // For WebBluetooth, it is a signal strength icon. |
| 67 virtual bool ShouldShowIconBeforeText() const; |
| 68 |
65 // Returns the text to be displayed in the chooser when there are no options. | 69 // Returns the text to be displayed in the chooser when there are no options. |
66 virtual base::string16 GetNoOptionsText() const = 0; | 70 virtual base::string16 GetNoOptionsText() const = 0; |
67 | 71 |
68 // Returns the label for OK button. | 72 // Returns the label for OK button. |
69 virtual base::string16 GetOkButtonLabel() const = 0; | 73 virtual base::string16 GetOkButtonLabel() const = 0; |
70 | 74 |
71 // The number of options users can pick from. For example, it can be | 75 // The number of options users can pick from. For example, it can be |
72 // the number of USB/Bluetooth device names which are listed in the | 76 // the number of USB/Bluetooth device names which are listed in the |
73 // chooser so that users can grant permission. | 77 // chooser so that users can grant permission. |
74 virtual size_t NumOptions() const = 0; | 78 virtual size_t NumOptions() const = 0; |
75 | 79 |
| 80 // The signal strength level (0-4 inclusive) of the device at |index|, which |
| 81 // is used to retrieve the corresponding icon to be displayed before the |
| 82 // text. Returns -1 if no icon should be shown. |
| 83 virtual int GetSignalStrengthLevel(size_t index) const; |
| 84 |
76 // The |index|th option string which is listed in the chooser. | 85 // The |index|th option string which is listed in the chooser. |
77 virtual base::string16 GetOption(size_t index) const = 0; | 86 virtual base::string16 GetOption(size_t index) const = 0; |
78 | 87 |
79 // Refresh the list of options. | 88 // Refresh the list of options. |
80 virtual void RefreshOptions() = 0; | 89 virtual void RefreshOptions() = 0; |
81 | 90 |
82 // Returns the status text to be shown in the chooser. | 91 // Returns the status text to be shown in the chooser. |
83 virtual base::string16 GetStatus() const = 0; | 92 virtual base::string16 GetStatus() const = 0; |
84 | 93 |
85 // These three functions are called just before this object is destroyed: | 94 // These three functions are called just before this object is destroyed: |
(...skipping 18 matching lines...) Expand all Loading... |
104 private: | 113 private: |
105 content::RenderFrameHost* const owning_frame_; | 114 content::RenderFrameHost* const owning_frame_; |
106 const int title_string_id_origin_; | 115 const int title_string_id_origin_; |
107 const int title_string_id_extension_; | 116 const int title_string_id_extension_; |
108 View* view_ = nullptr; | 117 View* view_ = nullptr; |
109 | 118 |
110 DISALLOW_COPY_AND_ASSIGN(ChooserController); | 119 DISALLOW_COPY_AND_ASSIGN(ChooserController); |
111 }; | 120 }; |
112 | 121 |
113 #endif // CHROME_BROWSER_CHOOSER_CONTROLLER_CHOOSER_CONTROLLER_H_ | 122 #endif // CHROME_BROWSER_CHOOSER_CONTROLLER_CHOOSER_CONTROLLER_H_ |
OLD | NEW |