| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
| 11 #include "base/i18n/rtl.h" | 11 #include "base/i18n/rtl.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
| 14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 15 #include "chrome/browser/ui/autofill/autofill_popup_controller.h" | 15 #include "chrome/browser/ui/autofill/autofill_popup_controller.h" |
| 16 #include "chrome/browser/ui/autofill/autofill_popup_layout_model.h" | 16 #include "chrome/browser/ui/autofill/autofill_popup_layout_model.h" |
| 17 #include "chrome/browser/ui/autofill/popup_controller_common.h" | 17 #include "chrome/browser/ui/autofill/popup_controller_common.h" |
| 18 #include "ui/gfx/geometry/rect.h" | 18 #include "ui/gfx/geometry/rect.h" |
| 19 #include "ui/gfx/geometry/rect_f.h" | 19 #include "ui/gfx/geometry/rect_f.h" |
| 20 #include "ui/native_theme/native_theme.h" | 20 #include "ui/native_theme/native_theme.h" |
| 21 | 21 |
| 22 namespace content { |
| 23 struct NativeWebKeyboardEvent; |
| 24 class WebContents; |
| 25 } |
| 26 |
| 22 namespace autofill { | 27 namespace autofill { |
| 23 | 28 |
| 24 class AutofillPopupDelegate; | 29 class AutofillPopupDelegate; |
| 25 class AutofillPopupView; | 30 class AutofillPopupView; |
| 26 | 31 |
| 27 // This class is a controller for an AutofillPopupView. It implements | 32 // This class is a controller for an AutofillPopupView. It implements |
| 28 // AutofillPopupController to allow calls from AutofillPopupView. The | 33 // AutofillPopupController to allow calls from AutofillPopupView. The |
| 29 // other, public functions are available to its instantiator. | 34 // other, public functions are available to its instantiator. |
| 30 class AutofillPopupControllerImpl : public AutofillPopupController { | 35 class AutofillPopupControllerImpl : public AutofillPopupController { |
| 31 public: | 36 public: |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 const base::string16& GetElidedValueAt(size_t row) const override; | 98 const base::string16& GetElidedValueAt(size_t row) const override; |
| 94 const base::string16& GetElidedLabelAt(size_t row) const override; | 99 const base::string16& GetElidedLabelAt(size_t row) const override; |
| 95 bool GetRemovalConfirmationText(int list_index, | 100 bool GetRemovalConfirmationText(int list_index, |
| 96 base::string16* title, | 101 base::string16* title, |
| 97 base::string16* body) override; | 102 base::string16* body) override; |
| 98 bool RemoveSuggestion(int list_index) override; | 103 bool RemoveSuggestion(int list_index) override; |
| 99 ui::NativeTheme::ColorId GetBackgroundColorIDForRow(int index) const override; | 104 ui::NativeTheme::ColorId GetBackgroundColorIDForRow(int index) const override; |
| 100 int selected_line() const override; | 105 int selected_line() const override; |
| 101 const AutofillPopupLayoutModel& layout_model() const override; | 106 const AutofillPopupLayoutModel& layout_model() const override; |
| 102 | 107 |
| 103 content::WebContents* web_contents(); | |
| 104 | |
| 105 // Change which line is currently selected by the user. | 108 // Change which line is currently selected by the user. |
| 106 void SetSelectedLine(int selected_line); | 109 void SetSelectedLine(int selected_line); |
| 107 | 110 |
| 108 // Increase the selected line by 1, properly handling wrapping. | 111 // Increase the selected line by 1, properly handling wrapping. |
| 109 void SelectNextLine(); | 112 void SelectNextLine(); |
| 110 | 113 |
| 111 // Decrease the selected line by 1, properly handling wrapping. | 114 // Decrease the selected line by 1, properly handling wrapping. |
| 112 void SelectPreviousLine(); | 115 void SelectPreviousLine(); |
| 113 | 116 |
| 114 // The user has removed a suggestion. | 117 // The user has removed a suggestion. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 127 AutofillPopupView* view() { return view_; } | 130 AutofillPopupView* view() { return view_; } |
| 128 | 131 |
| 129 // |view_| pass throughs (virtual for testing). | 132 // |view_| pass throughs (virtual for testing). |
| 130 virtual void ShowView(); | 133 virtual void ShowView(); |
| 131 virtual void InvalidateRow(size_t row); | 134 virtual void InvalidateRow(size_t row); |
| 132 | 135 |
| 133 base::WeakPtr<AutofillPopupControllerImpl> GetWeakPtr(); | 136 base::WeakPtr<AutofillPopupControllerImpl> GetWeakPtr(); |
| 134 | 137 |
| 135 // Contains common popup functionality such as popup layout. Protected for | 138 // Contains common popup functionality such as popup layout. Protected for |
| 136 // testing. | 139 // testing. |
| 137 std::unique_ptr<PopupControllerCommon> controller_common_; | 140 const PopupControllerCommon controller_common_; |
| 138 | 141 |
| 139 private: | 142 private: |
| 140 #if !defined(OS_ANDROID) | 143 #if !defined(OS_ANDROID) |
| 141 FRIEND_TEST_ALL_PREFIXES(AutofillPopupControllerUnitTest, ElideText); | 144 FRIEND_TEST_ALL_PREFIXES(AutofillPopupControllerUnitTest, ElideText); |
| 142 | 145 |
| 143 // Helper method which elides the value and label for the suggestion at |row| | 146 // Helper method which elides the value and label for the suggestion at |row| |
| 144 // given the |available_width|. Puts the results in |elided_values_| and | 147 // given the |available_width|. Puts the results in |elided_values_| and |
| 145 // |elided_labels_|. | 148 // |elided_labels_|. |
| 146 void ElideValueAndLabelForRow(size_t row, int available_width); | 149 void ElideValueAndLabelForRow(size_t row, int available_width); |
| 147 #endif | 150 #endif |
| (...skipping 20 matching lines...) Expand all Loading... |
| 168 // The line that is currently selected by the user. | 171 // The line that is currently selected by the user. |
| 169 // |kNoSelection| indicates that no line is currently selected. | 172 // |kNoSelection| indicates that no line is currently selected. |
| 170 int selected_line_; | 173 int selected_line_; |
| 171 | 174 |
| 172 base::WeakPtrFactory<AutofillPopupControllerImpl> weak_ptr_factory_; | 175 base::WeakPtrFactory<AutofillPopupControllerImpl> weak_ptr_factory_; |
| 173 }; | 176 }; |
| 174 | 177 |
| 175 } // namespace autofill | 178 } // namespace autofill |
| 176 | 179 |
| 177 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_CONTROLLER_IMPL_H_ | 180 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_CONTROLLER_IMPL_H_ |
| OLD | NEW |