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_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_VIEW_H_ |
6 #define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_VIEW_H_ | 6 #define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_VIEW_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include "base/strings/string16.h" | |
11 #include "chrome/browser/ui/autofill/autofill_popup_view_delegate.h" | |
12 #include "chrome/browser/ui/autofill/popup_view_utils.h" | |
13 #include "ui/gfx/geometry/rect.h" | |
10 #include "ui/gfx/native_widget_types.h" | 14 #include "ui/gfx/native_widget_types.h" |
11 | 15 |
12 namespace gfx { | 16 namespace gfx { |
13 class Rect; | 17 class Display; |
18 class Point; | |
14 } | 19 } |
15 | 20 |
16 namespace ui { | 21 namespace ui { |
17 class KeyEvent; | 22 class KeyEvent; |
18 } | 23 } |
19 | 24 |
20 namespace autofill { | 25 namespace autofill { |
21 | 26 |
22 class AutofillPopupController; | 27 class AutofillPopupController; |
23 | 28 |
24 // The interface for creating and controlling a platform-dependent | 29 // The interface for creating and controlling a platform-dependent |
25 // AutofillPopupView. | 30 // AutofillPopupView. |
26 class AutofillPopupView { | 31 class AutofillPopupView { |
27 public: | 32 public: |
28 // The minimum amount of padding between the Autofill name and subtext, | 33 // The minimum amount of padding between the Autofill name and subtext, |
29 // in pixels. | 34 // in pixels. |
30 static const size_t kNamePadding = 15; | 35 static const size_t kNamePadding = 15; |
Evan Stade
2016/01/13 04:30:27
is there a reason to keep these constants here and
Mathieu
2016/01/13 17:04:27
Moved to helper, removed kDeleteIcon* constants
| |
31 | 36 |
32 // The amount of padding between icons in pixels. | 37 // The amount of padding between icons in pixels. |
33 static const int kIconPadding = 5; | 38 static const int kIconPadding = 5; |
34 | 39 |
35 // The amount of padding at the end of the popup in pixels. | 40 // The amount of padding at the end of the popup in pixels. |
36 static const int kEndPadding = 3; | 41 static const int kEndPadding = 3; |
37 | 42 |
38 // Height of the delete icon in pixels. | 43 // Height of the delete icon in pixels. |
39 static const int kDeleteIconHeight = 16; | 44 static const int kDeleteIconHeight = 16; |
40 | 45 |
41 // Width of the delete icon in pixels. | 46 // Width of the delete icon in pixels. |
42 static const int kDeleteIconWidth = 16; | 47 static const int kDeleteIconWidth = 16; |
43 | 48 |
44 // Displays the Autofill popup and fills it in with data from the controller. | 49 // Displays the Autofill popup and fills it in with data from the controller. |
45 virtual void Show() = 0; | 50 virtual void Show() = 0; |
46 | 51 |
47 // Hides the popup from view. This will cause the popup to be deleted. | 52 // Hides the popup from view. This will cause the popup to be deleted. |
48 virtual void Hide() = 0; | 53 virtual void Hide() = 0; |
49 | 54 |
50 // Invalidates the given row and redraw it. | 55 // Invalidates the given row and redraw it. |
51 virtual void InvalidateRow(size_t row) = 0; | 56 virtual void InvalidateRow(size_t row) = 0; |
52 | 57 |
53 // Refreshes the position of the popup. | 58 // Refreshes the position of the popup. |
54 virtual void UpdateBoundsAndRedrawPopup() = 0; | 59 virtual void UpdateBoundsAndRedrawPopup() = 0; |
55 | 60 |
61 #if !defined(OS_ANDROID) | |
62 // Simply updates the popup bounds and doesn't redraw. | |
63 virtual void UpdatePopupBounds() = 0; | |
64 | |
65 // Get the available space for the total text width. |with_label| indicates | |
66 // whether a label is expected to be present. | |
67 virtual int GetAvailableWidthForRow(int row, bool with_label) = 0; | |
68 #endif | |
69 | |
70 // Convert a y-coordinate to the closest line. | |
71 virtual int LineFromY(int y) = 0; | |
72 | |
73 virtual gfx::Rect GetPopupBounds() = 0; | |
74 | |
56 // Factory function for creating the view. | 75 // Factory function for creating the view. |
57 static AutofillPopupView* Create(AutofillPopupController* controller); | 76 static AutofillPopupView* Create(AutofillPopupController* controller); |
58 | 77 |
59 protected: | 78 protected: |
60 virtual ~AutofillPopupView() {} | 79 virtual ~AutofillPopupView() {} |
61 }; | 80 }; |
62 | 81 |
63 } // namespace autofill | 82 } // namespace autofill |
64 | 83 |
65 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_VIEW_H_ | 84 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_VIEW_H_ |
OLD | NEW |