OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_VIEW_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_VIEW_DELEGATE_H_ |
6 #define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_VIEW_DELEGATE_H_ | 6 #define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_VIEW_DELEGATE_H_ |
7 | 7 |
| 8 #include <stddef.h> |
| 9 #include <vector> |
| 10 |
8 #include "ui/gfx/native_widget_types.h" | 11 #include "ui/gfx/native_widget_types.h" |
9 | 12 |
10 namespace gfx { | 13 namespace gfx { |
11 class Point; | 14 class Point; |
12 class Rect; | 15 class Rect; |
13 class RectF; | 16 class RectF; |
14 } | 17 } |
15 | 18 |
16 namespace autofill { | 19 namespace autofill { |
17 | 20 |
| 21 struct Suggestion; |
| 22 |
18 // Base class for Controllers of Autofill-style popups. This interface is | 23 // Base class for Controllers of Autofill-style popups. This interface is |
19 // used by the relevant views to communicate with the controller. | 24 // used by the relevant views to communicate with the controller. |
20 class AutofillPopupViewDelegate { | 25 class AutofillPopupViewDelegate { |
21 public: | 26 public: |
22 // Called when the popup should be hidden. Controller will be deleted after | 27 // Called when the popup should be hidden. Controller will be deleted after |
23 // the view has been hidden and destroyed. | 28 // the view has been hidden and destroyed. |
24 virtual void Hide() = 0; | 29 virtual void Hide() = 0; |
25 | 30 |
26 // Called whent the popup view was destroyed. | 31 // Called whent the popup view was destroyed. |
27 virtual void ViewDestroyed() = 0; | 32 virtual void ViewDestroyed() = 0; |
28 | 33 |
29 // The user has selected |point|, e.g. by hovering the mouse cursor. |point| | 34 // The user has selected |point|, e.g. by hovering the mouse cursor. |point| |
30 // must be in popup coordinates. | 35 // must be in popup coordinates. |
31 virtual void SetSelectionAtPoint(const gfx::Point& point) = 0; | 36 virtual void SetSelectionAtPoint(const gfx::Point& point) = 0; |
32 | 37 |
33 // The user has accepted the currently selected line. Returns whether there | 38 // The user has accepted the currently selected line. Returns whether there |
34 // was a selection to accept. | 39 // was a selection to accept. |
35 virtual bool AcceptSelectedLine() = 0; | 40 virtual bool AcceptSelectedLine() = 0; |
36 | 41 |
37 // The user cleared the current selection, e.g. by moving the mouse cursor | 42 // The user cleared the current selection, e.g. by moving the mouse cursor |
38 // out of the popup bounds. | 43 // out of the popup bounds. |
39 virtual void SelectionCleared() = 0; | 44 virtual void SelectionCleared() = 0; |
40 | 45 |
41 // The actual bounds of the popup. | 46 // The actual bounds of the popup. |
42 virtual const gfx::Rect& popup_bounds() const = 0; | 47 virtual gfx::Rect popup_bounds() const = 0; |
43 | 48 |
44 // The view that the form field element sits in. | 49 // The view that the form field element sits in. |
45 virtual gfx::NativeView container_view() = 0; | 50 virtual gfx::NativeView container_view() = 0; |
46 | 51 |
47 // The bounds of the form field element (screen coordinates). | 52 // The bounds of the form field element (screen coordinates). |
48 virtual const gfx::RectF& element_bounds() const = 0; | 53 virtual const gfx::RectF& element_bounds() const = 0; |
49 | 54 |
50 // If the current popup should be displayed in RTL mode. | 55 // If the current popup should be displayed in RTL mode. |
51 virtual bool IsRTL() const = 0; | 56 virtual bool IsRTL() const = 0; |
52 | 57 |
| 58 // Returns the full set of autofill suggestions, if applicable. |
| 59 virtual const std::vector<autofill::Suggestion> GetSuggestions() = 0; |
| 60 |
| 61 #if !defined(OS_ANDROID) |
| 62 // Returns elided values and labels for the given |row|. |
| 63 virtual int GetElidedValueWidthForRow(size_t row) = 0; |
| 64 virtual int GetElidedLabelWidthForRow(size_t row) = 0; |
| 65 #endif |
| 66 |
53 protected: | 67 protected: |
54 virtual ~AutofillPopupViewDelegate() {} | 68 virtual ~AutofillPopupViewDelegate() {} |
55 }; | 69 }; |
56 | 70 |
57 } // namespace autofill | 71 } // namespace autofill |
58 | 72 |
59 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_VIEW_DELEGATE_H_ | 73 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_VIEW_DELEGATE_H_ |
OLD | NEW |