| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_EXTERNAL_DELEGATE_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_EXTERNAL_DELEGATE_H_ |
| 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_EXTERNAL_DELEGATE_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_EXTERNAL_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 // Records and associates a query_id with web form data. Called | 54 // Records and associates a query_id with web form data. Called |
| 55 // when the renderer posts an Autofill query to the browser. |bounds| | 55 // when the renderer posts an Autofill query to the browser. |bounds| |
| 56 // is window relative. |display_warning_if_disabled| tells us if we should | 56 // is window relative. |display_warning_if_disabled| tells us if we should |
| 57 // display warnings (such as autofill is disabled, but had suggestions). | 57 // display warnings (such as autofill is disabled, but had suggestions). |
| 58 // We might not want to display the warning if a website has disabled | 58 // We might not want to display the warning if a website has disabled |
| 59 // Autocomplete because they have their own popup, and showing our popup | 59 // Autocomplete because they have their own popup, and showing our popup |
| 60 // on to of theirs would be a poor user experience. | 60 // on to of theirs would be a poor user experience. |
| 61 virtual void OnQuery(int query_id, | 61 virtual void OnQuery(int query_id, |
| 62 const FormData& form, | 62 const FormData& form, |
| 63 const FormFieldData& field, | 63 const FormFieldData& field, |
| 64 const PasswordForm& password_form, |
| 64 const gfx::RectF& element_bounds, | 65 const gfx::RectF& element_bounds, |
| 65 bool display_warning_if_disabled); | 66 bool display_warning_if_disabled); |
| 66 | 67 |
| 67 // Records query results and correctly formats them before sending them off | 68 // Records query results and correctly formats them before sending them off |
| 68 // to be displayed. Called when an Autofill query result is available. | 69 // to be displayed. Called when an Autofill query result is available. |
| 69 virtual void OnSuggestionsReturned( | 70 virtual void OnSuggestionsReturned( |
| 70 int query_id, | 71 int query_id, |
| 71 const std::vector<base::string16>& autofill_values, | 72 const std::vector<base::string16>& autofill_values, |
| 72 const std::vector<base::string16>& autofill_labels, | 73 const std::vector<base::string16>& autofill_labels, |
| 73 const std::vector<base::string16>& autofill_icons, | 74 const std::vector<base::string16>& autofill_icons, |
| 74 const std::vector<int>& autofill_unique_ids); | 75 const std::vector<int>& autofill_unique_ids); |
| 75 | 76 |
| 76 // Show password suggestions in the popup. | 77 // Show password suggestions in the popup. |
| 77 void OnShowPasswordSuggestions(const std::vector<base::string16>& suggestions, | 78 void OnShowPasswordSuggestions(const std::vector<base::string16>& suggestions, |
| 78 const std::vector<base::string16>& realms, | 79 const std::vector<base::string16>& realms, |
| 79 const FormFieldData& field, | 80 const FormFieldData& field, |
| 81 const PasswordForm& password_form, |
| 80 const gfx::RectF& bounds); | 82 const gfx::RectF& bounds); |
| 81 | 83 |
| 82 // Set the data list value associated with the current field. | 84 // Set the data list value associated with the current field. |
| 83 void SetCurrentDataListValues( | 85 void SetCurrentDataListValues( |
| 84 const std::vector<base::string16>& data_list_values, | 86 const std::vector<base::string16>& data_list_values, |
| 85 const std::vector<base::string16>& data_list_labels); | 87 const std::vector<base::string16>& data_list_labels); |
| 86 | 88 |
| 87 // Inform the delegate that the text field editing has ended. This is | 89 // Inform the delegate that the text field editing has ended. This is |
| 88 // used to help record the metrics of when a new popup is shown. | 90 // used to help record the metrics of when a new popup is shown. |
| 89 void DidEndTextFieldEditing(); | 91 void DidEndTextFieldEditing(); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 // Password Autofill manager, handles all password-related Autofilling. | 139 // Password Autofill manager, handles all password-related Autofilling. |
| 138 PasswordAutofillManager password_autofill_manager_; | 140 PasswordAutofillManager password_autofill_manager_; |
| 139 | 141 |
| 140 // The ID of the last request sent for form field Autofill. Used to ignore | 142 // The ID of the last request sent for form field Autofill. Used to ignore |
| 141 // out of date responses. | 143 // out of date responses. |
| 142 int autofill_query_id_; | 144 int autofill_query_id_; |
| 143 | 145 |
| 144 // The current form and field selected by Autofill. | 146 // The current form and field selected by Autofill. |
| 145 FormData autofill_query_form_; | 147 FormData autofill_query_form_; |
| 146 FormFieldData autofill_query_field_; | 148 FormFieldData autofill_query_field_; |
| 149 // The current password selected by Autofill. |
| 150 PasswordForm autofill_query_password_form_; |
| 147 | 151 |
| 148 // The bounds of the form field that user is interacting with. | 152 // The bounds of the form field that user is interacting with. |
| 149 gfx::RectF element_bounds_; | 153 gfx::RectF element_bounds_; |
| 150 | 154 |
| 151 // Should we display a warning if Autofill is disabled? | 155 // Should we display a warning if Autofill is disabled? |
| 152 bool display_warning_if_disabled_; | 156 bool display_warning_if_disabled_; |
| 153 | 157 |
| 154 // Does the popup include any Autofill profile or credit card suggestions? | 158 // Does the popup include any Autofill profile or credit card suggestions? |
| 155 bool has_autofill_suggestion_; | 159 bool has_autofill_suggestion_; |
| 156 | 160 |
| 157 // Have we already shown Autofill suggestions for the field the user is | 161 // Have we already shown Autofill suggestions for the field the user is |
| 158 // currently editing? Used to keep track of state for metrics logging. | 162 // currently editing? Used to keep track of state for metrics logging. |
| 159 bool has_shown_autofill_popup_for_current_edit_; | 163 bool has_shown_autofill_popup_for_current_edit_; |
| 160 | 164 |
| 161 // The current data list values. | 165 // The current data list values. |
| 162 std::vector<base::string16> data_list_values_; | 166 std::vector<base::string16> data_list_values_; |
| 163 std::vector<base::string16> data_list_labels_; | 167 std::vector<base::string16> data_list_labels_; |
| 164 | 168 |
| 165 base::WeakPtrFactory<AutofillExternalDelegate> weak_ptr_factory_; | 169 base::WeakPtrFactory<AutofillExternalDelegate> weak_ptr_factory_; |
| 166 | 170 |
| 167 DISALLOW_COPY_AND_ASSIGN(AutofillExternalDelegate); | 171 DISALLOW_COPY_AND_ASSIGN(AutofillExternalDelegate); |
| 168 }; | 172 }; |
| 169 | 173 |
| 170 } // namespace autofill | 174 } // namespace autofill |
| 171 | 175 |
| 172 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_EXTERNAL_DELEGATE_H_ | 176 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_EXTERNAL_DELEGATE_H_ |
| OLD | NEW |