| 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/address_field.h" | 5 #include "components/autofill/core/browser/address_field.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 base::string16 attention_ignored = UTF8ToUTF16(kAttentionIgnoredRe); | 52 base::string16 attention_ignored = UTF8ToUTF16(kAttentionIgnoredRe); |
| 53 base::string16 region_ignored = UTF8ToUTF16(kRegionIgnoredRe); | 53 base::string16 region_ignored = UTF8ToUTF16(kRegionIgnoredRe); |
| 54 | 54 |
| 55 // Allow address fields to appear in any order. | 55 // Allow address fields to appear in any order. |
| 56 size_t begin_trailing_non_labeled_fields = 0; | 56 size_t begin_trailing_non_labeled_fields = 0; |
| 57 bool has_trailing_non_labeled_fields = false; | 57 bool has_trailing_non_labeled_fields = false; |
| 58 while (!scanner->IsEnd()) { | 58 while (!scanner->IsEnd()) { |
| 59 const size_t cursor = scanner->SaveCursor(); | 59 const size_t cursor = scanner->SaveCursor(); |
| 60 // Ignore "Address Lookup" field. http://crbug.com/427622 | 60 // Ignore "Address Lookup" field. http://crbug.com/427622 |
| 61 if (ParseField(scanner, base::UTF8ToUTF16(kAddressLookupRe), NULL)) { | 61 if (ParseField(scanner, base::UTF8ToUTF16(kAddressLookupRe), NULL) || |
| 62 ParseField(scanner, base::UTF8ToUTF16(kAddressNameIgnoredRe), NULL)) { |
| 62 continue; | 63 continue; |
| 63 } else if (address_field->ParseAddressLines(scanner) || | 64 } else if (address_field->ParseAddressLines(scanner) || |
| 64 address_field->ParseCityStateZipCode(scanner) || | 65 address_field->ParseCityStateZipCode(scanner) || |
| 65 address_field->ParseCountry(scanner) || | 66 address_field->ParseCountry(scanner) || |
| 66 address_field->ParseCompany(scanner)) { | 67 address_field->ParseCompany(scanner)) { |
| 67 has_trailing_non_labeled_fields = false; | 68 has_trailing_non_labeled_fields = false; |
| 68 continue; | 69 continue; |
| 69 } else if (ParseField(scanner, attention_ignored, NULL) || | 70 } else if (ParseField(scanner, attention_ignored, NULL) || |
| 70 ParseField(scanner, region_ignored, NULL)) { | 71 ParseField(scanner, region_ignored, NULL)) { |
| 71 // We ignore the following: | 72 // We ignore the following: |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 AddressField::ParseNameLabelResult AddressField::ParseNameAndLabelForState( | 413 AddressField::ParseNameLabelResult AddressField::ParseNameAndLabelForState( |
| 413 AutofillScanner* scanner) { | 414 AutofillScanner* scanner) { |
| 414 if (state_) | 415 if (state_) |
| 415 return RESULT_MATCH_NONE; | 416 return RESULT_MATCH_NONE; |
| 416 | 417 |
| 417 return ParseNameAndLabelSeparately( | 418 return ParseNameAndLabelSeparately( |
| 418 scanner, UTF8ToUTF16(kStateRe), kStateMatchType, &state_); | 419 scanner, UTF8ToUTF16(kStateRe), kStateMatchType, &state_); |
| 419 } | 420 } |
| 420 | 421 |
| 421 } // namespace autofill | 422 } // namespace autofill |
| OLD | NEW |