| 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 24 matching lines...) Expand all Loading... |
| 35 server_type == CREDIT_CARD_EXP_MONTH) { | 35 server_type == CREDIT_CARD_EXP_MONTH) { |
| 36 return input.type == CREDIT_CARD_EXP_4_DIGIT_YEAR || | 36 return input.type == CREDIT_CARD_EXP_4_DIGIT_YEAR || |
| 37 input.type == CREDIT_CARD_EXP_MONTH; | 37 input.type == CREDIT_CARD_EXP_MONTH; |
| 38 } | 38 } |
| 39 | 39 |
| 40 if (server_type == CREDIT_CARD_TYPE) | 40 if (server_type == CREDIT_CARD_TYPE) |
| 41 return input.type == CREDIT_CARD_NUMBER; | 41 return input.type == CREDIT_CARD_NUMBER; |
| 42 | 42 |
| 43 // Check the groups to distinguish billing types from shipping ones. | 43 // Check the groups to distinguish billing types from shipping ones. |
| 44 AutofillType input_type = AutofillType(input.type); | 44 AutofillType input_type = AutofillType(input.type); |
| 45 return input_type.GetStorableType() == server_type && | 45 if (input_type.group() != field_type.group()) |
| 46 input_type.group() == field_type.group(); | 46 return false; |
| 47 |
| 48 // Street address (all lines) is matched to the first input address line. |
| 49 if (server_type == ADDRESS_HOME_STREET_ADDRESS) |
| 50 return input_type.GetStorableType() == ADDRESS_HOME_LINE1; |
| 51 |
| 52 return input_type.GetStorableType() == server_type; |
| 47 } | 53 } |
| 48 | 54 |
| 49 // Returns true if |input| in the given |section| should be used for a | 55 // Returns true if |input| in the given |section| should be used for a |
| 50 // site-requested |field|. | 56 // site-requested |field|. |
| 51 bool DetailInputMatchesField(DialogSection section, | 57 bool DetailInputMatchesField(DialogSection section, |
| 52 const DetailInput& input, | 58 const DetailInput& input, |
| 53 const AutofillField& field) { | 59 const AutofillField& field) { |
| 54 AutofillType field_type = field.Type(); | 60 AutofillType field_type = field.Type(); |
| 55 | 61 |
| 56 // The credit card name is filled from the billing section's data. | 62 // The credit card name is filled from the billing section's data. |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 if (AutofillType(type).GetStorableType() == ADDRESS_HOME_COUNTRY) { | 267 if (AutofillType(type).GetStorableType() == ADDRESS_HOME_COUNTRY) { |
| 262 AutofillCountry country("US", g_browser_process->GetApplicationLocale()); | 268 AutofillCountry country("US", g_browser_process->GetApplicationLocale()); |
| 263 return country.name(); | 269 return country.name(); |
| 264 } | 270 } |
| 265 | 271 |
| 266 return base::string16(); | 272 return base::string16(); |
| 267 } | 273 } |
| 268 | 274 |
| 269 } // namespace common | 275 } // namespace common |
| 270 } // namespace autofill | 276 } // namespace autofill |
| OLD | NEW |