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_EXTERNAL_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_EXTERNAL_DELEGATE_H_ |
6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_EXTERNAL_DELEGATE_H_ | 6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_EXTERNAL_DELEGATE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 const std::vector<string16>& autofill_values, | 56 const std::vector<string16>& autofill_values, |
57 const std::vector<string16>& autofill_labels, | 57 const std::vector<string16>& autofill_labels, |
58 const std::vector<string16>& autofill_icons, | 58 const std::vector<string16>& autofill_icons, |
59 const std::vector<int>& autofill_unique_ids); | 59 const std::vector<int>& autofill_unique_ids); |
60 | 60 |
61 // Show password suggestions in the popup. | 61 // Show password suggestions in the popup. |
62 void OnShowPasswordSuggestions(const std::vector<string16>& suggestions, | 62 void OnShowPasswordSuggestions(const std::vector<string16>& suggestions, |
63 const webkit::forms::FormField& field, | 63 const webkit::forms::FormField& field, |
64 const gfx::Rect& bounds); | 64 const gfx::Rect& bounds); |
65 | 65 |
| 66 // Set the data list value associated with the current field. |
| 67 void SetCurrentDataListValues(const std::vector<string16>& autofill_values, |
| 68 const std::vector<string16>& autofill_labels, |
| 69 const std::vector<string16>& autofill_icons, |
| 70 const std::vector<int>& autofill_unique_ids); |
| 71 |
66 // Remove the given Autocomplete entry from the DB. | 72 // Remove the given Autocomplete entry from the DB. |
67 virtual void RemoveAutocompleteEntry(const string16& value); | 73 virtual void RemoveAutocompleteEntry(const string16& value); |
68 | 74 |
69 // Remove the given Autofill profile or credit credit. | 75 // Remove the given Autofill profile or credit credit. |
70 virtual void RemoveAutofillProfileOrCreditCard(int unique_id); | 76 virtual void RemoveAutofillProfileOrCreditCard(int unique_id); |
71 | 77 |
72 // Inform the delegate that the text field editing has ended, this is | 78 // Inform the delegate that the text field editing has ended, this is |
73 // used to help record the metrics of when a new popup is shown. | 79 // used to help record the metrics of when a new popup is shown. |
74 void DidEndTextFieldEditing(); | 80 void DidEndTextFieldEditing(); |
75 | 81 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 // Return the profile that this autofill delegate is currently working with. | 134 // Return the profile that this autofill delegate is currently working with. |
129 Profile* profile() { return tab_contents_->profile(); } | 135 Profile* profile() { return tab_contents_->profile(); } |
130 | 136 |
131 private: | 137 private: |
132 // Fills the form with the Autofill data corresponding to |unique_id|. | 138 // Fills the form with the Autofill data corresponding to |unique_id|. |
133 // If |is_preview| is true then this is just a preview to show the user what | 139 // If |is_preview| is true then this is just a preview to show the user what |
134 // would be selected and if |is_preview| is false then the user has selected | 140 // would be selected and if |is_preview| is false then the user has selected |
135 // this data. | 141 // this data. |
136 void FillAutofillFormData(int unique_id, bool is_preview); | 142 void FillAutofillFormData(int unique_id, bool is_preview); |
137 | 143 |
| 144 // Handle applying any Autofill warnings to the Autofill popup. |
| 145 void ApplyAutofillWarnings(std::vector<string16>* autofill_values, |
| 146 std::vector<string16>* autofill_labels, |
| 147 std::vector<string16>* autofill_icons, |
| 148 std::vector<int>* autofill_unique_ids); |
| 149 |
| 150 // Handle applying any Autofill option listings to the Autofill popup. |
| 151 // This function should only get called when there is at least one |
| 152 // multi-field suggestion in the list of suggestions. |
| 153 void ApplyAutofillOptions(std::vector<string16>* autofill_values, |
| 154 std::vector<string16>* autofill_labels, |
| 155 std::vector<string16>* autofill_icons, |
| 156 std::vector<int>* autofill_unique_ids); |
| 157 |
| 158 // Insert the data list values at the start of the given list, including |
| 159 // any required separators. |
| 160 void InsertDataListValues(std::vector<string16>* autofill_values, |
| 161 std::vector<string16>* autofill_labels, |
| 162 std::vector<string16>* autofill_icons, |
| 163 std::vector<int>* autofill_unique_ids); |
| 164 |
138 TabContents* tab_contents_; // weak; owns me. | 165 TabContents* tab_contents_; // weak; owns me. |
139 AutofillManager* autofill_manager_; // weak. | 166 AutofillManager* autofill_manager_; // weak. |
140 | 167 |
141 // Password Autofill manager, handles all password-related Autofilling. | 168 // Password Autofill manager, handles all password-related Autofilling. |
142 PasswordAutofillManager password_autofill_manager_; | 169 PasswordAutofillManager password_autofill_manager_; |
143 | 170 |
144 // The ID of the last request sent for form field Autofill. Used to ignore | 171 // The ID of the last request sent for form field Autofill. Used to ignore |
145 // out of date responses. | 172 // out of date responses. |
146 int autofill_query_id_; | 173 int autofill_query_id_; |
147 | 174 |
148 // The current form and field selected by Autofill. | 175 // The current form and field selected by Autofill. |
149 webkit::forms::FormData autofill_query_form_; | 176 webkit::forms::FormData autofill_query_form_; |
150 webkit::forms::FormField autofill_query_field_; | 177 webkit::forms::FormField autofill_query_field_; |
151 | 178 |
152 // Should we display a warning if Autofill is disabled? | 179 // Should we display a warning if Autofill is disabled? |
153 bool display_warning_if_disabled_; | 180 bool display_warning_if_disabled_; |
154 | 181 |
155 // Have we already shown Autofill suggestions for the field the user is | 182 // Have we already shown Autofill suggestions for the field the user is |
156 // currently editing? Used to keep track of state for metrics logging. | 183 // currently editing? Used to keep track of state for metrics logging. |
157 bool has_shown_autofill_popup_for_current_edit_; | 184 bool has_shown_autofill_popup_for_current_edit_; |
158 | 185 |
| 186 // Used to indicate if a popup is currently being shown or not. |
| 187 bool popup_visible_; |
| 188 |
| 189 // The current data list values. |
| 190 std::vector<string16> data_list_values_; |
| 191 std::vector<string16> data_list_labels_; |
| 192 std::vector<string16> data_list_icons_; |
| 193 std::vector<int> data_list_unique_ids_; |
| 194 |
159 DISALLOW_COPY_AND_ASSIGN(AutofillExternalDelegate); | 195 DISALLOW_COPY_AND_ASSIGN(AutofillExternalDelegate); |
160 }; | 196 }; |
161 | 197 |
162 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_EXTERNAL_DELEGATE_H_ | 198 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_EXTERNAL_DELEGATE_H_ |
OLD | NEW |