Chromium Code Reviews| 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 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 64 const std::vector<string16>& autofill_labels() const { | 64 const std::vector<string16>& autofill_labels() const { |
| 65 return autofill_labels_; | 65 return autofill_labels_; |
| 66 } | 66 } |
| 67 const std::vector<string16>& autofill_icons() const { | 67 const std::vector<string16>& autofill_icons() const { |
| 68 return autofill_icons_; | 68 return autofill_icons_; |
| 69 } | 69 } |
| 70 const std::vector<int>& autofill_unique_ids() const { | 70 const std::vector<int>& autofill_unique_ids() const { |
| 71 return autofill_unique_ids_; | 71 return autofill_unique_ids_; |
| 72 } | 72 } |
| 73 | 73 |
| 74 int row_count() const { return row_count_; } | |
| 75 | |
| 74 int selected_line() const { return selected_line_; } | 76 int selected_line() const { return selected_line_; } |
| 75 | 77 |
| 76 // Change which line is currently selected by the user. | 78 // Change which line is currently selected by the user. |
| 77 void SetSelectedLine(int selected_line); | 79 void SetSelectedLine(int selected_line); |
| 78 | 80 |
| 79 // Increase the selected line by 1, properly handling wrapping. | 81 // Increase the selected line by 1, properly handling wrapping. |
| 80 void SelectNextLine(); | 82 void SelectNextLine(); |
| 81 | 83 |
| 82 // Decrease the selected line by 1, properly handling wrapping. | 84 // Decrease the selected line by 1, properly handling wrapping. |
| 83 void SelectPreviousLine(); | 85 void SelectPreviousLine(); |
| 84 | 86 |
| 85 // The user has choosen the selected line. | 87 // The user has choosen the selected line. |
| 86 bool AcceptSelectedLine(); | 88 bool AcceptSelectedLine(); |
| 87 | 89 |
| 88 // The user has removed a suggestion. | 90 // The user has removed a suggestion. |
| 89 bool RemoveSelectedLine(); | 91 bool RemoveSelectedLine(); |
| 90 | 92 |
| 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 | |
| 95 // Get the resource value for the given resource, returning -1 if the | 93 // Get the resource value for the given resource, returning -1 if the |
| 96 // resource isn't recognized. | 94 // resource isn't recognized. |
| 97 int GetIconResourceID(const string16& resource_name); | 95 int GetIconResourceID(const string16& resource_name); |
| 98 | 96 |
| 97 // Get the number of rows this popup will display. | |
| 98 int GetRowCount(); | |
| 99 | |
| 100 // Convert the given row to its index value. A return value of -1 indicates | |
| 101 // the given row was out of bounds. | |
| 102 int RowToIndex(size_t row); | |
|
Ilya Sherman
2012/05/22 20:44:03
This seems much more complex than just storing the
| |
| 103 | |
| 99 private: | 104 private: |
| 100 // Returns true if the given id refers to an element that can be deleted. | 105 // Returns true if the given id refers to an element that can be deleted. |
| 101 bool CanDelete(int id); | 106 bool CanDelete(int id); |
| 102 | 107 |
| 103 // Returns true if the popup still has non-options entries to show the user. | 108 // Returns true if the popup still has non-options entries to show the user. |
| 104 bool HasAutofillEntries(); | 109 bool HasAutofillEntries(); |
| 105 | 110 |
| 106 // content::NotificationObserver method override. | 111 // content::NotificationObserver method override. |
| 107 virtual void Observe(int type, | 112 virtual void Observe(int type, |
| 108 const content::NotificationSource& source, | 113 const content::NotificationSource& source, |
| 109 const content::NotificationDetails& details) OVERRIDE; | 114 const content::NotificationDetails& details) OVERRIDE; |
| 110 | 115 |
| 111 // A scoped container for notification registries. | 116 // A scoped container for notification registries. |
| 112 content::NotificationRegistrar registrar_; | 117 content::NotificationRegistrar registrar_; |
| 113 | 118 |
| 114 AutofillExternalDelegate* external_delegate_; | 119 AutofillExternalDelegate* external_delegate_; |
| 115 | 120 |
| 116 // The bounds of the text element that is the focus of the Autofill. | 121 // The bounds of the text element that is the focus of the Autofill. |
| 117 gfx::Rect element_bounds_; | 122 gfx::Rect element_bounds_; |
| 118 | 123 |
| 119 // The current Autofill query values. | 124 // The current Autofill query values. |
| 120 std::vector<string16> autofill_values_; | 125 std::vector<string16> autofill_values_; |
| 121 std::vector<string16> autofill_labels_; | 126 std::vector<string16> autofill_labels_; |
| 122 std::vector<string16> autofill_icons_; | 127 std::vector<string16> autofill_icons_; |
| 123 std::vector<int> autofill_unique_ids_; | 128 std::vector<int> autofill_unique_ids_; |
| 124 | 129 |
| 130 // The number of rows that will be displayed in the popup. | |
| 131 int row_count_; | |
| 132 | |
| 133 // Mapping to allow conversion between the row and the old index values. | |
| 134 std::vector<int> row_to_index_mapping_; | |
| 135 | |
| 125 // The line that is currently selected by the user. | 136 // The line that is currently selected by the user. |
| 126 // |kNoSelection| indicates that no line is currently selected. | 137 // |kNoSelection| indicates that no line is currently selected. |
| 127 int selected_line_; | 138 int selected_line_; |
| 128 }; | 139 }; |
| 129 | 140 |
| 130 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_POPUP_VIEW_H_ | 141 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_POPUP_VIEW_H_ |
| OLD | NEW |