Chromium Code Reviews| 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 28 matching lines...) Expand all Loading... | |
| 39 // GetOption(index) from inside a call to OnOptionAdded will see the | 39 // GetOption(index) from inside a call to OnOptionAdded will see the |
| 40 // added string since the options have already been updated. | 40 // added string since the options have already been updated. |
| 41 virtual void OnOptionAdded(size_t index) = 0; | 41 virtual void OnOptionAdded(size_t index) = 0; |
| 42 | 42 |
| 43 // Called when GetOption(index) is no longer present, and all later | 43 // Called when GetOption(index) is no longer present, and all later |
| 44 // options have been moved earlier by 1 slot. Calling GetOption(index) | 44 // options have been moved earlier by 1 slot. Calling GetOption(index) |
| 45 // from inside a call to OnOptionRemoved will NOT see the removed string | 45 // from inside a call to OnOptionRemoved will NOT see the removed string |
| 46 // since the options have already been updated. | 46 // since the options have already been updated. |
| 47 virtual void OnOptionRemoved(size_t index) = 0; | 47 virtual void OnOptionRemoved(size_t index) = 0; |
| 48 | 48 |
| 49 // Called when the device adapter is turned on or off. | |
| 50 virtual void AdapterEnabled(bool enabled) = 0; | |
|
msw
2016/07/18 23:01:30
nit: OnAdapterEnabledChanged? SetAdapterEnabled?
juncai
2016/07/19 20:42:45
Done.
| |
| 51 | |
| 52 // Called when refreshing options is in progress or complete. | |
| 53 virtual void SetRefreshing(bool refreshing) = 0; | |
|
msw
2016/07/18 23:01:30
nit: OnRefreshStateChanged?
juncai
2016/07/19 20:42:45
Done.
| |
| 54 | |
| 49 protected: | 55 protected: |
| 50 virtual ~Observer() {} | 56 virtual ~Observer() {} |
| 51 }; | 57 }; |
| 52 | 58 |
| 53 // Returns the text to be displayed in the chooser title. | 59 // Returns the text to be displayed in the chooser title. |
| 54 base::string16 GetTitle() const; | 60 base::string16 GetTitle() const; |
| 55 | 61 |
| 62 // Returns the text to be displayed in the chooser when there is no option. | |
|
Reilly Grant (use Gerrit)
2016/07/18 21:15:03
s/is no option/are no options/
juncai
2016/07/19 20:42:45
Done.
| |
| 63 virtual base::string16 GetNoOptionsText() const = 0; | |
| 64 | |
| 56 // Returns the label for OK button. | 65 // Returns the label for OK button. |
| 57 virtual base::string16 GetOkButtonLabel() const = 0; | 66 virtual base::string16 GetOkButtonLabel() const = 0; |
| 58 | 67 |
| 59 // The number of options users can pick from. For example, it can be | 68 // The number of options users can pick from. For example, it can be |
| 60 // the number of USB/Bluetooth device names which are listed in the | 69 // the number of USB/Bluetooth device names which are listed in the |
| 61 // chooser so that users can grant permission. | 70 // chooser so that users can grant permission. |
| 62 virtual size_t NumOptions() const = 0; | 71 virtual size_t NumOptions() const = 0; |
| 63 | 72 |
| 64 // The |index|th option string which is listed in the chooser. | 73 // The |index|th option string which is listed in the chooser. |
| 65 virtual base::string16 GetOption(size_t index) const = 0; | 74 virtual base::string16 GetOption(size_t index) const = 0; |
| 66 | 75 |
| 76 // Refresh the list of options. | |
| 77 virtual void RefreshOptions() = 0; | |
| 78 | |
| 79 // Returns the status text to be shown in the chooser. | |
| 80 virtual base::string16 GetStatus() const = 0; | |
| 81 | |
| 67 // These three functions are called just before this object is destroyed: | 82 // These three functions are called just before this object is destroyed: |
| 68 | 83 |
| 69 // Called when the user selects the |index|th element from the dialog. | 84 // Called when the user selects the |index|th element from the dialog. |
| 70 virtual void Select(size_t index) = 0; | 85 virtual void Select(size_t index) = 0; |
| 71 | 86 |
| 72 // Called when the user presses the 'Cancel' button in the dialog. | 87 // Called when the user presses the 'Cancel' button in the dialog. |
| 73 virtual void Cancel() = 0; | 88 virtual void Cancel() = 0; |
| 74 | 89 |
| 75 // Called when the user clicks outside the dialog or the dialog otherwise | 90 // Called when the user clicks outside the dialog or the dialog otherwise |
| 76 // closes without the user taking an explicit action. | 91 // closes without the user taking an explicit action. |
| 77 virtual void Close() = 0; | 92 virtual void Close() = 0; |
| 78 | 93 |
| 79 // Open help center URL. | 94 // Open help center URL. |
| 80 virtual void OpenHelpCenterUrl() const = 0; | 95 virtual void OpenHelpCenterUrl() const = 0; |
| 81 | 96 |
| 82 // Only one observer may be registered at a time. | 97 // Only one observer may be registered at a time. |
| 83 void set_observer(Observer* observer) { observer_ = observer; } | 98 void set_observer(Observer* observer) { observer_ = observer; } |
| 84 Observer* observer() const { return observer_; } | 99 Observer* observer() const { return observer_; } |
| 85 | 100 |
| 86 private: | 101 private: |
| 87 content::RenderFrameHost* const owning_frame_; | 102 content::RenderFrameHost* const owning_frame_; |
| 88 const int title_string_id_origin_; | 103 const int title_string_id_origin_; |
| 89 const int title_string_id_extension_; | 104 const int title_string_id_extension_; |
| 90 Observer* observer_ = nullptr; | 105 Observer* observer_ = nullptr; |
| 91 | 106 |
| 92 DISALLOW_COPY_AND_ASSIGN(ChooserController); | 107 DISALLOW_COPY_AND_ASSIGN(ChooserController); |
| 93 }; | 108 }; |
| 94 | 109 |
| 95 #endif // CHROME_BROWSER_CHOOSER_CONTROLLER_CHOOSER_CONTROLLER_H_ | 110 #endif // CHROME_BROWSER_CHOOSER_CONTROLLER_CHOOSER_CONTROLLER_H_ |
| OLD | NEW |