Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Side by Side Diff: chrome/browser/ui/autofill/autofill_popup_controller.h

Issue 1570783003: [Autofill] Move functions from the AutofillPopupController to AutofillPopupLayoutModel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed nit Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_H_ 5 #ifndef CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_CONTROLLER_H_ 6 #define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_CONTROLLER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.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_view_delegate.h" 15 #include "chrome/browser/ui/autofill/autofill_popup_view_delegate.h"
16 16
17 namespace gfx { 17 namespace gfx {
18 class FontList; 18 class FontList;
19 class Point; 19 class Point;
20 class Rect; 20 class Rect;
21 } 21 }
22 22
23 namespace autofill { 23 namespace autofill {
24 24
25 class AutofillPopupLayoutModel;
25 struct Suggestion; 26 struct Suggestion;
26 27
27 // This interface provides data to an AutofillPopupView. 28 // This interface provides data to an AutofillPopupView.
28 class AutofillPopupController : public AutofillPopupViewDelegate { 29 class AutofillPopupController : public AutofillPopupViewDelegate {
29 public: 30 public:
30 // Recalculates the height and width of the popup and triggers a redraw. 31 // Recalculates the height and width of the popup and triggers a redraw.
31 virtual void UpdateBoundsAndRedrawPopup() = 0; 32 virtual void UpdateBoundsAndRedrawPopup() = 0;
32 33
33 // Accepts the suggestion at |index|. 34 // Accepts the suggestion at |index|.
34 virtual void AcceptSuggestion(size_t index) = 0; 35 virtual void AcceptSuggestion(size_t index) = 0;
35 36
36 // Gets the resource value for the given resource, returning -1 if the
37 // resource isn't recognized.
38 virtual int GetIconResourceID(const base::string16& resource_name) const = 0;
39
40 // Returns true if the given index refers to an element that is a warning 37 // Returns true if the given index refers to an element that is a warning
41 // rather than an Autofill suggestion. 38 // rather than an Autofill suggestion.
42 virtual bool IsWarning(size_t index) const = 0; 39 virtual bool IsWarning(size_t index) const = 0;
43 40
44 // Returns the bounds of the item at |index| in the popup, relative to
45 // the top left of the popup.
46 virtual gfx::Rect GetRowBounds(size_t index) = 0;
47
48 // Returns the number of lines of data that there are. 41 // Returns the number of lines of data that there are.
49 virtual size_t GetLineCount() const = 0; 42 virtual size_t GetLineCount() const = 0;
50 43
51 // Returns the suggestion or pre-elided string at the given row index. 44 // Returns the suggestion or pre-elided string at the given row index.
52 virtual const autofill::Suggestion& GetSuggestionAt(size_t row) const = 0; 45 virtual const autofill::Suggestion& GetSuggestionAt(size_t row) const = 0;
53 virtual const base::string16& GetElidedValueAt(size_t row) const = 0; 46 virtual const base::string16& GetElidedValueAt(size_t row) const = 0;
54 virtual const base::string16& GetElidedLabelAt(size_t row) const = 0; 47 virtual const base::string16& GetElidedLabelAt(size_t row) const = 0;
55 48
56 // Returns whether the item at |list_index| can be removed. If so, fills 49 // Returns whether the item at |list_index| can be removed. If so, fills
57 // out |title| and |body| (when non-null) with relevant user-facing text. 50 // out |title| and |body| (when non-null) with relevant user-facing text.
58 virtual bool GetRemovalConfirmationText(int index, 51 virtual bool GetRemovalConfirmationText(int index,
59 base::string16* title, 52 base::string16* title,
60 base::string16* body) = 0; 53 base::string16* body) = 0;
61 54
62 // Removes the suggestion at the given index. 55 // Removes the suggestion at the given index.
63 virtual bool RemoveSuggestion(int index) = 0; 56 virtual bool RemoveSuggestion(int index) = 0;
64 57
65 #if !defined(OS_ANDROID) 58 #if !defined(OS_ANDROID)
66 // The same font can vary based on the type of data it is showing, 59 // The same font can vary based on the type of data it is showing,
67 // so we need to know the row. 60 // so we need to know the row.
68 virtual const gfx::FontList& GetValueFontListForRow(size_t index) const = 0; 61 virtual const gfx::FontList& GetValueFontListForRow(size_t index) const = 0;
69 virtual const gfx::FontList& GetLabelFontList() const = 0; 62 virtual const gfx::FontList& GetLabelFontList() const = 0;
70 #endif 63 #endif
71 64
72 // Returns the index of the selected line. A line is "selected" when it is 65 // Returns the index of the selected line. A line is "selected" when it is
73 // hovered or has keyboard focus. 66 // hovered or has keyboard focus.
74 virtual int selected_line() const = 0; 67 virtual int selected_line() const = 0;
75 68
69 virtual const AutofillPopupLayoutModel& layout_model() const = 0;
70
76 protected: 71 protected:
77 ~AutofillPopupController() override {} 72 ~AutofillPopupController() override {}
78 }; 73 };
79 74
80 } // namespace autofill 75 } // namespace autofill
81 76
82 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_CONTROLLER_H_ 77 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698