| 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 "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "components/autofill/core/browser/autofill_country.h" | 9 #include "components/autofill/core/browser/autofill_country.h" |
| 10 #include "components/autofill/core/browser/autofill_field.h" | 10 #include "components/autofill/core/browser/autofill_field.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 if (autofill_type.group() != field_type.group()) | 35 if (autofill_type.group() != field_type.group()) |
| 36 return false; | 36 return false; |
| 37 | 37 |
| 38 // The page may ask for individual address lines; this roughly matches the | 38 // The page may ask for individual address lines; this roughly matches the |
| 39 // street address blob. | 39 // street address blob. |
| 40 if (server_type == ADDRESS_HOME_LINE1 || server_type == ADDRESS_HOME_LINE2 || | 40 if (server_type == ADDRESS_HOME_LINE1 || server_type == ADDRESS_HOME_LINE2 || |
| 41 field_type.html_type() == HTML_TYPE_FULL_ADDRESS) { | 41 field_type.html_type() == HTML_TYPE_FULL_ADDRESS) { |
| 42 return autofill_type.GetStorableType() == ADDRESS_HOME_STREET_ADDRESS; | 42 return autofill_type.GetStorableType() == ADDRESS_HOME_STREET_ADDRESS; |
| 43 } | 43 } |
| 44 | 44 |
| 45 // First and last name are parsed from full name. |
| 46 if (field_type.group() == NAME || field_type.group() == NAME_BILLING) |
| 47 return autofill_type.GetStorableType() == NAME_FULL; |
| 48 |
| 45 return autofill_type.GetStorableType() == server_type; | 49 return autofill_type.GetStorableType() == server_type; |
| 46 } | 50 } |
| 47 | 51 |
| 48 bool ServerTypeMatchesField(DialogSection section, | 52 bool ServerTypeMatchesField(DialogSection section, |
| 49 ServerFieldType type, | 53 ServerFieldType type, |
| 50 const AutofillField& field) { | 54 const AutofillField& field) { |
| 51 AutofillType field_type = field.Type(); | 55 AutofillType field_type = field.Type(); |
| 52 | 56 |
| 53 // 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. |
| 54 if (field_type.GetStorableType() == CREDIT_CARD_NAME && | 58 if (field_type.GetStorableType() == CREDIT_CARD_NAME && |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 std::vector<ServerFieldType> TypesFromInputs(const DetailInputs& inputs) { | 119 std::vector<ServerFieldType> TypesFromInputs(const DetailInputs& inputs) { |
| 116 std::vector<ServerFieldType> types; | 120 std::vector<ServerFieldType> types; |
| 117 for (size_t i = 0; i < inputs.size(); ++i) { | 121 for (size_t i = 0; i < inputs.size(); ++i) { |
| 118 types.push_back(inputs[i].type); | 122 types.push_back(inputs[i].type); |
| 119 } | 123 } |
| 120 return types; | 124 return types; |
| 121 } | 125 } |
| 122 | 126 |
| 123 } // namespace common | 127 } // namespace common |
| 124 } // namespace autofill | 128 } // namespace autofill |
| OLD | NEW |