[Password manager] Temporarily add some CHECKs to investigate a crash
[chromium-blink-merge.git] / chrome / browser / ui / autofill / autofill_popup_controller.h
blobc1631a07274d340601b75bfc17d318a62f426c7e
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_CONTROLLER_H_
8 #include <vector>
10 #include "base/compiler_specific.h"
11 #include "base/strings/string16.h"
12 #include "chrome/browser/ui/autofill/autofill_popup_view_delegate.h"
14 namespace gfx {
15 class FontList;
16 class Point;
17 class Rect;
20 namespace autofill {
22 struct Suggestion;
24 // This interface provides data to an AutofillPopupView.
25 class AutofillPopupController : public AutofillPopupViewDelegate {
26 public:
27 // Recalculates the height and width of the popup and triggers a redraw.
28 virtual void UpdateBoundsAndRedrawPopup() = 0;
30 // Accepts the suggestion at |index|.
31 virtual void AcceptSuggestion(size_t index) = 0;
33 // Gets the resource value for the given resource, returning -1 if the
34 // resource isn't recognized.
35 virtual int GetIconResourceID(const base::string16& resource_name) const = 0;
37 // Returns true if the given index refers to an element that is a warning
38 // rather than an Autofill suggestion.
39 virtual bool IsWarning(size_t index) const = 0;
41 // Updates the bounds of the popup and initiates a redraw.
42 virtual void SetPopupBounds(const gfx::Rect& bounds) = 0;
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;
48 // Returns the number of lines of data that there are.
49 virtual size_t GetLineCount() const = 0;
51 // Returns the suggestion or pre-elided string at the given row index.
52 virtual const autofill::Suggestion& GetSuggestionAt(size_t row) const = 0;
53 virtual const base::string16& GetElidedValueAt(size_t row) const = 0;
54 virtual const base::string16& GetElidedLabelAt(size_t row) const = 0;
56 #if !defined(OS_ANDROID)
57 // The same font can vary based on the type of data it is showing,
58 // so we need to know the row.
59 virtual const gfx::FontList& GetValueFontListForRow(size_t index) const = 0;
60 virtual const gfx::FontList& GetLabelFontList() const = 0;
61 #endif
63 // Returns the index of the selected line. A line is "selected" when it is
64 // hovered or has keyboard focus.
65 virtual int selected_line() const = 0;
67 protected:
68 ~AutofillPopupController() override {}
71 } // namespace autofill
73 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_CONTROLLER_H_