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

Side by Side Diff: chrome/browser/autofill/autofill_popup_view.h

Issue 10073018: Add Delete Support to New Autofill UI (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 8 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_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
(...skipping 16 matching lines...) Expand all
27 virtual ~AutofillPopupView(); 27 virtual ~AutofillPopupView();
28 28
29 // Hide the popup from view. Platform-indepent work. 29 // Hide the popup from view. Platform-indepent work.
30 virtual void Hide(); 30 virtual void Hide();
31 31
32 // 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.
33 // Platform-independent work. 33 // Platform-independent work.
34 void Show(const std::vector<string16>& autofill_values, 34 void Show(const std::vector<string16>& autofill_values,
35 const std::vector<string16>& autofill_labels, 35 const std::vector<string16>& autofill_labels,
36 const std::vector<string16>& autofill_icons, 36 const std::vector<string16>& autofill_icons,
37 const std::vector<int>& autofill_unique_ids, 37 const std::vector<int>& autofill_unique_ids);
38 int separator_index);
39 38
40 void set_element_bounds(const gfx::Rect& bounds) { 39 void set_element_bounds(const gfx::Rect& bounds) {
41 element_bounds_ = bounds; 40 element_bounds_ = bounds;
42 } 41 }
43 42
44 const gfx::Rect& element_bounds() { return element_bounds_; } 43 const gfx::Rect& element_bounds() { return element_bounds_; }
45 44
46 protected: 45 protected:
47 // Display the autofill popup and fill it in with the values passed in. 46 // Display the autofill popup and fill it in with the values passed in.
48 // Platform-dependent work. 47 // Platform-dependent work.
49 virtual void ShowInternal() = 0; 48 virtual void ShowInternal() = 0;
50 49
51 // Hide the popup from view. Platform-dependent work. 50 // Hide the popup from view. Platform-dependent work.
52 virtual void HideInternal() = 0; 51 virtual void HideInternal() = 0;
53 52
54 // Invalide the given row and redraw it. 53 // Invalide the given row and redraw it.
55 virtual void InvalidateRow(size_t row) = 0; 54 virtual void InvalidateRow(size_t row) = 0;
56 55
56 // Adjust the size of the popup to show the elements being held.
57 virtual void ResizePopup() = 0;
58
57 AutofillExternalDelegate* external_delegate() { return external_delegate_; } 59 AutofillExternalDelegate* external_delegate() { return external_delegate_; }
58 60
59 const std::vector<string16>& autofill_values() const { 61 const std::vector<string16>& autofill_values() const {
60 return autofill_values_; 62 return autofill_values_;
61 } 63 }
62 const std::vector<string16>& autofill_labels() const { 64 const std::vector<string16>& autofill_labels() const {
63 return autofill_labels_; 65 return autofill_labels_;
64 } 66 }
65 const std::vector<string16>& autofill_icons() const { 67 const std::vector<string16>& autofill_icons() const {
66 return autofill_icons_; 68 return autofill_icons_;
67 } 69 }
68 const std::vector<int>& autofill_unique_ids() const { 70 const std::vector<int>& autofill_unique_ids() const {
69 return autofill_unique_ids_; 71 return autofill_unique_ids_;
70 } 72 }
71 int separator_index() const { return separator_index_; }
72 73
73 int selected_line() const { return selected_line_; } 74 int selected_line() const { return selected_line_; }
74 75
75 // Change which line is currently selected by the user. 76 // Change which line is currently selected by the user.
76 void SetSelectedLine(int selected_line); 77 void SetSelectedLine(int selected_line);
77 78
78 // Increase the selected line by 1, properly handling wrapping. 79 // Increase the selected line by 1, properly handling wrapping.
79 void SelectNextLine(); 80 void SelectNextLine();
80 81
81 // Decrease the selected line by 1, properly handling wrapping. 82 // Decrease the selected line by 1, properly handling wrapping.
82 void SelectPreviousLine(); 83 void SelectPreviousLine();
83 84
84 // The user has choosen the selected line. 85 // The user has choosen the selected line.
85 bool AcceptSelectedLine(); 86 bool AcceptSelectedLine();
86 87
87 // The user has removed a suggestion. 88 // The user has removed a suggestion.
88 bool RemoveSelectedLine(); 89 bool RemoveSelectedLine();
89 90
91 // Return true if the index is the first element of a new section and should
92 // have a separator above it.
93 bool IsSeparatorIndex(int index);
94
90 private: 95 private:
96 // Returns true if the given id refers to an element that can be deleted.
97 bool CanDelete(int id);
98
91 // content::NotificationObserver method override. 99 // content::NotificationObserver method override.
92 virtual void Observe(int type, 100 virtual void Observe(int type,
93 const content::NotificationSource& source, 101 const content::NotificationSource& source,
94 const content::NotificationDetails& details) OVERRIDE; 102 const content::NotificationDetails& details) OVERRIDE;
95 103
96 // A scoped container for notification registries. 104 // A scoped container for notification registries.
97 content::NotificationRegistrar registrar_; 105 content::NotificationRegistrar registrar_;
98 106
99 AutofillExternalDelegate* external_delegate_; 107 AutofillExternalDelegate* external_delegate_;
100 108
101 // The bounds of the text element that is the focus of the Autofill. 109 // The bounds of the text element that is the focus of the Autofill.
102 gfx::Rect element_bounds_; 110 gfx::Rect element_bounds_;
103 111
104 // The current Autofill query values. 112 // The current Autofill query values.
105 std::vector<string16> autofill_values_; 113 std::vector<string16> autofill_values_;
106 std::vector<string16> autofill_labels_; 114 std::vector<string16> autofill_labels_;
107 std::vector<string16> autofill_icons_; 115 std::vector<string16> autofill_icons_;
108 std::vector<int> autofill_unique_ids_; 116 std::vector<int> autofill_unique_ids_;
109 117
110 // The location of the separator index (which separates the returned values
111 // from the Autofill options).
112 int separator_index_;
113
114 // The line that is currently selected by the user. 118 // The line that is currently selected by the user.
115 // |kNoSelection| indicates that no line is currently selected. 119 // |kNoSelection| indicates that no line is currently selected.
116 int selected_line_; 120 int selected_line_;
117 }; 121 };
118 122
119 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_POPUP_VIEW_H_ 123 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_POPUP_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698