OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/browser/autofill/address_field.h" | 5 #include "chrome/browser/autofill/address_field.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/string16.h" | 8 #include "base/string16.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "chrome/browser/autofill/autofill_field.h" | 10 #include "chrome/browser/autofill/autofill_field.h" |
11 | 11 |
12 bool AddressField::GetFieldInfo(FieldTypeMap* field_type_map) const { | 12 bool AddressField::GetFieldInfo(FieldTypeMap* field_type_map) const { |
13 AutoFillFieldType address_line1; | 13 AutoFillFieldType address_line1; |
14 AutoFillFieldType address_line2; | 14 AutoFillFieldType address_line2; |
15 AutoFillFieldType address_appt_num; | 15 AutoFillFieldType address_appt_num; |
16 AutoFillFieldType address_city; | 16 AutoFillFieldType address_city; |
17 AutoFillFieldType address_state; | 17 AutoFillFieldType address_state; |
18 AutoFillFieldType address_zip; | 18 AutoFillFieldType address_zip; |
19 AutoFillFieldType address_country; | 19 AutoFillFieldType address_country; |
20 | 20 |
21 switch (type_) { | 21 switch (type_) { |
22 case kShippingAddress: | 22 case kShippingAddress: |
23 // Fallthrough. Autofill no longer supports shipping addresses. | 23 // Fallthrough. Autofill no longer supports shipping addresses. |
24 case kGenericAddress: | 24 case kGenericAddress: |
25 address_line1 = ADDRESS_HOME_LINE1; | 25 address_line1 = ADDRESS_HOME_LINE1; |
26 address_line2 = ADDRESS_HOME_LINE2; | 26 address_line2 = ADDRESS_HOME_LINE2; |
27 address_appt_num = ADDRESS_HOME_APPT_NUM; | 27 address_appt_num = ADDRESS_HOME_APT_NUM; |
28 address_city = ADDRESS_HOME_CITY; | 28 address_city = ADDRESS_HOME_CITY; |
29 address_state = ADDRESS_HOME_STATE; | 29 address_state = ADDRESS_HOME_STATE; |
30 address_zip = ADDRESS_HOME_ZIP; | 30 address_zip = ADDRESS_HOME_ZIP; |
31 address_country = ADDRESS_HOME_COUNTRY; | 31 address_country = ADDRESS_HOME_COUNTRY; |
32 break; | 32 break; |
33 | 33 |
34 case kBillingAddress: | 34 case kBillingAddress: |
35 address_line1 = ADDRESS_BILLING_LINE1; | 35 address_line1 = ADDRESS_BILLING_LINE1; |
36 address_line2 = ADDRESS_BILLING_LINE2; | 36 address_line2 = ADDRESS_BILLING_LINE2; |
37 address_appt_num = ADDRESS_BILLING_APPT_NUM; | 37 address_appt_num = ADDRESS_BILLING_APT_NUM; |
38 address_city = ADDRESS_BILLING_CITY; | 38 address_city = ADDRESS_BILLING_CITY; |
39 address_state = ADDRESS_BILLING_STATE; | 39 address_state = ADDRESS_BILLING_STATE; |
40 address_zip = ADDRESS_BILLING_ZIP; | 40 address_zip = ADDRESS_BILLING_ZIP; |
41 address_country = ADDRESS_BILLING_COUNTRY; | 41 address_country = ADDRESS_BILLING_COUNTRY; |
42 break; | 42 break; |
43 | 43 |
44 default: | 44 default: |
45 NOTREACHED(); | 45 NOTREACHED(); |
46 return false; | 46 return false; |
47 } | 47 } |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 size_t ship = text.find_last_of(ASCIIToUTF16("ship")); | 325 size_t ship = text.find_last_of(ASCIIToUTF16("ship")); |
326 | 326 |
327 if (bill != string16::npos && bill > ship) | 327 if (bill != string16::npos && bill > ship) |
328 return kBillingAddress; | 328 return kBillingAddress; |
329 | 329 |
330 if (ship != string16::npos) | 330 if (ship != string16::npos) |
331 return kShippingAddress; | 331 return kShippingAddress; |
332 | 332 |
333 return kGenericAddress; | 333 return kGenericAddress; |
334 } | 334 } |
OLD | NEW |