OLD | NEW |
---|---|
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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
83 bool IsRTL() const override; | 83 bool IsRTL() const override; |
84 | 84 |
85 size_t GetLineCount() const override; | 85 size_t GetLineCount() const override; |
86 const autofill::Suggestion& GetSuggestionAt(size_t row) const override; | 86 const autofill::Suggestion& GetSuggestionAt(size_t row) const override; |
87 const base::string16& GetElidedValueAt(size_t row) const override; | 87 const base::string16& GetElidedValueAt(size_t row) const override; |
88 const base::string16& GetElidedLabelAt(size_t row) const override; | 88 const base::string16& GetElidedLabelAt(size_t row) const override; |
89 bool GetRemovalConfirmationText(int list_index, | 89 bool GetRemovalConfirmationText(int list_index, |
90 base::string16* title, | 90 base::string16* title, |
91 base::string16* body) override; | 91 base::string16* body) override; |
92 bool RemoveSuggestion(int list_index) override; | 92 bool RemoveSuggestion(int list_index) override; |
93 #if !defined(OS_ANDROID) || defined(USE_AURA) | 93 #if !defined(OS_ANDROID) |
mfomitchev
2016/01/06 19:10:14
Would you mind changing these to use ANDROID_JAVA_
| |
94 const gfx::FontList& GetValueFontListForRow(size_t index) const override; | 94 const gfx::FontList& GetValueFontListForRow(size_t index) const override; |
95 const gfx::FontList& GetLabelFontList() const override; | 95 const gfx::FontList& GetLabelFontList() const override; |
96 #endif | 96 #endif |
97 int selected_line() const override; | 97 int selected_line() const override; |
98 | 98 |
99 content::WebContents* web_contents(); | 99 content::WebContents* web_contents(); |
100 | 100 |
101 // Change which line is currently selected by the user. | 101 // Change which line is currently selected by the user. |
102 void SetSelectedLine(int selected_line); | 102 void SetSelectedLine(int selected_line); |
103 | 103 |
(...skipping 22 matching lines...) Expand all Loading... | |
126 // without showing the popup. | 126 // without showing the popup. |
127 void SetValues(const std::vector<autofill::Suggestion>& suggestions); | 127 void SetValues(const std::vector<autofill::Suggestion>& suggestions); |
128 | 128 |
129 AutofillPopupView* view() { return view_; } | 129 AutofillPopupView* view() { return view_; } |
130 | 130 |
131 // |view_| pass throughs (virtual for testing). | 131 // |view_| pass throughs (virtual for testing). |
132 virtual void ShowView(); | 132 virtual void ShowView(); |
133 virtual void InvalidateRow(size_t row); | 133 virtual void InvalidateRow(size_t row); |
134 | 134 |
135 // Protected so tests can access. | 135 // Protected so tests can access. |
136 #if !defined(OS_ANDROID) || defined(USE_AURA) | 136 #if !defined(OS_ANDROID) |
137 // Calculates the desired width of the popup based on its contents. | 137 // Calculates the desired width of the popup based on its contents. |
138 int GetDesiredPopupWidth() const; | 138 int GetDesiredPopupWidth() const; |
139 | 139 |
140 // Calculates the desired height of the popup based on its contents. | 140 // Calculates the desired height of the popup based on its contents. |
141 int GetDesiredPopupHeight() const; | 141 int GetDesiredPopupHeight() const; |
142 | 142 |
143 // Calculate the width of the row, excluding all the text. This provides | 143 // Calculate the width of the row, excluding all the text. This provides |
144 // the size of the row that won't be reducible (since all the text can be | 144 // the size of the row that won't be reducible (since all the text can be |
145 // elided if there isn't enough space). | 145 // elided if there isn't enough space). |
146 int RowWidthWithoutText(int row) const; | 146 int RowWidthWithoutText(int row) const; |
147 #endif | 147 #endif |
148 | 148 |
149 base::WeakPtr<AutofillPopupControllerImpl> GetWeakPtr(); | 149 base::WeakPtr<AutofillPopupControllerImpl> GetWeakPtr(); |
150 | 150 |
151 // Contains common popup functionality such as popup layout. Protected for | 151 // Contains common popup functionality such as popup layout. Protected for |
152 // testing. | 152 // testing. |
153 scoped_ptr<PopupControllerCommon> controller_common_; | 153 scoped_ptr<PopupControllerCommon> controller_common_; |
154 | 154 |
155 private: | 155 private: |
156 // Clear the internal state of the controller. This is needed to ensure that | 156 // Clear the internal state of the controller. This is needed to ensure that |
157 // when the popup is reused it doesn't leak values between uses. | 157 // when the popup is reused it doesn't leak values between uses. |
158 void ClearState(); | 158 void ClearState(); |
159 | 159 |
160 #if !defined(OS_ANDROID) || defined(USE_AURA) | 160 #if !defined(OS_ANDROID) |
161 // Calculates and sets the bounds of the popup, including placing it properly | 161 // Calculates and sets the bounds of the popup, including placing it properly |
162 // to prevent it from going off the screen. | 162 // to prevent it from going off the screen. |
163 void UpdatePopupBounds(); | 163 void UpdatePopupBounds(); |
164 #endif | 164 #endif |
165 | 165 |
166 AutofillPopupView* view_; // Weak reference. | 166 AutofillPopupView* view_; // Weak reference. |
167 base::WeakPtr<AutofillPopupDelegate> delegate_; | 167 base::WeakPtr<AutofillPopupDelegate> delegate_; |
168 | 168 |
169 // The bounds of the Autofill popup. | 169 // The bounds of the Autofill popup. |
170 gfx::Rect popup_bounds_; | 170 gfx::Rect popup_bounds_; |
171 | 171 |
172 // The text direction of the popup. | 172 // The text direction of the popup. |
173 base::i18n::TextDirection text_direction_; | 173 base::i18n::TextDirection text_direction_; |
174 | 174 |
175 // The current Autofill query values. | 175 // The current Autofill query values. |
176 std::vector<autofill::Suggestion> suggestions_; | 176 std::vector<autofill::Suggestion> suggestions_; |
177 | 177 |
178 // Elided values and labels corresponding to the suggestions_ vector to | 178 // Elided values and labels corresponding to the suggestions_ vector to |
179 // ensure that it fits on the screen. | 179 // ensure that it fits on the screen. |
180 std::vector<base::string16> elided_values_; | 180 std::vector<base::string16> elided_values_; |
181 std::vector<base::string16> elided_labels_; | 181 std::vector<base::string16> elided_labels_; |
182 | 182 |
183 #if !defined(OS_ANDROID) || defined(USE_AURA) | 183 #if !defined(OS_ANDROID) |
184 // The fonts for the popup text. | 184 // The fonts for the popup text. |
185 gfx::FontList value_font_list_; | 185 gfx::FontList value_font_list_; |
186 gfx::FontList label_font_list_; | 186 gfx::FontList label_font_list_; |
187 gfx::FontList warning_font_list_; | 187 gfx::FontList warning_font_list_; |
188 gfx::FontList title_font_list_; | 188 gfx::FontList title_font_list_; |
189 #endif | 189 #endif |
190 | 190 |
191 // The line that is currently selected by the user. | 191 // The line that is currently selected by the user. |
192 // |kNoSelection| indicates that no line is currently selected. | 192 // |kNoSelection| indicates that no line is currently selected. |
193 int selected_line_; | 193 int selected_line_; |
194 | 194 |
195 base::WeakPtrFactory<AutofillPopupControllerImpl> weak_ptr_factory_; | 195 base::WeakPtrFactory<AutofillPopupControllerImpl> weak_ptr_factory_; |
196 }; | 196 }; |
197 | 197 |
198 } // namespace autofill | 198 } // namespace autofill |
199 | 199 |
200 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_CONTROLLER_IMPL_H_ | 200 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_CONTROLLER_IMPL_H_ |
OLD | NEW |