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

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

Issue 2069733002: MD - Use real comboboxes in website settings popup. Hide borders (but (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix test Created 4 years, 6 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
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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 98
99 // Overridden from PrefixDelegate: 99 // Overridden from PrefixDelegate:
100 int GetRowCount() override; 100 int GetRowCount() override;
101 int GetSelectedRow() override; 101 int GetSelectedRow() override;
102 void SetSelectedRow(int row) override; 102 void SetSelectedRow(int row) override;
103 base::string16 GetTextForRow(int row) override; 103 base::string16 GetTextForRow(int row) override;
104 104
105 // Overriden from ButtonListener: 105 // Overriden from ButtonListener:
106 void ButtonPressed(Button* sender, const ui::Event& event) override; 106 void ButtonPressed(Button* sender, const ui::Event& event) override;
107 107
108 protected:
109 void set_size_to_largest_label(bool size_to_largest_label) {
110 size_to_largest_label_ = size_to_largest_label;
sky 2016/06/16 21:58:55 Why do you need to change this? It makes sense for
Evan Stade 2016/06/16 22:04:32 We're getting rid of the border, and it just looks
111 }
112
108 private: 113 private:
109 friend class test::ComboboxTestApi; 114 friend class test::ComboboxTestApi;
110 115
111 class ComboboxMenuModelAdapter; 116 class ComboboxMenuModelAdapter;
112 117
113 // Updates the border according to the current state. 118 // Updates the border according to the current state.
114 void UpdateBorder(); 119 void UpdateBorder();
115 120
116 // Given bounds within our View, this helper mirrors the bounds if necessary. 121 // Given bounds within our View, this helper mirrors the bounds if necessary.
117 void AdjustBoundsForRTLUI(gfx::Rect* rect) const; 122 void AdjustBoundsForRTLUI(gfx::Rect* rect) const;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 CustomButton* text_button_; 202 CustomButton* text_button_;
198 CustomButton* arrow_button_; 203 CustomButton* arrow_button_;
199 204
200 // Set while the dropdown is showing. Ensures the menu is closed if |this| is 205 // Set while the dropdown is showing. Ensures the menu is closed if |this| is
201 // destroyed. 206 // destroyed.
202 std::unique_ptr<views::MenuRunner> menu_runner_; 207 std::unique_ptr<views::MenuRunner> menu_runner_;
203 208
204 // The image to be drawn for this combobox's arrow. 209 // The image to be drawn for this combobox's arrow.
205 gfx::ImageSkia arrow_image_; 210 gfx::ImageSkia arrow_image_;
206 211
212 // When true, the size of contents is defined by the selected label.
213 // Otherwise, it's defined by the widest label in the menu.
214 bool size_to_largest_label_;
215
207 // Used for making calbacks. 216 // Used for making calbacks.
208 base::WeakPtrFactory<Combobox> weak_ptr_factory_; 217 base::WeakPtrFactory<Combobox> weak_ptr_factory_;
209 218
210 DISALLOW_COPY_AND_ASSIGN(Combobox); 219 DISALLOW_COPY_AND_ASSIGN(Combobox);
211 }; 220 };
212 221
213 } // namespace views 222 } // namespace views
214 223
215 #endif // UI_VIEWS_CONTROLS_COMBOBOX_COMBOBOX_H_ 224 #endif // UI_VIEWS_CONTROLS_COMBOBOX_COMBOBOX_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698