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

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

Issue 8353025: External autofill delegates. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: feedback Created 9 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/time.h" 9 #include "base/time.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 65
66 AutofillAgent::~AutofillAgent() {} 66 AutofillAgent::~AutofillAgent() {}
67 67
68 bool AutofillAgent::OnMessageReceived(const IPC::Message& message) { 68 bool AutofillAgent::OnMessageReceived(const IPC::Message& message) {
69 bool handled = true; 69 bool handled = true;
70 IPC_BEGIN_MESSAGE_MAP(AutofillAgent, message) 70 IPC_BEGIN_MESSAGE_MAP(AutofillAgent, message)
71 IPC_MESSAGE_HANDLER(AutofillMsg_SuggestionsReturned, OnSuggestionsReturned) 71 IPC_MESSAGE_HANDLER(AutofillMsg_SuggestionsReturned, OnSuggestionsReturned)
72 IPC_MESSAGE_HANDLER(AutofillMsg_FormDataFilled, OnFormDataFilled) 72 IPC_MESSAGE_HANDLER(AutofillMsg_FormDataFilled, OnFormDataFilled)
73 IPC_MESSAGE_HANDLER(AutofillMsg_FieldTypePredictionsAvailable, 73 IPC_MESSAGE_HANDLER(AutofillMsg_FieldTypePredictionsAvailable,
74 OnFieldTypePredictionsAvailable) 74 OnFieldTypePredictionsAvailable)
75 IPC_MESSAGE_HANDLER(AutofillMsg_SelectAutofillSuggestionAtIndex,
76 OnSelectAutofillSuggestionAtIndex)
75 IPC_MESSAGE_UNHANDLED(handled = false) 77 IPC_MESSAGE_UNHANDLED(handled = false)
76 IPC_END_MESSAGE_MAP() 78 IPC_END_MESSAGE_MAP()
77 return handled; 79 return handled;
78 } 80 }
79 81
80 void AutofillAgent::DidFinishDocumentLoad(WebFrame* frame) { 82 void AutofillAgent::DidFinishDocumentLoad(WebFrame* frame) {
81 // The document has now been fully loaded. Scan for forms to be sent up to 83 // The document has now been fully loaded. Scan for forms to be sent up to
82 // the browser. 84 // the browser.
83 std::vector<webkit_glue::FormData> forms; 85 std::vector<webkit_glue::FormData> forms;
84 form_cache_.ExtractForms(*frame, &forms); 86 form_cache_.ExtractForms(*frame, &forms);
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 autofill_action_ = AUTOFILL_NONE; 350 autofill_action_ = AUTOFILL_NONE;
349 } 351 }
350 352
351 void AutofillAgent::OnFieldTypePredictionsAvailable( 353 void AutofillAgent::OnFieldTypePredictionsAvailable(
352 const std::vector<FormDataPredictions>& forms) { 354 const std::vector<FormDataPredictions>& forms) {
353 for (size_t i = 0; i < forms.size(); ++i) { 355 for (size_t i = 0; i < forms.size(); ++i) {
354 form_cache_.ShowPredictions(forms[i]); 356 form_cache_.ShowPredictions(forms[i]);
355 } 357 }
356 } 358 }
357 359
360 void AutofillAgent::OnSelectAutofillSuggestionAtIndex(int listIndex) {
361 NOTIMPLEMENTED();
362 // TODO(jrg): enable once changes land in WebKit
363 // render_view()->webview()->selectAutofillSuggestionAtIndex(listIndex);
364 }
365
358 void AutofillAgent::ShowSuggestions(const WebInputElement& element, 366 void AutofillAgent::ShowSuggestions(const WebInputElement& element,
359 bool autofill_on_empty_values, 367 bool autofill_on_empty_values,
360 bool requires_caret_at_end, 368 bool requires_caret_at_end,
361 bool display_warning_if_disabled) { 369 bool display_warning_if_disabled) {
362 // If autocomplete is disabled at the form level, then we might want to show 370 // If autocomplete is disabled at the form level, then we might want to show
363 // a warning in place of suggestions. However, if autocomplete is disabled 371 // a warning in place of suggestions. However, if autocomplete is disabled
364 // specifically for this field, we never want to show a warning. Otherwise, 372 // specifically for this field, we never want to show a warning. Otherwise,
365 // we might interfere with custom popups (e.g. search suggestions) used by 373 // we might interfere with custom popups (e.g. search suggestions) used by
366 // the website. 374 // the website.
367 const WebFormElement form = element.form(); 375 const WebFormElement form = element.form();
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 return; 432 return;
425 } 433 }
426 434
427 autofill_action_ = action; 435 autofill_action_ = action;
428 was_query_node_autofilled_ = field.is_autofilled; 436 was_query_node_autofilled_ = field.is_autofilled;
429 Send(new AutofillHostMsg_FillAutofillFormData( 437 Send(new AutofillHostMsg_FillAutofillFormData(
430 routing_id(), autofill_query_id_, form, field, unique_id)); 438 routing_id(), autofill_query_id_, form, field, unique_id));
431 } 439 }
432 440
433 } // namespace autofill 441 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698