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 #include "chrome/browser/ui/autofill/autofill_dialog_common.h" | 5 #include "chrome/browser/ui/autofill/autofill_dialog_common.h" |
6 | 6 |
7 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
8 #include "components/autofill/core/browser/autofill_country.h" | 8 #include "components/autofill/core/browser/autofill_country.h" |
9 #include "components/autofill/core/browser/autofill_field.h" | 9 #include "components/autofill/core/browser/autofill_field.h" |
10 #include "components/autofill/core/browser/autofill_type.h" | 10 #include "components/autofill/core/browser/autofill_type.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 server_type == CREDIT_CARD_EXP_MONTH) { | 30 server_type == CREDIT_CARD_EXP_MONTH) { |
31 return input.type == CREDIT_CARD_EXP_4_DIGIT_YEAR || | 31 return input.type == CREDIT_CARD_EXP_4_DIGIT_YEAR || |
32 input.type == CREDIT_CARD_EXP_MONTH; | 32 input.type == CREDIT_CARD_EXP_MONTH; |
33 } | 33 } |
34 | 34 |
35 if (server_type == CREDIT_CARD_TYPE) | 35 if (server_type == CREDIT_CARD_TYPE) |
36 return input.type == CREDIT_CARD_NUMBER; | 36 return input.type == CREDIT_CARD_NUMBER; |
37 | 37 |
38 // Check the groups to distinguish billing types from shipping ones. | 38 // Check the groups to distinguish billing types from shipping ones. |
39 AutofillType input_type = AutofillType(input.type); | 39 AutofillType input_type = AutofillType(input.type); |
40 return input_type.GetStorableType() == server_type && | 40 if (input_type.group() != field_type.group()) |
41 input_type.group() == field_type.group(); | 41 return false; |
| 42 |
| 43 // Street address (all lines) is matched to the first input address line. |
| 44 if (server_type == ADDRESS_HOME_STREET_ADDRESS) |
| 45 return input_type.GetStorableType() == ADDRESS_HOME_LINE1; |
| 46 |
| 47 return input_type.GetStorableType() == server_type; |
42 } | 48 } |
43 | 49 |
44 // Returns true if |input| in the given |section| should be used for a | 50 // Returns true if |input| in the given |section| should be used for a |
45 // site-requested |field|. | 51 // site-requested |field|. |
46 bool DetailInputMatchesField(DialogSection section, | 52 bool DetailInputMatchesField(DialogSection section, |
47 const DetailInput& input, | 53 const DetailInput& input, |
48 const AutofillField& field) { | 54 const AutofillField& field) { |
49 AutofillType field_type = field.Type(); | 55 AutofillType field_type = field.Type(); |
50 | 56 |
51 // The credit card name is filled from the billing section's data. | 57 // The credit card name is filled from the billing section's data. |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 if (AutofillType(type).GetStorableType() == ADDRESS_HOME_COUNTRY) { | 217 if (AutofillType(type).GetStorableType() == ADDRESS_HOME_COUNTRY) { |
212 AutofillCountry country("US", g_browser_process->GetApplicationLocale()); | 218 AutofillCountry country("US", g_browser_process->GetApplicationLocale()); |
213 return country.name(); | 219 return country.name(); |
214 } | 220 } |
215 | 221 |
216 return base::string16(); | 222 return base::string16(); |
217 } | 223 } |
218 | 224 |
219 } // namespace common | 225 } // namespace common |
220 } // namespace autofill | 226 } // namespace autofill |
OLD | NEW |