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 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_ADDRESS_FIELD_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_ADDRESS_FIELD_H_ |
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_ADDRESS_FIELD_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_ADDRESS_FIELD_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest, ParseThreeLineAddress); | 34 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest, ParseThreeLineAddress); |
35 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest, ParseStreetAddressFromTextArea); | 35 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest, ParseStreetAddressFromTextArea); |
36 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest, ParseCity); | 36 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest, ParseCity); |
37 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest, ParseState); | 37 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest, ParseState); |
38 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest, ParseZip); | 38 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest, ParseZip); |
39 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest, ParseStateAndZipOneLabel); | 39 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest, ParseStateAndZipOneLabel); |
40 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest, ParseCountry); | 40 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest, ParseCountry); |
41 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest, ParseTwoLineAddressMissingLabel); | 41 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest, ParseTwoLineAddressMissingLabel); |
42 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest, ParseCompany); | 42 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest, ParseCompany); |
43 | 43 |
| 44 static const int kZipCodeMatchType; |
| 45 static const int kCityMatchType; |
| 46 static const int kStateMatchType; |
| 47 |
44 AddressField(); | 48 AddressField(); |
45 | 49 |
46 bool ParseCompany(AutofillScanner* scanner); | 50 bool ParseCompany(AutofillScanner* scanner); |
47 bool ParseAddressLines(AutofillScanner* scanner); | 51 bool ParseAddressLines(AutofillScanner* scanner); |
48 bool ParseCountry(AutofillScanner* scanner); | 52 bool ParseCountry(AutofillScanner* scanner); |
49 bool ParseZipCode(AutofillScanner* scanner); | 53 bool ParseZipCode(AutofillScanner* scanner); |
50 bool ParseCity(AutofillScanner* scanner); | 54 bool ParseCity(AutofillScanner* scanner); |
51 bool ParseState(AutofillScanner* scanner); | 55 bool ParseState(AutofillScanner* scanner); |
52 | 56 |
| 57 // Parses the current field pointed to by |scanner|, if it exists, and tries |
| 58 // to figure out whether the field's type: city, state, zip, or none of those. |
| 59 bool ParseCityStateZipCode(AutofillScanner* scanner); |
| 60 |
| 61 // Run matches on the name and label separately. If the return result is |
| 62 // RESULT_MATCH_NAME_LABEL, then |scanner| advances and the field is set. |
| 63 // Otherwise |scanner| rewinds and the field is cleared. |
| 64 ParseNameLabelResult ParseNameAndLabelForZipCode(AutofillScanner* scanner); |
| 65 ParseNameLabelResult ParseNameAndLabelForCity(AutofillScanner* scanner); |
| 66 ParseNameLabelResult ParseNameAndLabelForState(AutofillScanner* scanner); |
| 67 |
53 AutofillField* company_; | 68 AutofillField* company_; |
54 AutofillField* address1_; | 69 AutofillField* address1_; |
55 AutofillField* address2_; | 70 AutofillField* address2_; |
56 AutofillField* address3_; | 71 AutofillField* address3_; |
57 AutofillField* street_address_; | 72 AutofillField* street_address_; |
58 AutofillField* city_; | 73 AutofillField* city_; |
59 AutofillField* state_; | 74 AutofillField* state_; |
60 AutofillField* zip_; | 75 AutofillField* zip_; |
61 AutofillField* zip4_; // optional ZIP+4; we don't fill this yet. | 76 AutofillField* zip4_; // optional ZIP+4; we don't fill this yet. |
62 AutofillField* country_; | 77 AutofillField* country_; |
63 | 78 |
64 DISALLOW_COPY_AND_ASSIGN(AddressField); | 79 DISALLOW_COPY_AND_ASSIGN(AddressField); |
65 }; | 80 }; |
66 | 81 |
67 } // namespace autofill | 82 } // namespace autofill |
68 | 83 |
69 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_ADDRESS_FIELD_H_ | 84 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_ADDRESS_FIELD_H_ |
OLD | NEW |