| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/core/browser/autofill_field.h" | 5 #include "components/autofill/core/browser/autofill_field.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/i18n/string_search.h" | 10 #include "base/i18n/string_search.h" |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 } | 589 } |
| 590 | 590 |
| 591 // If no max length was specified, return the complete number. | 591 // If no max length was specified, return the complete number. |
| 592 if (field_data.max_length == 0) | 592 if (field_data.max_length == 0) |
| 593 return number; | 593 return number; |
| 594 | 594 |
| 595 // If |number| exceeds the maximum size of the field, cut the first part to | 595 // If |number| exceeds the maximum size of the field, cut the first part to |
| 596 // provide a valid number for the field. For example, the number 15142365264 | 596 // provide a valid number for the field. For example, the number 15142365264 |
| 597 // with a field with a max length of 10 would return 5142365264, thus removing | 597 // with a field with a max length of 10 would return 5142365264, thus removing |
| 598 // the country code and remaining valid. | 598 // the country code and remaining valid. |
| 599 if (number.length() > field_data.max_length) { | 599 if (static_cast<int>(number.length()) > field_data.max_length && field_data.ma
x_length > -1) { |
| 600 return number.substr(number.length() - field_data.max_length, | 600 return number.substr(number.length() - field_data.max_length, |
| 601 field_data.max_length); | 601 field_data.max_length); |
| 602 } | 602 } |
| 603 | 603 |
| 604 return number; | 604 return number; |
| 605 } | 605 } |
| 606 | 606 |
| 607 // static | 607 // static |
| 608 bool AutofillField::FindValueInSelectControl(const FormFieldData& field, | 608 bool AutofillField::FindValueInSelectControl(const FormFieldData& field, |
| 609 const base::string16& value, | 609 const base::string16& value, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 624 if (compare.StringsEqual(value_stripped, option_contents)) { | 624 if (compare.StringsEqual(value_stripped, option_contents)) { |
| 625 if (index) | 625 if (index) |
| 626 *index = i; | 626 *index = i; |
| 627 return true; | 627 return true; |
| 628 } | 628 } |
| 629 } | 629 } |
| 630 return false; | 630 return false; |
| 631 } | 631 } |
| 632 | 632 |
| 633 } // namespace autofill | 633 } // namespace autofill |
| OLD | NEW |