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

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: 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_PasswordHandleKeyDown,
90 OnPasswordHandleKeyDown)
91 IPC_MESSAGE_HANDLER(AutofillMsg_PasswordAcceptAutofillSuggestion,
92 OnPasswordAcceptAutofillSuggestion)
89 IPC_MESSAGE_UNHANDLED(handled = false) 93 IPC_MESSAGE_UNHANDLED(handled = false)
90 IPC_END_MESSAGE_MAP() 94 IPC_END_MESSAGE_MAP()
91 return handled; 95 return handled;
92 } 96 }
93 97
94 void AutofillAgent::DidFinishDocumentLoad(WebFrame* frame) { 98 void AutofillAgent::DidFinishDocumentLoad(WebFrame* frame) {
95 // The document has now been fully loaded. Scan for forms to be sent up to 99 // The document has now been fully loaded. Scan for forms to be sent up to
96 // the browser. 100 // the browser.
97 std::vector<webkit::forms::FormData> forms; 101 std::vector<webkit::forms::FormData> forms;
98 form_cache_.ExtractForms(*frame, &forms); 102 form_cache_.ExtractForms(*frame, &forms);
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 } 395 }
392 396
393 void AutofillAgent::OnClearPreviewedForm() { 397 void AutofillAgent::OnClearPreviewedForm() {
394 didClearAutofillSelection(autofill_query_element_); 398 didClearAutofillSelection(autofill_query_element_);
395 } 399 }
396 400
397 void AutofillAgent::OnSetNodeText(const string16& value) { 401 void AutofillAgent::OnSetNodeText(const string16& value) {
398 SetNodeText(value, &autofill_query_element_); 402 SetNodeText(value, &autofill_query_element_);
399 } 403 }
400 404
405 void AutofillAgent::OnPasswordHandleKeyDown(int key_code) {
406 password_autofill_manager_->HandleKeyDown(autofill_query_element_, key_code);
407 }
408
409 void AutofillAgent::OnPasswordAcceptAutofillSuggestion(const string16& value) {
410 password_autofill_manager_->DidAcceptAutofillSuggestion(
411 autofill_query_element_,
412 value);
413 }
414
401 void AutofillAgent::ShowSuggestions(const WebInputElement& element, 415 void AutofillAgent::ShowSuggestions(const WebInputElement& element,
402 bool autofill_on_empty_values, 416 bool autofill_on_empty_values,
403 bool requires_caret_at_end, 417 bool requires_caret_at_end,
404 bool display_warning_if_disabled) { 418 bool display_warning_if_disabled) {
405 // If autocomplete is disabled at the form level, then we might want to show 419 // 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 420 // a warning in place of suggestions. However, if autocomplete is disabled
407 // specifically for this field, we never want to show a warning. Otherwise, 421 // 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 422 // we might interfere with custom popups (e.g. search suggestions) used by
409 // the website. 423 // the website.
410 const WebFormElement form = element.form(); 424 const WebFormElement form = element.form();
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 494
481 void AutofillAgent::SetNodeText(const string16& value, 495 void AutofillAgent::SetNodeText(const string16& value,
482 WebKit::WebInputElement* node) { 496 WebKit::WebInputElement* node) {
483 string16 substring = value; 497 string16 substring = value;
484 substring = substring.substr(0, node->maxLength()); 498 substring = substring.substr(0, node->maxLength());
485 499
486 node->setValue(substring, true); 500 node->setValue(substring, true);
487 } 501 }
488 502
489 } // namespace autofill 503 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698