Index: chrome/browser/ui/autofill/autofill_popup_controller_impl.h |
diff --git a/chrome/browser/ui/autofill/autofill_popup_controller_impl.h b/chrome/browser/ui/autofill/autofill_popup_controller_impl.h |
index 321d56b43c4ce6b2155ee4cbf4363d474a245c24..b8ad88dbe13bb32728868fdb5fc863294ad593ce 100644 |
--- a/chrome/browser/ui/autofill/autofill_popup_controller_impl.h |
+++ b/chrome/browser/ui/autofill/autofill_popup_controller_impl.h |
@@ -15,6 +15,10 @@ |
class AutofillPopupDelegate; |
class AutofillPopupView; |
+namespace gfx { |
+class Display; |
+} |
+ |
namespace ui { |
class KeyEvent; |
} |
@@ -62,10 +66,6 @@ class AutofillPopupControllerImpl : public AutofillPopupController, |
virtual void AcceptSuggestion(size_t index) OVERRIDE; |
virtual int GetIconResourceID(const string16& resource_name) OVERRIDE; |
virtual bool CanDelete(size_t index) OVERRIDE; |
-#if !defined(OS_ANDROID) |
- virtual int GetPopupRequiredWidth() OVERRIDE; |
- virtual int GetPopupRequiredHeight() OVERRIDE; |
-#endif |
virtual gfx::Rect GetRowBounds(size_t index) OVERRIDE; |
virtual void SetPopupBounds(const gfx::Rect& bounds) OVERRIDE; |
virtual const gfx::Rect& popup_bounds() const OVERRIDE; |
@@ -128,6 +128,37 @@ class AutofillPopupControllerImpl : public AutofillPopupController, |
virtual void InvalidateRow(size_t row); |
private: |
+#if !defined(OS_ANDROID) |
+ // Calculates the width of the popup based on its contents. |
+ int GetPopupRequiredWidth(); |
+ |
+ // Calculates the height of the popup based on its contents. |
+ int GetPopupRequiredHeight(); |
+ |
+ // Calculate the width of the row, excluding all the text. This provides |
+ // the size of the row that won't be reducible (since all the text can be |
+ // elided if there isn't enough space). |
+ int RowWidthWithoutText(int row); |
+ |
+ // Calculates and sets the bounds of the popup, including placing it properly |
+ // to prevent it from going off the screen (virtual for testing). |
+ virtual void UpdatePopupBounds(); |
+#endif |
+ |
+ // Calculates the width of the popup and the x position of it. These values |
+ // will stay on the screen. |
+ std::pair<int, int> CalculatePopupXAndWidth( |
+ const gfx::Display& left_display, |
+ const gfx::Display& right_display, |
+ int popup_required_width); |
+ |
+ // Calculates the height of the popup and the y position of it. These values |
+ // will stay on the screen. |
+ std::pair<int, int> CalculatePopupYAndHeight( |
+ const gfx::Display& top_display, |
+ const gfx::Display& bottom_display, |
+ int popup_required_height); |
+ |
AutofillPopupView* view_; // Weak reference. |
AutofillPopupDelegate* delegate_; // Weak reference. |
gfx::NativeView container_view_; // Weak reference. |