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_AUTOFILL_AUTOFILL_POPUP_VIEW_H_ | 5 #ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_POPUP_VIEW_H_ |
6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_POPUP_VIEW_H_ | 6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_POPUP_VIEW_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/string16.h" | 12 #include "base/string16.h" |
13 #include "content/public/browser/notification_registrar.h" | 13 #include "content/public/browser/notification_registrar.h" |
14 #include "content/public/browser/notification_observer.h" | 14 #include "content/public/browser/notification_observer.h" |
15 #include "ui/gfx/rect.h" | 15 #include "ui/gfx/rect.h" |
16 | 16 |
17 namespace content { | 17 namespace content { |
18 class WebContents; | 18 class WebContents; |
19 } | 19 } |
20 | 20 |
21 class AutofillExternalDelegate; | |
22 | |
21 class AutofillPopupView : public content::NotificationObserver { | 23 class AutofillPopupView : public content::NotificationObserver { |
22 public: | 24 public: |
23 explicit AutofillPopupView(content::WebContents* web_contents); | 25 explicit AutofillPopupView(content::WebContents* web_contents, |
26 AutofillExternalDelegate* external_delegate_); | |
24 virtual ~AutofillPopupView(); | 27 virtual ~AutofillPopupView(); |
25 | 28 |
26 // Hide the popup from view. | 29 // Hide the popup from view. Platform-indepent work. |
27 virtual void Hide() = 0; | 30 virtual void Hide(); |
28 | 31 |
29 // Display the autofill popup and fill it in with the values passed in. | 32 // Display the autofill popup and fill it in with the values passed in. |
30 // Platform-independent work. | 33 // Platform-independent work. |
31 void Show(const std::vector<string16>& autofill_values, | 34 void Show(const std::vector<string16>& autofill_values, |
32 const std::vector<string16>& autofill_labels, | 35 const std::vector<string16>& autofill_labels, |
33 const std::vector<string16>& autofill_icons, | 36 const std::vector<string16>& autofill_icons, |
34 const std::vector<int>& autofill_unique_ids, | 37 const std::vector<int>& autofill_unique_ids, |
35 int separator_index); | 38 int separator_index); |
36 | 39 |
40 AutofillExternalDelegate* external_delegate() { return external_delegate_; } | |
Ilya Sherman
2012/02/04 04:10:52
nit: Can this have protected visibility rather tha
csharp
2012/02/07 22:30:58
Done.
| |
37 | 41 |
38 void set_element_bounds(const gfx::Rect& bounds) { | 42 void set_element_bounds(const gfx::Rect& bounds) { |
39 element_bounds_ = bounds; | 43 element_bounds_ = bounds; |
40 } | 44 } |
41 | 45 |
42 const gfx::Rect& element_bounds() { return element_bounds_; } | 46 const gfx::Rect& element_bounds() { return element_bounds_; } |
43 | 47 |
44 protected: | 48 protected: |
45 // Display the autofill popup and fill it in with the values passed in. | 49 // Display the autofill popup and fill it in with the values passed in. |
46 // Platform-dependent work. | 50 // Platform-dependent work. |
47 virtual void ShowInternal() = 0; | 51 virtual void ShowInternal() = 0; |
48 | 52 |
53 // Hide the popup from view. Platform-dependent work. | |
54 virtual void HideInternal() = 0; | |
55 | |
56 // Invalide the given row and redraw it. | |
57 virtual void InvalidateRow(size_t row) = 0; | |
58 | |
49 const std::vector<string16>& autofill_values() const { | 59 const std::vector<string16>& autofill_values() const { |
50 return autofill_values_; | 60 return autofill_values_; |
51 } | 61 } |
52 const std::vector<string16>& autofill_labels() const { | 62 const std::vector<string16>& autofill_labels() const { |
53 return autofill_labels_; | 63 return autofill_labels_; |
54 } | 64 } |
55 const std::vector<string16>& autofill_icons() const { | 65 const std::vector<string16>& autofill_icons() const { |
56 return autofill_icons_; | 66 return autofill_icons_; |
57 } | 67 } |
68 const std::vector<int>& autofill_unique_ids() const { | |
69 return autofill_unique_ids_; | |
70 } | |
58 int separator_index() const { return separator_index_; } | 71 int separator_index() const { return separator_index_; } |
59 | 72 |
73 int selected_line() const { return selected_line_; } | |
74 | |
75 // Change which line is currently selected by the user. | |
76 void SetSelectedLine(int selected_line); | |
77 | |
60 private: | 78 private: |
61 // content::NotificationObserver method override. | 79 // content::NotificationObserver method override. |
62 virtual void Observe(int type, | 80 virtual void Observe(int type, |
63 const content::NotificationSource& source, | 81 const content::NotificationSource& source, |
64 const content::NotificationDetails& details) OVERRIDE; | 82 const content::NotificationDetails& details) OVERRIDE; |
65 | 83 |
66 // A scoped container for notification registries. | 84 // A scoped container for notification registries. |
67 content::NotificationRegistrar registrar_; | 85 content::NotificationRegistrar registrar_; |
68 | 86 |
87 AutofillExternalDelegate* external_delegate_; | |
88 | |
69 // The bounds of the text element that is the focus of the Autofill. | 89 // The bounds of the text element that is the focus of the Autofill. |
70 gfx::Rect element_bounds_; | 90 gfx::Rect element_bounds_; |
71 | 91 |
72 // The current Autofill query values. | 92 // The current Autofill query values. |
73 std::vector<string16> autofill_values_; | 93 std::vector<string16> autofill_values_; |
74 std::vector<string16> autofill_labels_; | 94 std::vector<string16> autofill_labels_; |
75 std::vector<string16> autofill_icons_; | 95 std::vector<string16> autofill_icons_; |
76 std::vector<int> autofill_unique_ids_; | 96 std::vector<int> autofill_unique_ids_; |
77 | 97 |
78 // The location of the separator index (which separates the returned values | 98 // The location of the separator index (which separates the returned values |
79 // from the Autofill options). | 99 // from the Autofill options). |
80 int separator_index_; | 100 int separator_index_; |
101 | |
102 // The line that is currently selected by the user. | |
103 // -1 indicates that no line is currently selected. | |
104 int selected_line_; | |
81 }; | 105 }; |
82 | 106 |
83 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_POPUP_VIEW_H_ | 107 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_POPUP_VIEW_H_ |
OLD | NEW |