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/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/string16.h" | 10 #include "base/string16.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 virtual void ShowView(); | 125 virtual void ShowView(); |
126 virtual void InvalidateRow(size_t row); | 126 virtual void InvalidateRow(size_t row); |
127 | 127 |
128 // Protected so tests can access. | 128 // Protected so tests can access. |
129 #if !defined(OS_ANDROID) | 129 #if !defined(OS_ANDROID) |
130 // Calculates the desired width of the popup based on its contents. | 130 // Calculates the desired width of the popup based on its contents. |
131 int GetDesiredPopupWidth() const; | 131 int GetDesiredPopupWidth() const; |
132 | 132 |
133 // Calculates the desired height of the popup based on its contents. | 133 // Calculates the desired height of the popup based on its contents. |
134 int GetDesiredPopupHeight() const; | 134 int GetDesiredPopupHeight() const; |
| 135 |
| 136 // Calculate the width of the row, excluding all the text. This provides |
| 137 // the size of the row that won't be reducible (since all the text can be |
| 138 // elided if there isn't enough space). |
| 139 int RowWidthWithoutText(int row) const; |
135 #endif | 140 #endif |
136 | 141 |
137 base::WeakPtr<AutofillPopupControllerImpl> GetWeakPtr(); | 142 base::WeakPtr<AutofillPopupControllerImpl> GetWeakPtr(); |
138 | 143 |
139 private: | 144 private: |
140 const gfx::Rect RoundedElementBounds() const; | 145 const gfx::Rect RoundedElementBounds() const; |
141 #if !defined(OS_ANDROID) | 146 #if !defined(OS_ANDROID) |
142 // Calculate the width of the row, excluding all the text. This provides | |
143 // the size of the row that won't be reducible (since all the text can be | |
144 // elided if there isn't enough space). | |
145 int RowWidthWithoutText(int row) const; | |
146 | |
147 // Calculates and sets the bounds of the popup, including placing it properly | 147 // Calculates and sets the bounds of the popup, including placing it properly |
148 // to prevent it from going off the screen. | 148 // to prevent it from going off the screen. |
149 void UpdatePopupBounds(); | 149 void UpdatePopupBounds(); |
150 #endif | 150 #endif |
151 | 151 |
152 // A helper function to get the display closest to the given point (virtual | 152 // A helper function to get the display closest to the given point (virtual |
153 // for testing). | 153 // for testing). |
154 virtual gfx::Display GetDisplayNearestPoint(const gfx::Point& point) const; | 154 virtual gfx::Display GetDisplayNearestPoint(const gfx::Point& point) const; |
155 | 155 |
156 // Calculates the width of the popup and the x position of it. These values | 156 // Calculates the width of the popup and the x position of it. These values |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 // The line that is currently selected by the user. | 198 // The line that is currently selected by the user. |
199 // |kNoSelection| indicates that no line is currently selected. | 199 // |kNoSelection| indicates that no line is currently selected. |
200 int selected_line_; | 200 int selected_line_; |
201 | 201 |
202 base::WeakPtrFactory<AutofillPopupControllerImpl> weak_ptr_factory_; | 202 base::WeakPtrFactory<AutofillPopupControllerImpl> weak_ptr_factory_; |
203 }; | 203 }; |
204 | 204 |
205 } // namespace autofill | 205 } // namespace autofill |
206 | 206 |
207 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_CONTROLLER_IMPL_H_ | 207 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_CONTROLLER_IMPL_H_ |
OLD | NEW |