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

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

Issue 9600038: Add Password Autofill Manager to New Autofill (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Adding password popup Created 8 years, 9 months 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
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/time.h" 9 #include "base/time.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 IPC_MESSAGE_HANDLER(AutofillMsg_SetAutofillActionFill, 79 IPC_MESSAGE_HANDLER(AutofillMsg_SetAutofillActionFill,
80 OnSetAutofillActionFill) 80 OnSetAutofillActionFill)
81 IPC_MESSAGE_HANDLER(AutofillMsg_ClearForm, 81 IPC_MESSAGE_HANDLER(AutofillMsg_ClearForm,
82 OnClearForm) 82 OnClearForm)
83 IPC_MESSAGE_HANDLER(AutofillMsg_SetAutofillActionPreview, 83 IPC_MESSAGE_HANDLER(AutofillMsg_SetAutofillActionPreview,
84 OnSetAutofillActionPreview) 84 OnSetAutofillActionPreview)
85 IPC_MESSAGE_HANDLER(AutofillMsg_ClearPreviewedForm, 85 IPC_MESSAGE_HANDLER(AutofillMsg_ClearPreviewedForm,
86 OnClearPreviewedForm) 86 OnClearPreviewedForm)
87 IPC_MESSAGE_HANDLER(AutofillMsg_SetNodeText, 87 IPC_MESSAGE_HANDLER(AutofillMsg_SetNodeText,
88 OnSetNodeText) 88 OnSetNodeText)
89 IPC_MESSAGE_HANDLER(AutofillMsg_AcceptPasswordAutofillSuggestion,
90 OnAcceptPasswordAutofillSuggestion)
89 IPC_MESSAGE_UNHANDLED(handled = false) 91 IPC_MESSAGE_UNHANDLED(handled = false)
90 IPC_END_MESSAGE_MAP() 92 IPC_END_MESSAGE_MAP()
91 return handled; 93 return handled;
92 } 94 }
93 95
94 void AutofillAgent::DidFinishDocumentLoad(WebFrame* frame) { 96 void AutofillAgent::DidFinishDocumentLoad(WebFrame* frame) {
95 // The document has now been fully loaded. Scan for forms to be sent up to 97 // The document has now been fully loaded. Scan for forms to be sent up to
96 // the browser. 98 // the browser.
97 std::vector<webkit::forms::FormData> forms; 99 std::vector<webkit::forms::FormData> forms;
98 form_cache_.ExtractForms(*frame, &forms); 100 form_cache_.ExtractForms(*frame, &forms);
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 } 393 }
392 394
393 void AutofillAgent::OnClearPreviewedForm() { 395 void AutofillAgent::OnClearPreviewedForm() {
394 didClearAutofillSelection(autofill_query_element_); 396 didClearAutofillSelection(autofill_query_element_);
395 } 397 }
396 398
397 void AutofillAgent::OnSetNodeText(const string16& value) { 399 void AutofillAgent::OnSetNodeText(const string16& value) {
398 SetNodeText(value, &autofill_query_element_); 400 SetNodeText(value, &autofill_query_element_);
399 } 401 }
400 402
403 void AutofillAgent::OnAcceptPasswordAutofillSuggestion(const string16& value) {
404 // We need to make sure this is handled here because the browser process
405 // skipped it handling because it believed it would be handled here. If it
406 // isn't handled here then the browser logic needs to be updated.
407 bool handled = password_autofill_manager_->DidAcceptAutofillSuggestion(
408 autofill_query_element_,
409 value);
410 DCHECK(handled);
411 }
412
401 void AutofillAgent::ShowSuggestions(const WebInputElement& element, 413 void AutofillAgent::ShowSuggestions(const WebInputElement& element,
402 bool autofill_on_empty_values, 414 bool autofill_on_empty_values,
403 bool requires_caret_at_end, 415 bool requires_caret_at_end,
404 bool display_warning_if_disabled) { 416 bool display_warning_if_disabled) {
405 // If autocomplete is disabled at the form level, then we might want to show 417 // If autocomplete is disabled at the form level, then we might want to show
406 // a warning in place of suggestions. However, if autocomplete is disabled 418 // a warning in place of suggestions. However, if autocomplete is disabled
407 // specifically for this field, we never want to show a warning. Otherwise, 419 // specifically for this field, we never want to show a warning. Otherwise,
408 // we might interfere with custom popups (e.g. search suggestions) used by 420 // we might interfere with custom popups (e.g. search suggestions) used by
409 // the website. 421 // the website.
410 const WebFormElement form = element.form(); 422 const WebFormElement form = element.form();
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 495
484 void AutofillAgent::SetNodeText(const string16& value, 496 void AutofillAgent::SetNodeText(const string16& value,
485 WebKit::WebInputElement* node) { 497 WebKit::WebInputElement* node) {
486 string16 substring = value; 498 string16 substring = value;
487 substring = substring.substr(0, node->maxLength()); 499 substring = substring.substr(0, node->maxLength());
488 500
489 node->setValue(substring, true); 501 node->setValue(substring, true);
490 } 502 }
491 503
492 } // namespace autofill 504 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698