| 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 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 = element.formControlType(); |
| 597 field->autocomplete_type = element.getAttribute("x-autocompletetype"); | 597 field->autocomplete_attribute = element.getAttribute("autocomplete"); |
| 598 TrimWhitespace(field->autocomplete_type, TRIM_ALL, &field->autocomplete_type); | 598 if (field->autocomplete_attribute.size() > kMaxDataLength) { |
| 599 if (field->autocomplete_type.size() > kMaxDataLength) { | |
| 600 // Discard overly long attribute values to avoid DOS-ing the browser | 599 // Discard overly long attribute values to avoid DOS-ing the browser |
| 601 // process. However, send over a default string to indicate that the | 600 // process. However, send over a default string to indicate that the |
| 602 // attribute was present. | 601 // attribute was present. |
| 603 field->autocomplete_type = ASCIIToUTF16("x-max-data-length-exceeded"); | 602 field->autocomplete_attribute = ASCIIToUTF16("x-max-data-length-exceeded"); |
| 604 } | 603 } |
| 605 | 604 |
| 606 if (!IsAutofillableElement(element)) | 605 if (!IsAutofillableElement(element)) |
| 607 return; | 606 return; |
| 608 | 607 |
| 609 const WebInputElement* input_element = toWebInputElement(&element); | 608 const WebInputElement* input_element = toWebInputElement(&element); |
| 610 if (IsTextInput(input_element)) { | 609 if (IsTextInput(input_element)) { |
| 611 field->max_length = input_element->maxLength(); | 610 field->max_length = input_element->maxLength(); |
| 612 field->is_autofilled = input_element->isAutofilled(); | 611 field->is_autofilled = input_element->isAutofilled(); |
| 613 field->is_focusable = input_element->isFocusable(); | 612 field->is_focusable = input_element->isFocusable(); |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 894 continue; | 893 continue; |
| 895 | 894 |
| 896 if (input_element->isAutofilled()) | 895 if (input_element->isAutofilled()) |
| 897 return true; | 896 return true; |
| 898 } | 897 } |
| 899 | 898 |
| 900 return false; | 899 return false; |
| 901 } | 900 } |
| 902 | 901 |
| 903 } // namespace autofill | 902 } // namespace autofill |
| OLD | NEW |