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/memory/scoped_ptr.h"
14 #include "base/strings/string16.h"
15 #include "components/autofill/core/browser/autofill_type.h"
16 #include "components/autofill/core/browser/form_field.h"
21 class AutofillScanner
;
23 class AddressField
: public FormField
{
25 static scoped_ptr
<FormField
> Parse(AutofillScanner
* scanner
);
29 bool ClassifyField(ServerFieldTypeMap
* map
) const override
;
32 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest
, ParseOneLineAddress
);
33 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest
, ParseTwoLineAddress
);
34 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest
, ParseThreeLineAddress
);
35 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest
, ParseStreetAddressFromTextArea
);
36 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest
, ParseCity
);
37 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest
, ParseState
);
38 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest
, ParseZip
);
39 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest
, ParseStateAndZipOneLabel
);
40 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest
, ParseCountry
);
41 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest
, ParseTwoLineAddressMissingLabel
);
42 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest
, ParseCompany
);
46 bool ParseCompany(AutofillScanner
* scanner
);
47 bool ParseAddressLines(AutofillScanner
* scanner
);
48 bool ParseCountry(AutofillScanner
* scanner
);
49 bool ParseZipCode(AutofillScanner
* scanner
);
50 bool ParseCity(AutofillScanner
* scanner
);
51 bool ParseState(AutofillScanner
* scanner
);
53 AutofillField
* company_
;
54 AutofillField
* address1_
;
55 AutofillField
* address2_
;
56 AutofillField
* address3_
;
57 AutofillField
* street_address_
;
59 AutofillField
* state_
;
61 AutofillField
* zip4_
; // optional ZIP+4; we don't fill this yet.
62 AutofillField
* country_
;
64 DISALLOW_COPY_AND_ASSIGN(AddressField
);
67 } // namespace autofill
69 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_ADDRESS_FIELD_H_