| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 ProperlyResetController); | 76 ProperlyResetController); |
| 77 | 77 |
| 78 AutofillPopupControllerImpl(base::WeakPtr<AutofillPopupDelegate> delegate, | 78 AutofillPopupControllerImpl(base::WeakPtr<AutofillPopupDelegate> delegate, |
| 79 gfx::NativeView container_view, | 79 gfx::NativeView container_view, |
| 80 const gfx::RectF& element_bounds, | 80 const gfx::RectF& element_bounds, |
| 81 base::i18n::TextDirection text_direction); | 81 base::i18n::TextDirection text_direction); |
| 82 virtual ~AutofillPopupControllerImpl(); | 82 virtual ~AutofillPopupControllerImpl(); |
| 83 | 83 |
| 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 PointPreselected(int x, int y) OVERRIDE; |
| 87 virtual void MouseClicked(int x, int y) OVERRIDE; | 87 virtual void PointSelected(int x, int y) OVERRIDE; |
| 88 virtual void MouseExitedPopup() OVERRIDE; | 88 virtual void PreselectionCleared() 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::Rect GetRowBounds(size_t index) OVERRIDE; |
| 95 virtual void SetPopupBounds(const gfx::Rect& bounds) OVERRIDE; | 95 virtual void SetPopupBounds(const gfx::Rect& bounds) OVERRIDE; |
| 96 virtual const gfx::Rect& popup_bounds() const OVERRIDE; | 96 virtual const gfx::Rect& 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; |
| 107 virtual const gfx::Font& subtext_font() const OVERRIDE; | 107 virtual const gfx::Font& subtext_font() const OVERRIDE; |
| 108 #endif | 108 #endif |
| 109 virtual int selected_line() const OVERRIDE; | 109 virtual int preselected_line() const OVERRIDE; |
| 110 virtual bool hide_on_outside_click() const OVERRIDE; | 110 virtual bool hide_on_outside_click() const OVERRIDE; |
| 111 | 111 |
| 112 // Change which line is currently selected by the user. | 112 // Change which line is currently preselected by the user. |
| 113 void SetSelectedLine(int selected_line); | 113 void SetPreselectedLine(int preselected_line); |
| 114 | 114 |
| 115 // Increase the selected line by 1, properly handling wrapping. | 115 // Increase the preselected line by 1, properly handling wrapping. |
| 116 void SelectNextLine(); | 116 void PreselectNextLine(); |
| 117 | 117 |
| 118 // Decrease the selected line by 1, properly handling wrapping. | 118 // Decrease the preselected line by 1, properly handling wrapping. |
| 119 void SelectPreviousLine(); | 119 void PreselectPreviousLine(); |
| 120 | 120 |
| 121 // The user has choosen the selected line. | 121 // The user has chosen the preselected line. |
| 122 bool AcceptSelectedLine(); | 122 bool AcceptPreselectedLine(); |
| 123 | 123 |
| 124 // The user has removed a suggestion. | 124 // The user has removed a suggestion. |
| 125 bool RemoveSelectedLine(); | 125 bool RemovePreselectedLine(); |
| 126 | 126 |
| 127 // Convert a y-coordinate to the closest line. | 127 // Convert a y-coordinate to the closest line. |
| 128 int LineFromY(int y); | 128 int LineFromY(int y); |
| 129 | 129 |
| 130 // Returns the height of a row depending on its type. | 130 // Returns the height of a row depending on its type. |
| 131 int GetRowHeightFromId(int identifier) const; | 131 int GetRowHeightFromId(int identifier) const; |
| 132 | 132 |
| 133 // Returns true if the given id refers to an element that can be accepted. | 133 // Returns true if the given id refers to an element that can be accepted. |
| 134 bool CanAccept(int id); | 134 bool CanAccept(int id); |
| 135 | 135 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 // keep an unelided copy of the names to be able to pass to the delegate. | 219 // keep an unelided copy of the names to be able to pass to the delegate. |
| 220 std::vector<string16> full_names_; | 220 std::vector<string16> full_names_; |
| 221 | 221 |
| 222 #if !defined(OS_ANDROID) | 222 #if !defined(OS_ANDROID) |
| 223 // The fonts for the popup text. | 223 // The fonts for the popup text. |
| 224 gfx::Font name_font_; | 224 gfx::Font name_font_; |
| 225 gfx::Font subtext_font_; | 225 gfx::Font subtext_font_; |
| 226 gfx::Font warning_font_; | 226 gfx::Font warning_font_; |
| 227 #endif | 227 #endif |
| 228 | 228 |
| 229 // The line that is currently selected by the user. | 229 // The line that is currently preselected by the user. |
| 230 // |kNoSelection| indicates that no line is currently selected. | 230 // |kNoPreselection| indicates that no line is currently preselected. |
| 231 int selected_line_; | 231 int preselected_line_; |
| 232 | 232 |
| 233 // Whether the popup view should hide on mouse presses outside of it. | 233 // Whether the popup view should hide on mouse presses outside of it. |
| 234 bool hide_on_outside_click_; | 234 bool hide_on_outside_click_; |
| 235 | 235 |
| 236 content::RenderWidgetHost::KeyPressEventCallback key_press_event_callback_; | 236 content::RenderWidgetHost::KeyPressEventCallback key_press_event_callback_; |
| 237 | 237 |
| 238 base::WeakPtrFactory<AutofillPopupControllerImpl> weak_ptr_factory_; | 238 base::WeakPtrFactory<AutofillPopupControllerImpl> weak_ptr_factory_; |
| 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 |