Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_AUTOFILL_ADDRESS_FIELD_H_ | 5 #ifndef CHROME_BROWSER_AUTOFILL_ADDRESS_FIELD_H_ |
| 6 #define CHROME_BROWSER_AUTOFILL_ADDRESS_FIELD_H_ | 6 #define CHROME_BROWSER_AUTOFILL_ADDRESS_FIELD_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/gtest_prod_util.h" | |
| 13 #include "base/string16.h" | 14 #include "base/string16.h" |
| 14 #include "chrome/browser/autofill/autofill_type.h" | 15 #include "chrome/browser/autofill/autofill_type.h" |
| 15 #include "chrome/browser/autofill/field_types.h" | 16 #include "chrome/browser/autofill/field_types.h" |
| 16 #include "chrome/browser/autofill/form_field.h" | 17 #include "chrome/browser/autofill/form_field.h" |
| 17 | 18 |
| 18 class AutofillField; | 19 class AutofillField; |
| 19 class AutofillScanner; | 20 class AutofillScanner; |
| 20 | 21 |
| 21 class AddressField : public FormField { | 22 class AddressField : public FormField { |
| 22 public: | 23 public: |
| 23 virtual bool GetFieldInfo(FieldTypeMap* field_type_map) const OVERRIDE; | |
| 24 | |
| 25 static AddressField* Parse(AutofillScanner* scanner, bool is_ecml); | 24 static AddressField* Parse(AutofillScanner* scanner, bool is_ecml); |
| 26 | 25 |
| 27 // Tries to determine the billing/shipping type of this address. | 26 // Tries to determine the billing/shipping type of this address. |
| 28 AddressType FindType() const; | 27 AddressType FindType() const; |
| 29 | 28 |
| 30 // Returns true if this is a full address as opposed to an address fragment | 29 // Returns true if this is a full address as opposed to an address fragment |
| 31 // such as a stand-alone ZIP code. | 30 // such as a stand-alone ZIP code. |
| 32 bool IsFullAddress(); | 31 bool IsFullAddress(); |
|
Ilya Sherman
2011/05/19 05:44:16
This is used only in the unit tests -- should we p
dhollowa
2011/05/19 17:53:08
Done. Yes, this wasn't providing any meaningful c
| |
| 33 | 32 |
| 34 private: | 33 private: |
| 34 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest, ParseOneLineAddress); | |
| 35 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest, ParseOneLineAddressBilling); | |
| 36 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest, ParseOneLineAddressShipping); | |
| 37 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest, ParseOneLineAddressEcml); | |
| 38 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest, ParseTwoLineAddress); | |
| 39 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest, ParseThreeLineAddress); | |
| 40 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest, ParseTwoLineAddressEcml); | |
| 41 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest, ParseCity); | |
| 42 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest, ParseCityEcml); | |
| 43 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest, ParseState); | |
| 44 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest, ParseStateEcml); | |
| 45 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest, ParseZip); | |
| 46 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest, ParseZipEcml); | |
| 47 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest, ParseStateAndZipOneLabel); | |
| 48 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest, ParseCountry); | |
| 49 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest, ParseCountryEcml); | |
| 50 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest, ParseTwoLineAddressMissingLabel); | |
| 51 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest, ParseCompany); | |
| 52 FRIEND_TEST_ALL_PREFIXES(AddressFieldTest, ParseCompanyEcml); | |
| 53 | |
| 35 AddressField(); | 54 AddressField(); |
| 36 | 55 |
| 56 // FormField: | |
| 57 virtual bool ClassifyField(FieldTypeMap* map) const OVERRIDE; | |
| 58 | |
| 37 static bool ParseCompany(AutofillScanner* scanner, | 59 static bool ParseCompany(AutofillScanner* scanner, |
| 38 bool is_ecml, | 60 bool is_ecml, |
| 39 AddressField* address_field); | 61 AddressField* address_field); |
| 40 static bool ParseAddressLines(AutofillScanner* scanner, | 62 static bool ParseAddressLines(AutofillScanner* scanner, |
| 41 bool is_ecml, | 63 bool is_ecml, |
| 42 AddressField* address_field); | 64 AddressField* address_field); |
| 43 static bool ParseCountry(AutofillScanner* scanner, | 65 static bool ParseCountry(AutofillScanner* scanner, |
| 44 bool is_ecml, | 66 bool is_ecml, |
| 45 AddressField* address_field); | 67 AddressField* address_field); |
| 46 static bool ParseZipCode(AutofillScanner* scanner, | 68 static bool ParseZipCode(AutofillScanner* scanner, |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 65 const AutofillField* zip_; | 87 const AutofillField* zip_; |
| 66 const AutofillField* zip4_; // optional ZIP+4; we don't fill this yet | 88 const AutofillField* zip4_; // optional ZIP+4; we don't fill this yet |
| 67 const AutofillField* country_; // optional | 89 const AutofillField* country_; // optional |
| 68 | 90 |
| 69 AddressType type_; | 91 AddressType type_; |
| 70 | 92 |
| 71 DISALLOW_COPY_AND_ASSIGN(AddressField); | 93 DISALLOW_COPY_AND_ASSIGN(AddressField); |
| 72 }; | 94 }; |
| 73 | 95 |
| 74 #endif // CHROME_BROWSER_AUTOFILL_ADDRESS_FIELD_H_ | 96 #endif // CHROME_BROWSER_AUTOFILL_ADDRESS_FIELD_H_ |
| OLD | NEW |