| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 // Parse the form and construct a profile based on the information that is | 175 // Parse the form and construct a profile based on the information that is |
| 176 // possible to import. | 176 // possible to import. |
| 177 int importable_fields = 0; | 177 int importable_fields = 0; |
| 178 int importable_credit_card_fields = 0; | 178 int importable_credit_card_fields = 0; |
| 179 | 179 |
| 180 std::vector<const FormStructure*>::const_iterator iter; | 180 std::vector<const FormStructure*>::const_iterator iter; |
| 181 for (iter = form_structures.begin(); iter != form_structures.end(); ++iter) { | 181 for (iter = form_structures.begin(); iter != form_structures.end(); ++iter) { |
| 182 const FormStructure* form = *iter; | 182 const FormStructure* form = *iter; |
| 183 for (size_t i = 0; i < form->field_count(); ++i) { | 183 for (size_t i = 0; i < form->field_count(); ++i) { |
| 184 const AutofillField* field = form->field(i); | 184 const AutofillField* field = form->field(i); |
| 185 string16 value = CollapseWhitespace(field->value(), false); | 185 string16 value = CollapseWhitespace(field->value, false); |
| 186 | 186 |
| 187 // If we don't know the type of the field, or the user hasn't entered any | 187 // If we don't know the type of the field, or the user hasn't entered any |
| 188 // information into the field, then skip it. | 188 // information into the field, then skip it. |
| 189 if (!field->IsFieldFillable() || value.empty()) | 189 if (!field->IsFieldFillable() || value.empty()) |
| 190 continue; | 190 continue; |
| 191 | 191 |
| 192 AutofillType field_type(field->type()); | 192 AutofillType field_type(field->type()); |
| 193 FieldTypeGroup group(field_type.group()); | 193 FieldTypeGroup group(field_type.group()); |
| 194 | 194 |
| 195 if (group == AutofillType::CREDIT_CARD) { | 195 if (group == AutofillType::CREDIT_CARD) { |
| 196 // If the user has a password set, we have no way of setting credit | 196 // If the user has a password set, we have no way of setting credit |
| 197 // card numbers. | 197 // card numbers. |
| 198 if (!HasPassword()) { | 198 if (!HasPassword()) { |
| 199 if (LowerCaseEqualsASCII(field->form_control_type(), "month")) { | 199 if (LowerCaseEqualsASCII(field->form_control_type, "month")) { |
| 200 DCHECK_EQ(CREDIT_CARD_EXP_MONTH, field_type.field_type()); | 200 DCHECK_EQ(CREDIT_CARD_EXP_MONTH, field_type.field_type()); |
| 201 local_imported_credit_card->SetInfoForMonthInputType(value); | 201 local_imported_credit_card->SetInfoForMonthInputType(value); |
| 202 } else { | 202 } else { |
| 203 local_imported_credit_card->SetInfo( | 203 local_imported_credit_card->SetInfo( |
| 204 AutofillType(field_type.field_type()), value); | 204 AutofillType(field_type.field_type()), value); |
| 205 } | 205 } |
| 206 ++importable_credit_card_fields; | 206 ++importable_credit_card_fields; |
| 207 } | 207 } |
| 208 } else { | 208 } else { |
| 209 // In the case of a phone number, if the whole phone number was entered | 209 // In the case of a phone number, if the whole phone number was entered |
| (...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 823 } | 823 } |
| 824 | 824 |
| 825 const AutofillMetrics* PersonalDataManager::metric_logger() const { | 825 const AutofillMetrics* PersonalDataManager::metric_logger() const { |
| 826 return metric_logger_.get(); | 826 return metric_logger_.get(); |
| 827 } | 827 } |
| 828 | 828 |
| 829 void PersonalDataManager::set_metric_logger( | 829 void PersonalDataManager::set_metric_logger( |
| 830 const AutofillMetrics* metric_logger) { | 830 const AutofillMetrics* metric_logger) { |
| 831 metric_logger_.reset(metric_logger); | 831 metric_logger_.reset(metric_logger); |
| 832 } | 832 } |
| OLD | NEW |