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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_ADDRESS_FIELD_H_
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_ADDRESS_FIELD_H_
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "base/gtest_prod_util.h"
13 #include "base/strings/string16.h"
14 #include "components/autofill/core/browser/autofill_type.h"
15 #include "components/autofill/core/browser/form_field.h"
20 class AutofillScanner;
22 class AddressField : public FormField {
24 static FormField* Parse(AutofillScanner* scanner);
28 bool ClassifyField(ServerFieldTypeMap* map) const override;
31 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest, ParseOneLineAddress);
32 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest, ParseTwoLineAddress);
33 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest, ParseThreeLineAddress);
34 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest, ParseStreetAddressFromTextArea);
35 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest, ParseCity);
36 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest, ParseState);
37 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest, ParseZip);
38 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest, ParseStateAndZipOneLabel);
39 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest, ParseCountry);
40 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest, ParseTwoLineAddressMissingLabel);
41 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest, ParseCompany);
45 bool ParseCompany(AutofillScanner* scanner);
46 bool ParseAddressLines(AutofillScanner* scanner);
47 bool ParseCountry(AutofillScanner* scanner);
48 bool ParseZipCode(AutofillScanner* scanner);
49 bool ParseCity(AutofillScanner* scanner);
50 bool ParseState(AutofillScanner* scanner);
52 AutofillField* company_;
53 AutofillField* address1_;
54 AutofillField* address2_;
55 AutofillField* street_address_;
57 AutofillField* state_;
59 AutofillField* zip4_; // optional ZIP+4; we don't fill this yet.
60 AutofillField* country_;
62 DISALLOW_COPY_AND_ASSIGN(AddressField);
65 } // namespace autofill
67 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_ADDRESS_FIELD_H_