| 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_CONTENT_RENDERER_AUTOFILL_AGENT_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CONTENT_RENDERER_AUTOFILL_AGENT_H_ |
| 6 #define COMPONENTS_AUTOFILL_CONTENT_RENDERER_AUTOFILL_AGENT_H_ | 6 #define COMPONENTS_AUTOFILL_CONTENT_RENDERER_AUTOFILL_AGENT_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 ShowSuggestionsOptions(); | 85 ShowSuggestionsOptions(); |
| 86 | 86 |
| 87 // Specifies that suggestions should be shown when |element| contains no | 87 // Specifies that suggestions should be shown when |element| contains no |
| 88 // text. | 88 // text. |
| 89 bool autofill_on_empty_values; | 89 bool autofill_on_empty_values; |
| 90 | 90 |
| 91 // Specifies that suggestions should be shown when the caret is not | 91 // Specifies that suggestions should be shown when the caret is not |
| 92 // after the last character in the element. | 92 // after the last character in the element. |
| 93 bool requires_caret_at_end; | 93 bool requires_caret_at_end; |
| 94 | 94 |
| 95 // Specifies that a warning should be displayed to the user if Autofill has | |
| 96 // suggestions available, but cannot fill them because it is disabled (e.g. | |
| 97 // when trying to fill a credit card form on a non-secure website). | |
| 98 bool display_warning_if_disabled; | |
| 99 | |
| 100 // Specifies that all of <datalist> suggestions and no autofill suggestions | 95 // Specifies that all of <datalist> suggestions and no autofill suggestions |
| 101 // are shown. |autofill_on_empty_values| and |requires_caret_at_end| are | 96 // are shown. |autofill_on_empty_values| and |requires_caret_at_end| are |
| 102 // ignored if |datalist_only| is true. | 97 // ignored if |datalist_only| is true. |
| 103 bool datalist_only; | 98 bool datalist_only; |
| 104 | 99 |
| 105 // Specifies that all autofill suggestions should be shown and none should | 100 // Specifies that all autofill suggestions should be shown and none should |
| 106 // be elided because of the current value of |element| (relevant for inline | 101 // be elided because of the current value of |element| (relevant for inline |
| 107 // autocomplete). | 102 // autocomplete). |
| 108 bool show_full_suggestion_list; | 103 bool show_full_suggestion_list; |
| 109 | 104 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 | 178 |
| 184 // Shows the autofill suggestions for |element|. This call is asynchronous | 179 // Shows the autofill suggestions for |element|. This call is asynchronous |
| 185 // and may or may not lead to the showing of a suggestion popup (no popup is | 180 // and may or may not lead to the showing of a suggestion popup (no popup is |
| 186 // shown if there are no available suggestions). | 181 // shown if there are no available suggestions). |
| 187 void ShowSuggestions(const blink::WebFormControlElement& element, | 182 void ShowSuggestions(const blink::WebFormControlElement& element, |
| 188 const ShowSuggestionsOptions& options); | 183 const ShowSuggestionsOptions& options); |
| 189 | 184 |
| 190 // Queries the browser for Autocomplete and Autofill suggestions for the given | 185 // Queries the browser for Autocomplete and Autofill suggestions for the given |
| 191 // |element|. | 186 // |element|. |
| 192 void QueryAutofillSuggestions(const blink::WebFormControlElement& element, | 187 void QueryAutofillSuggestions(const blink::WebFormControlElement& element, |
| 193 bool display_warning_if_disabled, | |
| 194 bool datalist_only); | 188 bool datalist_only); |
| 195 | 189 |
| 196 // Sets the element value to reflect the selected |suggested_value|. | 190 // Sets the element value to reflect the selected |suggested_value|. |
| 197 void AcceptDataListSuggestion(const base::string16& suggested_value); | 191 void AcceptDataListSuggestion(const base::string16& suggested_value); |
| 198 | 192 |
| 199 // Fills |form| and |field| with the FormData and FormField corresponding to | 193 // Fills |form| and |field| with the FormData and FormField corresponding to |
| 200 // |node|. Returns true if the data was found; and false otherwise. | 194 // |node|. Returns true if the data was found; and false otherwise. |
| 201 bool FindFormAndFieldForNode( | 195 bool FindFormAndFieldForNode( |
| 202 const blink::WebNode& node, | 196 const blink::WebNode& node, |
| 203 FormData* form, | 197 FormData* form, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 // The ID of the last request sent for form field Autofill. Used to ignore | 238 // The ID of the last request sent for form field Autofill. Used to ignore |
| 245 // out of date responses. | 239 // out of date responses. |
| 246 int autofill_query_id_; | 240 int autofill_query_id_; |
| 247 | 241 |
| 248 // The element corresponding to the last request sent for form field Autofill. | 242 // The element corresponding to the last request sent for form field Autofill. |
| 249 blink::WebFormControlElement element_; | 243 blink::WebFormControlElement element_; |
| 250 | 244 |
| 251 // The form element currently requesting an interactive autocomplete. | 245 // The form element currently requesting an interactive autocomplete. |
| 252 blink::WebFormElement in_flight_request_form_; | 246 blink::WebFormElement in_flight_request_form_; |
| 253 | 247 |
| 254 // Should we display a warning if autofill is disabled? | |
| 255 bool display_warning_if_disabled_; | |
| 256 | |
| 257 // Was the query node autofilled prior to previewing the form? | 248 // Was the query node autofilled prior to previewing the form? |
| 258 bool was_query_node_autofilled_; | 249 bool was_query_node_autofilled_; |
| 259 | 250 |
| 260 // Have we already shown Autofill suggestions for the field the user is | 251 // Have we already shown Autofill suggestions for the field the user is |
| 261 // currently editing? Used to keep track of state for metrics logging. | 252 // currently editing? Used to keep track of state for metrics logging. |
| 262 bool has_shown_autofill_popup_for_current_edit_; | 253 bool has_shown_autofill_popup_for_current_edit_; |
| 263 | 254 |
| 264 // If true we just set the node text so we shouldn't show the popup. | 255 // If true we just set the node text so we shouldn't show the popup. |
| 265 bool did_set_node_text_; | 256 bool did_set_node_text_; |
| 266 | 257 |
| 267 // Whether or not to ignore text changes. Useful for when we're committing | 258 // Whether or not to ignore text changes. Useful for when we're committing |
| 268 // a composition when we are defocusing the WebView and we don't want to | 259 // a composition when we are defocusing the WebView and we don't want to |
| 269 // trigger an autofill popup to show. | 260 // trigger an autofill popup to show. |
| 270 bool ignore_text_changes_; | 261 bool ignore_text_changes_; |
| 271 | 262 |
| 272 // Whether the Autofill popup is possibly visible. This is tracked as a | 263 // Whether the Autofill popup is possibly visible. This is tracked as a |
| 273 // performance improvement, so that the IPC channel isn't flooded with | 264 // performance improvement, so that the IPC channel isn't flooded with |
| 274 // messages to close the Autofill popup when it can't possibly be showing. | 265 // messages to close the Autofill popup when it can't possibly be showing. |
| 275 bool is_popup_possibly_visible_; | 266 bool is_popup_possibly_visible_; |
| 276 | 267 |
| 277 base::WeakPtrFactory<AutofillAgent> weak_ptr_factory_; | 268 base::WeakPtrFactory<AutofillAgent> weak_ptr_factory_; |
| 278 | 269 |
| 279 DISALLOW_COPY_AND_ASSIGN(AutofillAgent); | 270 DISALLOW_COPY_AND_ASSIGN(AutofillAgent); |
| 280 }; | 271 }; |
| 281 | 272 |
| 282 } // namespace autofill | 273 } // namespace autofill |
| 283 | 274 |
| 284 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_AUTOFILL_AGENT_H_ | 275 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_AUTOFILL_AGENT_H_ |
| OLD | NEW |