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

Side by Side Diff: components/autofill/renderer/form_autofill_util.cc

Issue 12721004: Autofill:Autocomplete: Enable autocheckout of input elements of type password. This will support fi… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | 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 "components/autofill/renderer/form_autofill_util.h" 5 #include "components/autofill/renderer/form_autofill_util.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 NOTREACHED(); 583 NOTREACHED();
584 return "UNKNOWN"; 584 return "UNKNOWN";
585 } 585 }
586 586
587 } // namespace 587 } // namespace
588 588
589 namespace autofill { 589 namespace autofill {
590 590
591 const size_t kMaxParseableFields = 100; 591 const size_t kMaxParseableFields = 100;
592 592
593 // In HTML5, all text fields except password are text input fields to 593 // Include password fields as TextInput fields. Password fields will be filtered
594 // autocomplete. 594 // out in browser process before sending them accross to Autofill server in
595 // regular Autofill.
Ilya Sherman 2013/03/15 23:42:35 This comment doesn't seem very useful except to so
Raman Kakilate 2013/03/18 17:54:00 Done.
595 bool IsTextInput(const WebInputElement* element) { 596 bool IsTextInput(const WebInputElement* element) {
596 if (!element) 597 if (!element)
597 return false; 598 return false;
598 599
599 return element->isTextField() && !element->isPasswordField(); 600 return element->isTextField();
Ilya Sherman 2013/03/15 23:42:35 nit: "return element && element->isTextField();"
Raman Kakilate 2013/03/18 17:54:00 Done.
600 } 601 }
601 602
602 bool IsSelectElement(const WebFormControlElement& element) { 603 bool IsSelectElement(const WebFormControlElement& element) {
603 // Is static for improving performance. 604 // Is static for improving performance.
604 CR_DEFINE_STATIC_LOCAL(WebString, kSelectOne, ("select-one")); 605 CR_DEFINE_STATIC_LOCAL(WebString, kSelectOne, ("select-one"));
605 return element.formControlType() == kSelectOne; 606 return element.formControlType() == kSelectOne;
606 } 607 }
607 608
608 bool IsCheckableElement(const WebInputElement* element) { 609 bool IsCheckableElement(const WebInputElement* element) {
609 if (!element) 610 if (!element)
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 713
713 const WebInputElement* input_element = toWebInputElement(&element); 714 const WebInputElement* input_element = toWebInputElement(&element);
714 if (IsAutofillableInputElement(input_element)) { 715 if (IsAutofillableInputElement(input_element)) {
715 if (IsTextInput(input_element)) 716 if (IsTextInput(input_element))
716 field->max_length = input_element->maxLength(); 717 field->max_length = input_element->maxLength();
717 718
718 field->is_autofilled = input_element->isAutofilled(); 719 field->is_autofilled = input_element->isAutofilled();
719 field->is_focusable = input_element->isFocusable(); 720 field->is_focusable = input_element->isFocusable();
720 field->should_autocomplete = input_element->autoComplete(); 721 field->should_autocomplete = input_element->autoComplete();
721 field->is_checkable = IsCheckableElement(input_element); 722 field->is_checkable = IsCheckableElement(input_element);
723
724 // Explicitly mark password fields as non autofillable.
725 if (input_element->isPasswordField())
726 field->is_password_field = true;
722 } else if (extract_mask & EXTRACT_OPTIONS) { 727 } else if (extract_mask & EXTRACT_OPTIONS) {
723 // Set option strings on the field if available. 728 // Set option strings on the field if available.
724 DCHECK(IsSelectElement(element)); 729 DCHECK(IsSelectElement(element));
725 const WebSelectElement select_element = element.toConst<WebSelectElement>(); 730 const WebSelectElement select_element = element.toConst<WebSelectElement>();
726 GetOptionStringsFromElement(select_element, 731 GetOptionStringsFromElement(select_element,
727 &field->option_values, 732 &field->option_values,
728 &field->option_contents); 733 &field->option_contents);
729 } 734 }
730 735
731 if (!(extract_mask & EXTRACT_VALUE)) 736 if (!(extract_mask & EXTRACT_VALUE))
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
1023 continue; 1028 continue;
1024 1029
1025 if (input_element->isAutofilled()) 1030 if (input_element->isAutofilled())
1026 return true; 1031 return true;
1027 } 1032 }
1028 1033
1029 return false; 1034 return false;
1030 } 1035 }
1031 1036
1032 } // namespace autofill 1037 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698