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

Side by Side Diff: chrome/browser/chooser_controller/chooser_controller.h

Issue 2518933004: Add multiple selection support to chooser on desktops (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
« no previous file with comments | « no previous file | chrome/browser/chooser_controller/chooser_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <vector>
9
8 #include "base/macros.h" 10 #include "base/macros.h"
9 #include "base/strings/string16.h" 11 #include "base/strings/string16.h"
10 12
11 namespace content { 13 namespace content {
12 class RenderFrameHost; 14 class RenderFrameHost;
13 } 15 }
14 16
15 // Subclass ChooserController to implement a chooser, which has some 17 // Subclass ChooserController to implement a chooser, which has some
16 // introductory text and a list of options that users can pick one of. 18 // introductory text and a list of options that users can pick one of.
17 // Your subclass must define the set of options users can pick from; 19 // Your subclass must define the set of options users can pick from;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 virtual ~View() {} 61 virtual ~View() {}
60 }; 62 };
61 63
62 // Returns the text to be displayed in the chooser title. 64 // Returns the text to be displayed in the chooser title.
63 base::string16 GetTitle() const; 65 base::string16 GetTitle() const;
64 66
65 // Returns if the chooser needs to show an icon before the text. 67 // Returns if the chooser needs to show an icon before the text.
66 // For WebBluetooth, it is a signal strength icon. 68 // For WebBluetooth, it is a signal strength icon.
67 virtual bool ShouldShowIconBeforeText() const; 69 virtual bool ShouldShowIconBeforeText() const;
68 70
71 // Returns if the chooser allows multiple items to be selected.
72 virtual bool AllowMultipleSelection() const;
73
69 // Returns the text to be displayed in the chooser when there are no options. 74 // Returns the text to be displayed in the chooser when there are no options.
70 virtual base::string16 GetNoOptionsText() const = 0; 75 virtual base::string16 GetNoOptionsText() const = 0;
71 76
72 // Returns the label for OK button. 77 // Returns the label for OK button.
73 virtual base::string16 GetOkButtonLabel() const = 0; 78 virtual base::string16 GetOkButtonLabel() const = 0;
74 79
75 // The number of options users can pick from. For example, it can be 80 // The number of options users can pick from. For example, it can be
76 // the number of USB/Bluetooth device names which are listed in the 81 // the number of USB/Bluetooth device names which are listed in the
77 // chooser so that users can grant permission. 82 // chooser so that users can grant permission.
78 virtual size_t NumOptions() const = 0; 83 virtual size_t NumOptions() const = 0;
(...skipping 15 matching lines...) Expand all
94 virtual bool IsPaired(size_t index) const; 99 virtual bool IsPaired(size_t index) const;
95 100
96 // Refresh the list of options. 101 // Refresh the list of options.
97 virtual void RefreshOptions() = 0; 102 virtual void RefreshOptions() = 0;
98 103
99 // Returns the status text to be shown in the chooser. 104 // Returns the status text to be shown in the chooser.
100 virtual base::string16 GetStatus() const = 0; 105 virtual base::string16 GetStatus() const = 0;
101 106
102 // These three functions are called just before this object is destroyed: 107 // These three functions are called just before this object is destroyed:
103 108
104 // Called when the user selects the |index|th element from the dialog. 109 // Called when the user selects elements from the dialog. |indices| contains
105 virtual void Select(size_t index) = 0; 110 // the indices of the selected elements.
111 virtual void Select(const std::vector<size_t>& indices) = 0;
106 112
107 // Called when the user presses the 'Cancel' button in the dialog. 113 // Called when the user presses the 'Cancel' button in the dialog.
108 virtual void Cancel() = 0; 114 virtual void Cancel() = 0;
109 115
110 // Called when the user clicks outside the dialog or the dialog otherwise 116 // Called when the user clicks outside the dialog or the dialog otherwise
111 // closes without the user taking an explicit action. 117 // closes without the user taking an explicit action.
112 virtual void Close() = 0; 118 virtual void Close() = 0;
113 119
114 // Open help center URL. 120 // Open help center URL.
115 virtual void OpenHelpCenterUrl() const = 0; 121 virtual void OpenHelpCenterUrl() const = 0;
116 122
117 // Provide help information when the adapter is off. 123 // Provide help information when the adapter is off.
118 virtual void OpenAdapterOffHelpUrl() const; 124 virtual void OpenAdapterOffHelpUrl() const;
119 125
120 // Only one view may be registered at a time. 126 // Only one view may be registered at a time.
121 void set_view(View* view) { view_ = view; } 127 void set_view(View* view) { view_ = view; }
122 View* view() const { return view_; } 128 View* view() const { return view_; }
123 129
124 private: 130 private:
125 content::RenderFrameHost* const owning_frame_; 131 content::RenderFrameHost* const owning_frame_;
126 const int title_string_id_origin_; 132 const int title_string_id_origin_;
127 const int title_string_id_extension_; 133 const int title_string_id_extension_;
128 View* view_ = nullptr; 134 View* view_ = nullptr;
129 135
130 DISALLOW_COPY_AND_ASSIGN(ChooserController); 136 DISALLOW_COPY_AND_ASSIGN(ChooserController);
131 }; 137 };
132 138
133 #endif // CHROME_BROWSER_CHOOSER_CONTROLLER_CHOOSER_CONTROLLER_H_ 139 #endif // CHROME_BROWSER_CHOOSER_CONTROLLER_CHOOSER_CONTROLLER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chooser_controller/chooser_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698