Chromium Code Reviews| 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 imported_credit_card_->SetMonthInputInfo(value); |
|
honten.org
2011/01/06 07:04:54
Only "month" input type, call SetMonthInputInfo().
Ilya Sherman
2011/01/07 07:28:28
It might be good to add a DCHECK here that the |fi
| |
| 173 else | |
| 174 imported_credit_card_->SetInfo( | |
|
dhollowa
2011/01/07 03:47:15
nit: according to style guide we need braces {} ar
| |
| 175 AutoFillType(field_type.field_type()), value); | |
| 173 ++importable_credit_card_fields; | 176 ++importable_credit_card_fields; |
| 174 } | 177 } |
| 175 } else { | 178 } else { |
| 176 // In the case of a phone number, if the whole phone number was entered | 179 // 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. | 180 // into a single field, then parse it and set the sub components. |
| 178 if (field_type.subgroup() == AutoFillType::PHONE_WHOLE_NUMBER) { | 181 if (field_type.subgroup() == AutoFillType::PHONE_WHOLE_NUMBER) { |
| 179 string16 number; | 182 string16 number; |
| 180 string16 city_code; | 183 string16 city_code; |
| 181 string16 country_code; | 184 string16 country_code; |
| 182 PhoneNumber::ParsePhoneNumber(value, | 185 PhoneNumber::ParsePhoneNumber(value, |
| (...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 792 } | 795 } |
| 793 | 796 |
| 794 creditcards.push_back(**iter); | 797 creditcards.push_back(**iter); |
| 795 } | 798 } |
| 796 | 799 |
| 797 if (!merged) | 800 if (!merged) |
| 798 creditcards.push_back(*imported_credit_card_); | 801 creditcards.push_back(*imported_credit_card_); |
| 799 | 802 |
| 800 SetCreditCards(&creditcards); | 803 SetCreditCards(&creditcards); |
| 801 } | 804 } |
| OLD | NEW |