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

Side by Side Diff: ui/views/controls/combobox/combobox.h

Issue 2394123002: Views: Expose an on_closed callback via the MenuRunner constructor. (Closed)
Patch Set: default arg Created 4 years, 2 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
« no previous file with comments | « chrome/browser/ui/views/frame/browser_frame.cc ('k') | ui/views/controls/combobox/combobox.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 UI_VIEWS_CONTROLS_COMBOBOX_COMBOBOX_H_ 5 #ifndef UI_VIEWS_CONTROLS_COMBOBOX_COMBOBOX_H_
6 #define UI_VIEWS_CONTROLS_COMBOBOX_COMBOBOX_H_ 6 #define UI_VIEWS_CONTROLS_COMBOBOX_COMBOBOX_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
(...skipping 10 matching lines...) Expand all
21 class MenuModel; 21 class MenuModel;
22 } 22 }
23 23
24 namespace views { 24 namespace views {
25 namespace test { 25 namespace test {
26 class ComboboxTestApi; 26 class ComboboxTestApi;
27 } 27 }
28 28
29 class ComboboxListener; 29 class ComboboxListener;
30 class CustomButton; 30 class CustomButton;
31 class MenuModelAdapter;
32 class MenuRunner; 31 class MenuRunner;
33 class Painter; 32 class Painter;
34 class PrefixSelector; 33 class PrefixSelector;
35 34
36 // A non-editable combobox (aka a drop-down list or selector). 35 // A non-editable combobox (aka a drop-down list or selector).
37 // Combobox has two distinct parts, the drop down arrow and the text. Combobox 36 // Combobox has two distinct parts, the drop down arrow and the text. Combobox
38 // offers two distinct behaviors: 37 // offers two distinct behaviors:
39 // * STYLE_NORMAL: typical combobox, clicking on the text and/or button shows 38 // * STYLE_NORMAL: typical combobox, clicking on the text and/or button shows
40 // the drop down, arrow keys change selection, selected index can be changed by 39 // the drop down, arrow keys change selection, selected index can be changed by
41 // the user to something other than the first item. 40 // the user to something other than the first item.
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 // placed on top of this combobox as child views, accept event and manage the 203 // placed on top of this combobox as child views, accept event and manage the
205 // button states. These are not rendered but when |style_| is 204 // button states. These are not rendered but when |style_| is
206 // STYLE_NOTIFY_ON_CLICK, a Combobox renders the button images according to 205 // STYLE_NOTIFY_ON_CLICK, a Combobox renders the button images according to
207 // these button states. 206 // these button states.
208 // The base View takes the ownerships of these as child views. 207 // The base View takes the ownerships of these as child views.
209 CustomButton* text_button_; 208 CustomButton* text_button_;
210 CustomButton* arrow_button_; 209 CustomButton* arrow_button_;
211 210
212 // Set while the dropdown is showing. Ensures the menu is closed if |this| is 211 // Set while the dropdown is showing. Ensures the menu is closed if |this| is
213 // destroyed. 212 // destroyed.
214 std::unique_ptr<MenuModelAdapter> menu_model_adapter_;
215 std::unique_ptr<MenuRunner> menu_runner_; 213 std::unique_ptr<MenuRunner> menu_runner_;
216 214
217 // The image to be drawn for this combobox's arrow. 215 // The image to be drawn for this combobox's arrow.
218 gfx::ImageSkia arrow_image_; 216 gfx::ImageSkia arrow_image_;
219 217
220 // When true, the size of contents is defined by the selected label. 218 // When true, the size of contents is defined by the selected label.
221 // Otherwise, it's defined by the widest label in the menu. If this is set to 219 // Otherwise, it's defined by the widest label in the menu. If this is set to
222 // true, the parent view must relayout in ChildPreferredSizeChanged(). 220 // true, the parent view must relayout in ChildPreferredSizeChanged().
223 bool size_to_largest_label_; 221 bool size_to_largest_label_;
224 222
225 // Used for making calbacks. 223 // Used for making calbacks.
226 base::WeakPtrFactory<Combobox> weak_ptr_factory_; 224 base::WeakPtrFactory<Combobox> weak_ptr_factory_;
227 225
228 DISALLOW_COPY_AND_ASSIGN(Combobox); 226 DISALLOW_COPY_AND_ASSIGN(Combobox);
229 }; 227 };
230 228
231 } // namespace views 229 } // namespace views
232 230
233 #endif // UI_VIEWS_CONTROLS_COMBOBOX_COMBOBOX_H_ 231 #endif // UI_VIEWS_CONTROLS_COMBOBOX_COMBOBOX_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_frame.cc ('k') | ui/views/controls/combobox/combobox.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698