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_RENDERER_AUTOFILL_AUTOFILL_AGENT_H_ | 5 #ifndef CHROME_RENDERER_AUTOFILL_AUTOFILL_AGENT_H_ |
6 #define CHROME_RENDERER_AUTOFILL_AUTOFILL_AGENT_H_ | 6 #define CHROME_RENDERER_AUTOFILL_AUTOFILL_AGENT_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
81 virtual void removeAutocompleteSuggestion( | 81 virtual void removeAutocompleteSuggestion( |
82 const WebKit::WebString& name, | 82 const WebKit::WebString& name, |
83 const WebKit::WebString& value) OVERRIDE; | 83 const WebKit::WebString& value) OVERRIDE; |
84 virtual void textFieldDidEndEditing( | 84 virtual void textFieldDidEndEditing( |
85 const WebKit::WebInputElement& element) OVERRIDE; | 85 const WebKit::WebInputElement& element) OVERRIDE; |
86 virtual void textFieldDidChange( | 86 virtual void textFieldDidChange( |
87 const WebKit::WebInputElement& element) OVERRIDE; | 87 const WebKit::WebInputElement& element) OVERRIDE; |
88 virtual void textFieldDidReceiveKeyDown( | 88 virtual void textFieldDidReceiveKeyDown( |
89 const WebKit::WebInputElement& element, | 89 const WebKit::WebInputElement& element, |
90 const WebKit::WebKeyboardEvent& event) OVERRIDE; | 90 const WebKit::WebKeyboardEvent& event) OVERRIDE; |
91 virtual void didRequestAutocomplete( | |
92 WebKit::WebFrame* frame, | |
93 const WebKit::WebFormElement& form) OVERRIDE; | |
91 | 94 |
92 void OnSuggestionsReturned(int query_id, | 95 void OnSuggestionsReturned(int query_id, |
93 const std::vector<string16>& values, | 96 const std::vector<string16>& values, |
94 const std::vector<string16>& labels, | 97 const std::vector<string16>& labels, |
95 const std::vector<string16>& icons, | 98 const std::vector<string16>& icons, |
96 const std::vector<int>& unique_ids); | 99 const std::vector<int>& unique_ids); |
97 void OnFormDataFilled(int query_id, const FormData& form); | 100 void OnFormDataFilled(int query_id, const FormData& form); |
98 void OnFieldTypePredictionsAvailable( | 101 void OnFieldTypePredictionsAvailable( |
99 const std::vector<FormDataPredictions>& forms); | 102 const std::vector<FormDataPredictions>& forms); |
100 | 103 |
101 // For external Autofill selection. | 104 // For external Autofill selection. |
102 void OnSelectAutofillSuggestionAtIndex(int listIndex); | 105 void OnSelectAutofillSuggestionAtIndex(int listIndex); |
103 void OnSetAutofillActionFill(); | 106 void OnSetAutofillActionFill(); |
104 void OnClearForm(); | 107 void OnClearForm(); |
105 void OnSetAutofillActionPreview(); | 108 void OnSetAutofillActionPreview(); |
106 void OnClearPreviewedForm(); | 109 void OnClearPreviewedForm(); |
107 void OnSetNodeText(const string16& value); | 110 void OnSetNodeText(const string16& value); |
108 void OnAcceptDataListSuggestion(const string16& value); | 111 void OnAcceptDataListSuggestion(const string16& value); |
109 void OnAcceptPasswordAutofillSuggestion(const string16& value); | 112 void OnAcceptPasswordAutofillSuggestion(const string16& value); |
110 | 113 |
114 // For interactive autocomplete. | |
115 void OnRequestAutocompleteFinished(int query_id, int result); | |
116 | |
111 // Called in a posted task by textFieldDidChange() to work-around a WebKit bug | 117 // Called in a posted task by textFieldDidChange() to work-around a WebKit bug |
112 // http://bugs.webkit.org/show_bug.cgi?id=16976 | 118 // http://bugs.webkit.org/show_bug.cgi?id=16976 |
113 void TextFieldDidChangeImpl(const WebKit::WebInputElement& element); | 119 void TextFieldDidChangeImpl(const WebKit::WebInputElement& element); |
114 | 120 |
115 // Shows the autofill suggestions for |element|. | 121 // Shows the autofill suggestions for |element|. |
116 // This call is asynchronous and may or may not lead to the showing of a | 122 // This call is asynchronous and may or may not lead to the showing of a |
117 // suggestion popup (no popup is shown if there are no available suggestions). | 123 // suggestion popup (no popup is shown if there are no available suggestions). |
118 // |autofill_on_empty_values| specifies whether suggestions should be shown | 124 // |autofill_on_empty_values| specifies whether suggestions should be shown |
119 // when |element| contains no text. | 125 // when |element| contains no text. |
120 // |requires_caret_at_end| specifies whether suggestions should be shown when | 126 // |requires_caret_at_end| specifies whether suggestions should be shown when |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
156 // Fills |form| and |field| with the FormData and FormField corresponding to | 162 // Fills |form| and |field| with the FormData and FormField corresponding to |
157 // |node|. Returns true if the data was found; and false otherwise. | 163 // |node|. Returns true if the data was found; and false otherwise. |
158 bool FindFormAndFieldForNode( | 164 bool FindFormAndFieldForNode( |
159 const WebKit::WebNode& node, | 165 const WebKit::WebNode& node, |
160 FormData* form, | 166 FormData* form, |
161 FormFieldData* field) WARN_UNUSED_RESULT; | 167 FormFieldData* field) WARN_UNUSED_RESULT; |
162 | 168 |
163 // Set |node| to display the given |value|. | 169 // Set |node| to display the given |value|. |
164 void SetNodeText(const string16& value, WebKit::WebInputElement* node); | 170 void SetNodeText(const string16& value, WebKit::WebInputElement* node); |
165 | 171 |
172 // Hides any currently showing autofill popups. | |
Ilya Sherman
2012/10/27 07:44:11
nit: "autofill" -> "Autofill"
Dan Beam
2012/10/29 19:17:05
Done.
| |
173 void HidePopups(); | |
174 | |
166 FormCache form_cache_; | 175 FormCache form_cache_; |
167 | 176 |
168 PasswordAutofillManager* password_autofill_manager_; // WEAK reference. | 177 PasswordAutofillManager* password_autofill_manager_; // WEAK reference. |
169 | 178 |
170 // The ID of the last request sent for form field Autofill. Used to ignore | 179 // The ID of the last request sent for form field Autofill. Used to ignore |
171 // out of date responses. | 180 // out of date responses. |
172 int autofill_query_id_; | 181 int autofill_query_id_; |
173 | 182 |
174 // The element corresponding to the last request sent for form field Autofill. | 183 // The element corresponding to the last request sent for form field Autofill. |
175 WebKit::WebInputElement element_; | 184 WebKit::WebInputElement element_; |
176 | 185 |
186 // The element corresponding to the last request sent for an interactive | |
187 // autocomplete. | |
188 WebKit::WebFormElement form_; | |
Ilya Sherman
2012/10/27 07:44:11
It doesn't seem like this will work if multiple ta
Evan Stade
2012/10/29 17:54:28
there's only one AutofillAgent per RenderView. Ren
Ilya Sherman
2012/10/29 17:59:23
Ok, that makes this much easier to reason about --
Dan Beam
2012/10/29 19:17:05
Currently, the webkit implementation will hit the
| |
189 | |
177 // The action to take when receiving Autofill data from the AutofillManager. | 190 // The action to take when receiving Autofill data from the AutofillManager. |
178 AutofillAction autofill_action_; | 191 AutofillAction autofill_action_; |
179 | 192 |
180 // Should we display a warning if autofill is disabled? | 193 // Should we display a warning if autofill is disabled? |
181 bool display_warning_if_disabled_; | 194 bool display_warning_if_disabled_; |
182 | 195 |
183 // Was the query node autofilled prior to previewing the form? | 196 // Was the query node autofilled prior to previewing the form? |
184 bool was_query_node_autofilled_; | 197 bool was_query_node_autofilled_; |
185 | 198 |
186 // Have we already shown Autofill suggestions for the field the user is | 199 // Have we already shown Autofill suggestions for the field the user is |
(...skipping 11 matching lines...) Expand all Loading... | |
198 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillManagerTest, WaitUsername); | 211 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillManagerTest, WaitUsername); |
199 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillManagerTest, SuggestionAccept); | 212 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillManagerTest, SuggestionAccept); |
200 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillManagerTest, SuggestionSelect); | 213 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillManagerTest, SuggestionSelect); |
201 | 214 |
202 DISALLOW_COPY_AND_ASSIGN(AutofillAgent); | 215 DISALLOW_COPY_AND_ASSIGN(AutofillAgent); |
203 }; | 216 }; |
204 | 217 |
205 } // namespace autofill | 218 } // namespace autofill |
206 | 219 |
207 #endif // CHROME_RENDERER_AUTOFILL_AUTOFILL_AGENT_H_ | 220 #endif // CHROME_RENDERER_AUTOFILL_AUTOFILL_AGENT_H_ |
OLD | NEW |