| OLD | NEW |
| 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/form_autofill_util.h" | 5 #include "chrome/renderer/autofill/form_autofill_util.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 void WebFormControlElementToFormField(const WebFormControlElement& element, | 586 void WebFormControlElementToFormField(const WebFormControlElement& element, |
| 587 ExtractMask extract_mask, | 587 ExtractMask extract_mask, |
| 588 FormFieldData* field) { | 588 FormFieldData* field) { |
| 589 DCHECK(field); | 589 DCHECK(field); |
| 590 DCHECK(!element.isNull()); | 590 DCHECK(!element.isNull()); |
| 591 | 591 |
| 592 // The label is not officially part of a WebFormControlElement; however, the | 592 // The label is not officially part of a WebFormControlElement; however, the |
| 593 // labels for all form control elements are scraped from the DOM and set in | 593 // labels for all form control elements are scraped from the DOM and set in |
| 594 // WebFormElementToFormData. | 594 // WebFormElementToFormData. |
| 595 field->name = element.nameForAutofill(); | 595 field->name = element.nameForAutofill(); |
| 596 field->form_control_type = element.formControlType(); | 596 field->form_control_type = UTF16ToUTF8(element.formControlType()); |
| 597 field->autocomplete_type = element.getAttribute("x-autocompletetype"); | 597 field->autocomplete_attribute = |
| 598 TrimWhitespace(field->autocomplete_type, TRIM_ALL, &field->autocomplete_type); | 598 UTF16ToUTF8(element.getAttribute("autocomplete")); |
| 599 if (field->autocomplete_type.size() > kMaxDataLength) { | 599 if (field->autocomplete_attribute.size() > kMaxDataLength) { |
| 600 // Discard overly long attribute values to avoid DOS-ing the browser | 600 // Discard overly long attribute values to avoid DOS-ing the browser |
| 601 // process. However, send over a default string to indicate that the | 601 // process. However, send over a default string to indicate that the |
| 602 // attribute was present. | 602 // attribute was present. |
| 603 field->autocomplete_type = ASCIIToUTF16("x-max-data-length-exceeded"); | 603 field->autocomplete_attribute = "x-max-data-length-exceeded"; |
| 604 } | 604 } |
| 605 | 605 |
| 606 if (!IsAutofillableElement(element)) | 606 if (!IsAutofillableElement(element)) |
| 607 return; | 607 return; |
| 608 | 608 |
| 609 const WebInputElement* input_element = toWebInputElement(&element); | 609 const WebInputElement* input_element = toWebInputElement(&element); |
| 610 if (IsTextInput(input_element)) { | 610 if (IsTextInput(input_element)) { |
| 611 field->max_length = input_element->maxLength(); | 611 field->max_length = input_element->maxLength(); |
| 612 field->is_autofilled = input_element->isAutofilled(); | 612 field->is_autofilled = input_element->isAutofilled(); |
| 613 field->is_focusable = input_element->isFocusable(); | 613 field->is_focusable = input_element->isFocusable(); |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 894 continue; | 894 continue; |
| 895 | 895 |
| 896 if (input_element->isAutofilled()) | 896 if (input_element->isAutofilled()) |
| 897 return true; | 897 return true; |
| 898 } | 898 } |
| 899 | 899 |
| 900 return false; | 900 return false; |
| 901 } | 901 } |
| 902 | 902 |
| 903 } // namespace autofill | 903 } // namespace autofill |
| OLD | NEW |