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

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

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: 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 #include "chrome/renderer/autofill/autofill_agent.h" 5 #include "chrome/renderer/autofill/autofill_agent.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/string_split.h" 10 #include "base/string_split.h"
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 Send(new AutofillHostMsg_HideAutofillPopup(routing_id())); 206 Send(new AutofillHostMsg_HideAutofillPopup(routing_id()));
207 } 207 }
208 208
209 void AutofillAgent::DidChangeScrollOffset(WebKit::WebFrame*) { 209 void AutofillAgent::DidChangeScrollOffset(WebKit::WebFrame*) {
210 // Any time the scroll offset changes, the page's content moves, so Autofill 210 // Any time the scroll offset changes, the page's content moves, so Autofill
211 // popups should be hidden. This is only needed for the new Autofill UI 211 // popups should be hidden. This is only needed for the new Autofill UI
212 // because WebKit already knows to hide the old UI when this occurs. 212 // because WebKit already knows to hide the old UI when this occurs.
213 Send(new AutofillHostMsg_HideAutofillPopup(routing_id())); 213 Send(new AutofillHostMsg_HideAutofillPopup(routing_id()));
214 } 214 }
215 215
216 void AutofillAgent::RequestAutocomplete(WebKit::WebFrame* frame,
217 const WebFormElement& form) {
218
219 // TODO(dbeam): should popups be hidden here? Maybe after a view message from
Evan Stade 2012/10/24 21:59:44 what popups?
Dan Beam 2012/10/26 03:06:05 any existing autocomplete suggestion popups
220 // the browser to say whether the interactive autocomplete UI will show?
221
222 FormData form_data;
223 if (WebFormElementToFormData(form,
224 WebFormControlElement(),
225 REQUIRE_AUTOCOMPLETE,
226 static_cast<ExtractMask>(
227 EXTRACT_VALUE | EXTRACT_OPTION_TEXT),
228 &form_data,
229 NULL)) {
230 Send(new AutofillHostMsg_RequestAutocomplete(routing_id(), form_data));
231 }
232 }
233
216 bool AutofillAgent::InputElementClicked(const WebInputElement& element, 234 bool AutofillAgent::InputElementClicked(const WebInputElement& element,
217 bool was_focused, 235 bool was_focused,
218 bool is_focused) { 236 bool is_focused) {
219 if (was_focused) 237 if (was_focused)
220 ShowSuggestions(element, true, false, true); 238 ShowSuggestions(element, true, false, true);
221 239
222 return false; 240 return false;
223 } 241 }
224 242
225 bool AutofillAgent::InputElementLostFocus() { 243 bool AutofillAgent::InputElementLostFocus() {
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 void AutofillAgent::SetNodeText(const string16& value, 714 void AutofillAgent::SetNodeText(const string16& value,
697 WebKit::WebInputElement* node) { 715 WebKit::WebInputElement* node) {
698 did_set_node_text_ = true; 716 did_set_node_text_ = true;
699 string16 substring = value; 717 string16 substring = value;
700 substring = substring.substr(0, node->maxLength()); 718 substring = substring.substr(0, node->maxLength());
701 719
702 node->setEditingValue(substring); 720 node->setEditingValue(substring);
703 } 721 }
704 722
705 } // namespace autofill 723 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698