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

Side by Side Diff: chrome/browser/ui/autofill/autofill_popup_controller_impl.h

Issue 492043003: Fill on account select in the password manager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase on ToT Created 6 years, 1 month 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 | Annotate | Revision Log
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 CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_CONTROLLER_IMPL_H_ 5 #ifndef CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_CONTROLLER_IMPL_H_
6 #define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_CONTROLLER_IMPL_H_ 6 #define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_CONTROLLER_IMPL_H_
7 7
8 #include "base/gtest_prod_util.h" 8 #include "base/gtest_prod_util.h"
9 #include "base/i18n/rtl.h" 9 #include "base/i18n/rtl.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 23 matching lines...) Expand all
34 base::WeakPtr<AutofillPopupDelegate> delegate, 34 base::WeakPtr<AutofillPopupDelegate> delegate,
35 content::WebContents* web_contents, 35 content::WebContents* web_contents,
36 gfx::NativeView container_view, 36 gfx::NativeView container_view,
37 const gfx::RectF& element_bounds, 37 const gfx::RectF& element_bounds,
38 base::i18n::TextDirection text_direction); 38 base::i18n::TextDirection text_direction);
39 39
40 // Shows the popup, or updates the existing popup with the given values. 40 // Shows the popup, or updates the existing popup with the given values.
41 void Show(const std::vector<base::string16>& names, 41 void Show(const std::vector<base::string16>& names,
42 const std::vector<base::string16>& subtexts, 42 const std::vector<base::string16>& subtexts,
43 const std::vector<base::string16>& icons, 43 const std::vector<base::string16>& icons,
44 const std::vector<int>& identifiers); 44 const std::vector<int>& identifiers,
45 const base::string16& title);
45 46
46 // Updates the data list values currently shown with the popup. 47 // Updates the data list values currently shown with the popup.
47 void UpdateDataListValues(const std::vector<base::string16>& values, 48 void UpdateDataListValues(const std::vector<base::string16>& values,
48 const std::vector<base::string16>& labels); 49 const std::vector<base::string16>& labels);
49 50
50 // Hides the popup and destroys the controller. This also invalidates 51 // Hides the popup and destroys the controller. This also invalidates
51 // |delegate_|. 52 // |delegate_|.
52 void Hide() override; 53 void Hide() override;
53 54
54 // Invoked when the view was destroyed by by someone other than this class. 55 // Invoked when the view was destroyed by by someone other than this class.
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 bool CanAccept(int id); 123 bool CanAccept(int id);
123 124
124 // Returns true if the popup still has non-options entries to show the user. 125 // Returns true if the popup still has non-options entries to show the user.
125 bool HasSuggestions(); 126 bool HasSuggestions();
126 127
127 // Set the Autofill entry values. Exposed to allow tests to set these values 128 // Set the Autofill entry values. Exposed to allow tests to set these values
128 // without showing the popup. 129 // without showing the popup.
129 void SetValues(const std::vector<base::string16>& names, 130 void SetValues(const std::vector<base::string16>& names,
130 const std::vector<base::string16>& subtexts, 131 const std::vector<base::string16>& subtexts,
131 const std::vector<base::string16>& icons, 132 const std::vector<base::string16>& icons,
132 const std::vector<int>& identifier); 133 const std::vector<int>& identifier,
134 const base::string16& title);
133 135
134 AutofillPopupView* view() { return view_; } 136 AutofillPopupView* view() { return view_; }
135 137
136 // |view_| pass throughs (virtual for testing). 138 // |view_| pass throughs (virtual for testing).
137 virtual void ShowView(); 139 virtual void ShowView();
138 virtual void InvalidateRow(size_t row); 140 virtual void InvalidateRow(size_t row);
139 141
140 // Protected so tests can access. 142 // Protected so tests can access.
141 #if !defined(OS_ANDROID) 143 #if !defined(OS_ANDROID)
142 // Calculates the desired width of the popup based on its contents. 144 // Calculates the desired width of the popup based on its contents.
(...skipping 18 matching lines...) Expand all
161 // Clear the internal state of the controller. This is needed to ensure that 163 // Clear the internal state of the controller. This is needed to ensure that
162 // when the popup is reused it doesn't leak values between uses. 164 // when the popup is reused it doesn't leak values between uses.
163 void ClearState(); 165 void ClearState();
164 166
165 #if !defined(OS_ANDROID) 167 #if !defined(OS_ANDROID)
166 // Calculates and sets the bounds of the popup, including placing it properly 168 // Calculates and sets the bounds of the popup, including placing it properly
167 // to prevent it from going off the screen. 169 // to prevent it from going off the screen.
168 void UpdatePopupBounds(); 170 void UpdatePopupBounds();
169 #endif 171 #endif
170 172
173 // Returns the line number of the first selectable line, accounting for a
174 // title.
175 int GetFirstSelectableLine();
176
171 AutofillPopupView* view_; // Weak reference. 177 AutofillPopupView* view_; // Weak reference.
172 base::WeakPtr<AutofillPopupDelegate> delegate_; 178 base::WeakPtr<AutofillPopupDelegate> delegate_;
173 179
174 // The bounds of the Autofill popup. 180 // The bounds of the Autofill popup.
175 gfx::Rect popup_bounds_; 181 gfx::Rect popup_bounds_;
176 182
177 // The text direction of the popup. 183 // The text direction of the popup.
178 base::i18n::TextDirection text_direction_; 184 base::i18n::TextDirection text_direction_;
179 185
180 // The current Autofill query values. 186 // The current Autofill query values.
181 std::vector<base::string16> names_; 187 std::vector<base::string16> names_;
182 std::vector<base::string16> subtexts_; 188 std::vector<base::string16> subtexts_;
183 std::vector<base::string16> icons_; 189 std::vector<base::string16> icons_;
184 std::vector<int> identifiers_; 190 std::vector<int> identifiers_;
185 191
186 // Since names_ can be elided to ensure that it fits on the screen, we need to 192 // Since names_ can be elided to ensure that it fits on the screen, we need to
187 // keep an unelided copy of the names to be able to pass to the delegate. 193 // keep an unelided copy of the names to be able to pass to the delegate.
188 std::vector<base::string16> full_names_; 194 std::vector<base::string16> full_names_;
189 195
190 #if !defined(OS_ANDROID) 196 #if !defined(OS_ANDROID)
191 // The fonts for the popup text. 197 // The fonts for the popup text.
192 gfx::FontList name_font_list_; 198 gfx::FontList name_font_list_;
193 gfx::FontList subtext_font_list_; 199 gfx::FontList subtext_font_list_;
194 gfx::FontList warning_font_list_; 200 gfx::FontList warning_font_list_;
201 gfx::FontList title_font_list_;
195 #endif 202 #endif
196 203
197 // The line that is currently selected by the user. 204 // The line that is currently selected by the user.
198 // |kNoSelection| indicates that no line is currently selected. 205 // |kNoSelection| indicates that no line is currently selected.
199 int selected_line_; 206 int selected_line_;
200 207
201 base::WeakPtrFactory<AutofillPopupControllerImpl> weak_ptr_factory_; 208 base::WeakPtrFactory<AutofillPopupControllerImpl> weak_ptr_factory_;
202 }; 209 };
203 210
204 } // namespace autofill 211 } // namespace autofill
205 212
206 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_CONTROLLER_IMPL_H_ 213 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_CONTROLLER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698