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" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
13 #include "components/autofill/core/browser/autofill_popup_delegate.h" | 13 #include "components/autofill/core/browser/autofill_popup_delegate.h" |
14 #include "components/autofill/core/browser/password_autofill_manager.h" | 14 #include "components/autofill/core/browser/password_autofill_manager.h" |
15 #include "components/autofill/core/common/form_data.h" | 15 #include "components/autofill/core/common/form_data.h" |
16 #include "components/autofill/core/common/form_field_data.h" | 16 #include "components/autofill/core/common/form_field_data.h" |
17 #include "components/autofill/core/common/password_form_fill_data.h" | 17 #include "components/autofill/core/common/password_form_fill_data.h" |
18 #include "ui/gfx/rect.h" | 18 #include "ui/gfx/rect.h" |
19 | 19 |
| 20 namespace blink { |
| 21 class WebFormElement; |
| 22 } |
| 23 |
20 namespace gfx { | 24 namespace gfx { |
21 class Rect; | 25 class Rect; |
22 } | 26 } |
23 | 27 |
24 namespace autofill { | 28 namespace autofill { |
25 | 29 |
26 class AutofillDriver; | 30 class AutofillDriver; |
27 class AutofillManager; | 31 class AutofillManager; |
28 | 32 |
29 // TODO(csharp): A lot of the logic in this class is copied from autofillagent. | 33 // TODO(csharp): A lot of the logic in this class is copied from autofillagent. |
(...skipping 24 matching lines...) Expand all Loading... |
54 // Records and associates a query_id with web form data. Called | 58 // Records and associates a query_id with web form data. Called |
55 // when the renderer posts an Autofill query to the browser. |bounds| | 59 // when the renderer posts an Autofill query to the browser. |bounds| |
56 // is window relative. |display_warning_if_disabled| tells us if we should | 60 // is window relative. |display_warning_if_disabled| tells us if we should |
57 // display warnings (such as autofill is disabled, but had suggestions). | 61 // display warnings (such as autofill is disabled, but had suggestions). |
58 // We might not want to display the warning if a website has disabled | 62 // 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 | 63 // Autocomplete because they have their own popup, and showing our popup |
60 // on to of theirs would be a poor user experience. | 64 // on to of theirs would be a poor user experience. |
61 virtual void OnQuery(int query_id, | 65 virtual void OnQuery(int query_id, |
62 const FormData& form, | 66 const FormData& form, |
63 const FormFieldData& field, | 67 const FormFieldData& field, |
| 68 const blink::WebFormElement& element, |
64 const gfx::RectF& element_bounds, | 69 const gfx::RectF& element_bounds, |
65 bool display_warning_if_disabled); | 70 bool display_warning_if_disabled); |
66 | 71 |
67 // Records query results and correctly formats them before sending them off | 72 // Records query results and correctly formats them before sending them off |
68 // to be displayed. Called when an Autofill query result is available. | 73 // to be displayed. Called when an Autofill query result is available. |
69 virtual void OnSuggestionsReturned( | 74 virtual void OnSuggestionsReturned( |
70 int query_id, | 75 int query_id, |
71 const std::vector<base::string16>& autofill_values, | 76 const std::vector<base::string16>& autofill_values, |
72 const std::vector<base::string16>& autofill_labels, | 77 const std::vector<base::string16>& autofill_labels, |
73 const std::vector<base::string16>& autofill_icons, | 78 const std::vector<base::string16>& autofill_icons, |
74 const std::vector<int>& autofill_unique_ids); | 79 const std::vector<int>& autofill_unique_ids); |
75 | 80 |
76 // Show password suggestions in the popup. | 81 // Show password suggestions in the popup. |
77 void OnShowPasswordSuggestions(const std::vector<base::string16>& suggestions, | 82 void OnShowPasswordSuggestions(const std::vector<base::string16>& suggestions, |
78 const std::vector<base::string16>& realms, | 83 const std::vector<base::string16>& realms, |
79 const FormFieldData& field, | 84 const FormFieldData& field, |
| 85 const blink::WebFormElement& element, |
80 const gfx::RectF& bounds); | 86 const gfx::RectF& bounds); |
81 | 87 |
82 // Set the data list value associated with the current field. | 88 // Set the data list value associated with the current field. |
83 void SetCurrentDataListValues( | 89 void SetCurrentDataListValues( |
84 const std::vector<base::string16>& data_list_values, | 90 const std::vector<base::string16>& data_list_values, |
85 const std::vector<base::string16>& data_list_labels); | 91 const std::vector<base::string16>& data_list_labels); |
86 | 92 |
87 // Inform the delegate that the text field editing has ended. This is | 93 // 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. | 94 // used to help record the metrics of when a new popup is shown. |
89 void DidEndTextFieldEditing(); | 95 void DidEndTextFieldEditing(); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 // Password Autofill manager, handles all password-related Autofilling. | 143 // Password Autofill manager, handles all password-related Autofilling. |
138 PasswordAutofillManager password_autofill_manager_; | 144 PasswordAutofillManager password_autofill_manager_; |
139 | 145 |
140 // The ID of the last request sent for form field Autofill. Used to ignore | 146 // The ID of the last request sent for form field Autofill. Used to ignore |
141 // out of date responses. | 147 // out of date responses. |
142 int autofill_query_id_; | 148 int autofill_query_id_; |
143 | 149 |
144 // The current form and field selected by Autofill. | 150 // The current form and field selected by Autofill. |
145 FormData autofill_query_form_; | 151 FormData autofill_query_form_; |
146 FormFieldData autofill_query_field_; | 152 FormFieldData autofill_query_field_; |
| 153 blink::WebFormElement web_form_element_; |
147 | 154 |
148 // The bounds of the form field that user is interacting with. | 155 // The bounds of the form field that user is interacting with. |
149 gfx::RectF element_bounds_; | 156 gfx::RectF element_bounds_; |
150 | 157 |
151 // Should we display a warning if Autofill is disabled? | 158 // Should we display a warning if Autofill is disabled? |
152 bool display_warning_if_disabled_; | 159 bool display_warning_if_disabled_; |
153 | 160 |
154 // Does the popup include any Autofill profile or credit card suggestions? | 161 // Does the popup include any Autofill profile or credit card suggestions? |
155 bool has_autofill_suggestion_; | 162 bool has_autofill_suggestion_; |
156 | 163 |
157 // Have we already shown Autofill suggestions for the field the user is | 164 // Have we already shown Autofill suggestions for the field the user is |
158 // currently editing? Used to keep track of state for metrics logging. | 165 // currently editing? Used to keep track of state for metrics logging. |
159 bool has_shown_autofill_popup_for_current_edit_; | 166 bool has_shown_autofill_popup_for_current_edit_; |
160 | 167 |
161 // The current data list values. | 168 // The current data list values. |
162 std::vector<base::string16> data_list_values_; | 169 std::vector<base::string16> data_list_values_; |
163 std::vector<base::string16> data_list_labels_; | 170 std::vector<base::string16> data_list_labels_; |
164 | 171 |
165 base::WeakPtrFactory<AutofillExternalDelegate> weak_ptr_factory_; | 172 base::WeakPtrFactory<AutofillExternalDelegate> weak_ptr_factory_; |
166 | 173 |
167 DISALLOW_COPY_AND_ASSIGN(AutofillExternalDelegate); | 174 DISALLOW_COPY_AND_ASSIGN(AutofillExternalDelegate); |
168 }; | 175 }; |
169 | 176 |
170 } // namespace autofill | 177 } // namespace autofill |
171 | 178 |
172 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_EXTERNAL_DELEGATE_H_ | 179 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_EXTERNAL_DELEGATE_H_ |
OLD | NEW |