Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: chrome/renderer/autofill/autofill_agent.h

Issue 11270018: [autofill] Adding new API to request an interactive autocomplete UI flow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 80 col Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "chrome/renderer/autofill/form_cache.h" 14 #include "chrome/renderer/autofill/form_cache.h"
15 #include "chrome/renderer/page_click_listener.h" 15 #include "chrome/renderer/page_click_listener.h"
16 #include "content/public/renderer/render_view_observer.h" 16 #include "content/public/renderer/render_view_observer.h"
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAutofillClient.h" 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAutofillClient.h"
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormElement.h"
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h"
19 20
20 struct FormFieldData; 21 struct FormFieldData;
21 22
22 namespace WebKit { 23 namespace WebKit {
23 class WebNode; 24 class WebNode;
24 } 25 }
25 26
26 namespace autofill { 27 namespace autofill {
27 28
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 virtual void removeAutocompleteSuggestion( 82 virtual void removeAutocompleteSuggestion(
82 const WebKit::WebString& name, 83 const WebKit::WebString& name,
83 const WebKit::WebString& value) OVERRIDE; 84 const WebKit::WebString& value) OVERRIDE;
84 virtual void textFieldDidEndEditing( 85 virtual void textFieldDidEndEditing(
85 const WebKit::WebInputElement& element) OVERRIDE; 86 const WebKit::WebInputElement& element) OVERRIDE;
86 virtual void textFieldDidChange( 87 virtual void textFieldDidChange(
87 const WebKit::WebInputElement& element) OVERRIDE; 88 const WebKit::WebInputElement& element) OVERRIDE;
88 virtual void textFieldDidReceiveKeyDown( 89 virtual void textFieldDidReceiveKeyDown(
89 const WebKit::WebInputElement& element, 90 const WebKit::WebInputElement& element,
90 const WebKit::WebKeyboardEvent& event) OVERRIDE; 91 const WebKit::WebKeyboardEvent& event) OVERRIDE;
92 virtual void didRequestAutocomplete(
93 WebKit::WebFrame* frame,
94 const WebKit::WebFormElement& form) OVERRIDE;
91 95
92 void OnSuggestionsReturned(int query_id, 96 void OnSuggestionsReturned(int query_id,
93 const std::vector<string16>& values, 97 const std::vector<string16>& values,
94 const std::vector<string16>& labels, 98 const std::vector<string16>& labels,
95 const std::vector<string16>& icons, 99 const std::vector<string16>& icons,
96 const std::vector<int>& unique_ids); 100 const std::vector<int>& unique_ids);
97 void OnFormDataFilled(int query_id, const FormData& form); 101 void OnFormDataFilled(int query_id, const FormData& form);
98 void OnFieldTypePredictionsAvailable( 102 void OnFieldTypePredictionsAvailable(
99 const std::vector<FormDataPredictions>& forms); 103 const std::vector<FormDataPredictions>& forms);
100 104
101 // For external Autofill selection. 105 // For external Autofill selection.
102 void OnSetAutofillActionFill(); 106 void OnSetAutofillActionFill();
103 void OnClearForm(); 107 void OnClearForm();
104 void OnSetAutofillActionPreview(); 108 void OnSetAutofillActionPreview();
105 void OnClearPreviewedForm(); 109 void OnClearPreviewedForm();
106 void OnSetNodeText(const string16& value); 110 void OnSetNodeText(const string16& value);
107 void OnAcceptDataListSuggestion(const string16& value); 111 void OnAcceptDataListSuggestion(const string16& value);
108 void OnAcceptPasswordAutofillSuggestion(const string16& value); 112 void OnAcceptPasswordAutofillSuggestion(const string16& value);
109 113
114 // For interactive autocomplete.
115 void OnRequestAutocompleteFinished(
116 WebKit::WebFormElement::AutocompleteResult result);
117
110 // Called in a posted task by textFieldDidChange() to work-around a WebKit bug 118 // Called in a posted task by textFieldDidChange() to work-around a WebKit bug
111 // http://bugs.webkit.org/show_bug.cgi?id=16976 119 // http://bugs.webkit.org/show_bug.cgi?id=16976
112 void TextFieldDidChangeImpl(const WebKit::WebInputElement& element); 120 void TextFieldDidChangeImpl(const WebKit::WebInputElement& element);
113 121
114 // Shows the autofill suggestions for |element|. 122 // Shows the autofill suggestions for |element|.
115 // This call is asynchronous and may or may not lead to the showing of a 123 // This call is asynchronous and may or may not lead to the showing of a
116 // suggestion popup (no popup is shown if there are no available suggestions). 124 // suggestion popup (no popup is shown if there are no available suggestions).
117 // |autofill_on_empty_values| specifies whether suggestions should be shown 125 // |autofill_on_empty_values| specifies whether suggestions should be shown
118 // when |element| contains no text. 126 // when |element| contains no text.
119 // |requires_caret_at_end| specifies whether suggestions should be shown when 127 // |requires_caret_at_end| specifies whether suggestions should be shown when
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 // Fills |form| and |field| with the FormData and FormField corresponding to 163 // Fills |form| and |field| with the FormData and FormField corresponding to
156 // |node|. Returns true if the data was found; and false otherwise. 164 // |node|. Returns true if the data was found; and false otherwise.
157 bool FindFormAndFieldForNode( 165 bool FindFormAndFieldForNode(
158 const WebKit::WebNode& node, 166 const WebKit::WebNode& node,
159 FormData* form, 167 FormData* form,
160 FormFieldData* field) WARN_UNUSED_RESULT; 168 FormFieldData* field) WARN_UNUSED_RESULT;
161 169
162 // Set |node| to display the given |value|. 170 // Set |node| to display the given |value|.
163 void SetNodeText(const string16& value, WebKit::WebInputElement* node); 171 void SetNodeText(const string16& value, WebKit::WebInputElement* node);
164 172
173 // Hides any currently showing Autofill popups.
174 void HidePopups();
175
165 FormCache form_cache_; 176 FormCache form_cache_;
166 177
167 PasswordAutofillManager* password_autofill_manager_; // WEAK reference. 178 PasswordAutofillManager* password_autofill_manager_; // WEAK reference.
168 179
169 // The ID of the last request sent for form field Autofill. Used to ignore 180 // The ID of the last request sent for form field Autofill. Used to ignore
170 // out of date responses. 181 // out of date responses.
171 int autofill_query_id_; 182 int autofill_query_id_;
172 183
173 // The element corresponding to the last request sent for form field Autofill. 184 // The element corresponding to the last request sent for form field Autofill.
174 WebKit::WebInputElement element_; 185 WebKit::WebInputElement element_;
175 186
187 // The element corresponding to the last request sent for an interactive
188 // autocomplete.
189 WebKit::WebFormElement form_;
190
176 // The action to take when receiving Autofill data from the AutofillManager. 191 // The action to take when receiving Autofill data from the AutofillManager.
177 AutofillAction autofill_action_; 192 AutofillAction autofill_action_;
178 193
179 // Should we display a warning if autofill is disabled? 194 // Should we display a warning if autofill is disabled?
180 bool display_warning_if_disabled_; 195 bool display_warning_if_disabled_;
181 196
182 // Was the query node autofilled prior to previewing the form? 197 // Was the query node autofilled prior to previewing the form?
183 bool was_query_node_autofilled_; 198 bool was_query_node_autofilled_;
184 199
185 // Have we already shown Autofill suggestions for the field the user is 200 // Have we already shown Autofill suggestions for the field the user is
(...skipping 11 matching lines...) Expand all
197 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillManagerTest, WaitUsername); 212 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillManagerTest, WaitUsername);
198 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillManagerTest, SuggestionAccept); 213 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillManagerTest, SuggestionAccept);
199 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillManagerTest, SuggestionSelect); 214 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillManagerTest, SuggestionSelect);
200 215
201 DISALLOW_COPY_AND_ASSIGN(AutofillAgent); 216 DISALLOW_COPY_AND_ASSIGN(AutofillAgent);
202 }; 217 };
203 218
204 } // namespace autofill 219 } // namespace autofill
205 220
206 #endif // CHROME_RENDERER_AUTOFILL_AUTOFILL_AGENT_H_ 221 #endif // CHROME_RENDERER_AUTOFILL_AUTOFILL_AGENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698