| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/personal_data_manager.h" | 5 #include "chrome/browser/autofill/personal_data_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <iterator> | 8 #include <iterator> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 if (!field->IsFieldFillable() || value.empty()) | 161 if (!field->IsFieldFillable() || value.empty()) |
| 162 continue; | 162 continue; |
| 163 | 163 |
| 164 AutoFillType field_type(field->type()); | 164 AutoFillType field_type(field->type()); |
| 165 FieldTypeGroup group(field_type.group()); | 165 FieldTypeGroup group(field_type.group()); |
| 166 | 166 |
| 167 if (group == AutoFillType::CREDIT_CARD) { | 167 if (group == AutoFillType::CREDIT_CARD) { |
| 168 // If the user has a password set, we have no way of setting credit | 168 // If the user has a password set, we have no way of setting credit |
| 169 // card numbers. | 169 // card numbers. |
| 170 if (!HasPassword()) { | 170 if (!HasPassword()) { |
| 171 imported_credit_card_->SetInfo(AutoFillType(field_type.field_type()), | 171 if (LowerCaseEqualsASCII(field->form_control_type(), "month")) { |
| 172 value); | 172 DCHECK_EQ(CREDIT_CARD_EXP_MONTH, field_type.field_type()); |
| 173 imported_credit_card_->SetInfoForMonthInputType(value); |
| 174 } else { |
| 175 imported_credit_card_->SetInfo( |
| 176 AutoFillType(field_type.field_type()), value); |
| 177 } |
| 173 ++importable_credit_card_fields; | 178 ++importable_credit_card_fields; |
| 174 } | 179 } |
| 175 } else { | 180 } else { |
| 176 // In the case of a phone number, if the whole phone number was entered | 181 // In the case of a phone number, if the whole phone number was entered |
| 177 // into a single field, then parse it and set the sub components. | 182 // into a single field, then parse it and set the sub components. |
| 178 if (field_type.subgroup() == AutoFillType::PHONE_WHOLE_NUMBER) { | 183 if (field_type.subgroup() == AutoFillType::PHONE_WHOLE_NUMBER) { |
| 179 string16 number; | 184 string16 number; |
| 180 string16 city_code; | 185 string16 city_code; |
| 181 string16 country_code; | 186 string16 country_code; |
| 182 PhoneNumber::ParsePhoneNumber(value, | 187 PhoneNumber::ParsePhoneNumber(value, |
| (...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 } | 797 } |
| 793 | 798 |
| 794 creditcards.push_back(**iter); | 799 creditcards.push_back(**iter); |
| 795 } | 800 } |
| 796 | 801 |
| 797 if (!merged) | 802 if (!merged) |
| 798 creditcards.push_back(*imported_credit_card_); | 803 creditcards.push_back(*imported_credit_card_); |
| 799 | 804 |
| 800 SetCreditCards(&creditcards); | 805 SetCreditCards(&creditcards); |
| 801 } | 806 } |
| OLD | NEW |