| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 // AutofillPopupController implementation. | 84 // AutofillPopupController implementation. |
| 85 virtual void UpdateBoundsAndRedrawPopup() OVERRIDE; | 85 virtual void UpdateBoundsAndRedrawPopup() OVERRIDE; |
| 86 virtual void MouseHovered(int x, int y) OVERRIDE; | 86 virtual void MouseHovered(int x, int y) OVERRIDE; |
| 87 virtual void MouseClicked(int x, int y) OVERRIDE; | 87 virtual void MouseClicked(int x, int y) OVERRIDE; |
| 88 virtual void MouseExitedPopup() OVERRIDE; | 88 virtual void MouseExitedPopup() OVERRIDE; |
| 89 virtual bool ShouldRepostEvent(const ui::MouseEvent& event) OVERRIDE; | 89 virtual bool ShouldRepostEvent(const ui::MouseEvent& event) OVERRIDE; |
| 90 virtual void AcceptSuggestion(size_t index) OVERRIDE; | 90 virtual void AcceptSuggestion(size_t index) OVERRIDE; |
| 91 virtual int GetIconResourceID(const string16& resource_name) OVERRIDE; | 91 virtual int GetIconResourceID(const string16& resource_name) OVERRIDE; |
| 92 virtual bool CanDelete(size_t index) const OVERRIDE; | 92 virtual bool CanDelete(size_t index) const OVERRIDE; |
| 93 virtual bool IsWarning(size_t index) const OVERRIDE; | 93 virtual bool IsWarning(size_t index) const OVERRIDE; |
| 94 virtual gfx::Rect GetRowBounds(size_t index) OVERRIDE; | 94 virtual gfx::RectF GetRowBounds(size_t index) OVERRIDE; |
| 95 virtual void SetPopupBounds(const gfx::Rect& bounds) OVERRIDE; | 95 virtual void SetPopupBounds(const gfx::RectF& bounds) OVERRIDE; |
| 96 virtual const gfx::Rect& popup_bounds() const OVERRIDE; | 96 virtual const gfx::RectF& popup_bounds() const OVERRIDE; |
| 97 virtual gfx::NativeView container_view() const OVERRIDE; | 97 virtual gfx::NativeView container_view() const OVERRIDE; |
| 98 virtual const gfx::RectF& element_bounds() const OVERRIDE; | 98 virtual const gfx::RectF& element_bounds() const OVERRIDE; |
| 99 virtual bool IsRTL() const OVERRIDE; | 99 virtual bool IsRTL() const OVERRIDE; |
| 100 | 100 |
| 101 virtual const std::vector<string16>& names() const OVERRIDE; | 101 virtual const std::vector<string16>& names() const OVERRIDE; |
| 102 virtual const std::vector<string16>& subtexts() const OVERRIDE; | 102 virtual const std::vector<string16>& subtexts() const OVERRIDE; |
| 103 virtual const std::vector<string16>& icons() const OVERRIDE; | 103 virtual const std::vector<string16>& icons() const OVERRIDE; |
| 104 virtual const std::vector<int>& identifiers() const OVERRIDE; | 104 virtual const std::vector<int>& identifiers() const OVERRIDE; |
| 105 #if !defined(OS_ANDROID) | 105 #if !defined(OS_ANDROID) |
| 106 virtual const gfx::Font& GetNameFontForRow(size_t index) const OVERRIDE; | 106 virtual const gfx::Font& GetNameFontForRow(size_t index) const OVERRIDE; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 | 145 |
| 146 AutofillPopupView* view() { return view_; } | 146 AutofillPopupView* view() { return view_; } |
| 147 | 147 |
| 148 // |view_| pass throughs (virtual for testing). | 148 // |view_| pass throughs (virtual for testing). |
| 149 virtual void ShowView(); | 149 virtual void ShowView(); |
| 150 virtual void InvalidateRow(size_t row); | 150 virtual void InvalidateRow(size_t row); |
| 151 | 151 |
| 152 // Protected so tests can access. | 152 // Protected so tests can access. |
| 153 #if !defined(OS_ANDROID) | 153 #if !defined(OS_ANDROID) |
| 154 // Calculates the desired width of the popup based on its contents. | 154 // Calculates the desired width of the popup based on its contents. |
| 155 int GetDesiredPopupWidth() const; | 155 float GetDesiredPopupWidth() const; |
| 156 | 156 |
| 157 // Calculates the desired height of the popup based on its contents. | 157 // Calculates the desired height of the popup based on its contents. |
| 158 int GetDesiredPopupHeight() const; | 158 int GetDesiredPopupHeight() const; |
| 159 | 159 |
| 160 // Calculate the width of the row, excluding all the text. This provides | 160 // Calculate the width of the row, excluding all the text. This provides |
| 161 // the size of the row that won't be reducible (since all the text can be | 161 // the size of the row that won't be reducible (since all the text can be |
| 162 // elided if there isn't enough space). | 162 // elided if there isn't enough space). |
| 163 int RowWidthWithoutText(int row) const; | 163 int RowWidthWithoutText(int row) const; |
| 164 #endif | 164 #endif |
| 165 | 165 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 176 // to prevent it from going off the screen. | 176 // to prevent it from going off the screen. |
| 177 void UpdatePopupBounds(); | 177 void UpdatePopupBounds(); |
| 178 #endif | 178 #endif |
| 179 | 179 |
| 180 // A helper function to get the display closest to the given point (virtual | 180 // A helper function to get the display closest to the given point (virtual |
| 181 // for testing). | 181 // for testing). |
| 182 virtual gfx::Display GetDisplayNearestPoint(const gfx::Point& point) const; | 182 virtual gfx::Display GetDisplayNearestPoint(const gfx::Point& point) const; |
| 183 | 183 |
| 184 // Calculates the width of the popup and the x position of it. These values | 184 // Calculates the width of the popup and the x position of it. These values |
| 185 // will stay on the screen. | 185 // will stay on the screen. |
| 186 std::pair<int, int> CalculatePopupXAndWidth( | 186 std::pair<float, float> CalculatePopupXAndWidth( |
| 187 const gfx::Display& left_display, | 187 const gfx::Display& left_display, |
| 188 const gfx::Display& right_display, | 188 const gfx::Display& right_display, |
| 189 int popup_required_width) const; | 189 float popup_required_width) const; |
| 190 | 190 |
| 191 // Calculates the height of the popup and the y position of it. These values | 191 // Calculates the height of the popup and the y position of it. These values |
| 192 // will stay on the screen. | 192 // will stay on the screen. |
| 193 std::pair<int, int> CalculatePopupYAndHeight( | 193 std::pair<int, int> CalculatePopupYAndHeight( |
| 194 const gfx::Display& top_display, | 194 const gfx::Display& top_display, |
| 195 const gfx::Display& bottom_display, | 195 const gfx::Display& bottom_display, |
| 196 int popup_required_height) const; | 196 int popup_required_height) const; |
| 197 | 197 |
| 198 AutofillPopupView* view_; // Weak reference. | 198 AutofillPopupView* view_; // Weak reference. |
| 199 base::WeakPtr<AutofillPopupDelegate> delegate_; | 199 base::WeakPtr<AutofillPopupDelegate> delegate_; |
| 200 gfx::NativeView container_view_; // Weak reference. | 200 gfx::NativeView container_view_; // Weak reference. |
| 201 | 201 |
| 202 // The bounds of the text element that is the focus of the Autofill. | 202 // The bounds of the text element that is the focus of the Autofill. |
| 203 // These coordinates are in screen space. | 203 // These coordinates are in screen space. |
| 204 const gfx::RectF element_bounds_; | 204 const gfx::RectF element_bounds_; |
| 205 | 205 |
| 206 // The bounds of the Autofill popup. | 206 // The bounds of the Autofill popup. |
| 207 gfx::Rect popup_bounds_; | 207 gfx::RectF popup_bounds_; |
| 208 | 208 |
| 209 // The text direction of the popup. | 209 // The text direction of the popup. |
| 210 base::i18n::TextDirection text_direction_; | 210 base::i18n::TextDirection text_direction_; |
| 211 | 211 |
| 212 // The current Autofill query values. | 212 // The current Autofill query values. |
| 213 std::vector<string16> names_; | 213 std::vector<string16> names_; |
| 214 std::vector<string16> subtexts_; | 214 std::vector<string16> subtexts_; |
| 215 std::vector<string16> icons_; | 215 std::vector<string16> icons_; |
| 216 std::vector<int> identifiers_; | 216 std::vector<int> identifiers_; |
| 217 | 217 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 234 bool hide_on_outside_click_; | 234 bool hide_on_outside_click_; |
| 235 | 235 |
| 236 base::WeakPtrFactory<AutofillPopupControllerImpl> weak_ptr_factory_; | 236 base::WeakPtrFactory<AutofillPopupControllerImpl> weak_ptr_factory_; |
| 237 | 237 |
| 238 content::RenderWidgetHost::KeyPressEventCallback key_press_event_callback_; | 238 content::RenderWidgetHost::KeyPressEventCallback key_press_event_callback_; |
| 239 }; | 239 }; |
| 240 | 240 |
| 241 } // namespace autofill | 241 } // namespace autofill |
| 242 | 242 |
| 243 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_CONTROLLER_IMPL_H_ | 243 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_CONTROLLER_IMPL_H_ |
| OLD | NEW |