| 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/form_structure.h" | 5 #include "chrome/browser/autofill/form_structure.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 925 for (std::vector<AutofillField*>::iterator field = fields_->begin(); | 925 for (std::vector<AutofillField*>::iterator field = fields_->begin(); |
| 926 field != fields_->end(); ++field) { | 926 field != fields_->end(); ++field) { |
| 927 const AutofillFieldType current_type = | 927 const AutofillFieldType current_type = |
| 928 AutofillType::GetEquivalentFieldType((*field)->type()); | 928 AutofillType::GetEquivalentFieldType((*field)->type()); |
| 929 | 929 |
| 930 bool already_saw_current_type = seen_types.count(current_type) > 0; | 930 bool already_saw_current_type = seen_types.count(current_type) > 0; |
| 931 | 931 |
| 932 // Forms often ask for multiple phone numbers -- e.g. both a daytime and | 932 // Forms often ask for multiple phone numbers -- e.g. both a daytime and |
| 933 // evening phone number. Our phone number detection is also generally a | 933 // evening phone number. Our phone number detection is also generally a |
| 934 // little off. Hence, ignore this field type as a signal here. | 934 // little off. Hence, ignore this field type as a signal here. |
| 935 if (AutofillType(current_type).group() == AutofillType::PHONE_HOME) | 935 if (AutofillType(current_type).group() == AutofillType::PHONE) |
| 936 already_saw_current_type = false; | 936 already_saw_current_type = false; |
| 937 | 937 |
| 938 // Some forms have adjacent fields of the same type. Two common examples: | 938 // Some forms have adjacent fields of the same type. Two common examples: |
| 939 // * Forms with two email fields, where the second is meant to "confirm" | 939 // * Forms with two email fields, where the second is meant to "confirm" |
| 940 // the first. | 940 // the first. |
| 941 // * Forms with a <select> menu for states in some countries, and a | 941 // * Forms with a <select> menu for states in some countries, and a |
| 942 // freeform <input> field for states in other countries. (Usually, | 942 // freeform <input> field for states in other countries. (Usually, |
| 943 // only one of these two will be visible for any given choice of | 943 // only one of these two will be visible for any given choice of |
| 944 // country.) | 944 // country.) |
| 945 // Generally, adjacent fields of the same type belong in the same logical | 945 // Generally, adjacent fields of the same type belong in the same logical |
| (...skipping 19 matching lines...) Expand all Loading... |
| 965 for (std::vector<AutofillField*>::iterator field = fields_->begin(); | 965 for (std::vector<AutofillField*>::iterator field = fields_->begin(); |
| 966 field != fields_->end(); ++field) { | 966 field != fields_->end(); ++field) { |
| 967 AutofillType::FieldTypeGroup field_type_group = | 967 AutofillType::FieldTypeGroup field_type_group = |
| 968 AutofillType((*field)->type()).group(); | 968 AutofillType((*field)->type()).group(); |
| 969 if (field_type_group == AutofillType::CREDIT_CARD) | 969 if (field_type_group == AutofillType::CREDIT_CARD) |
| 970 (*field)->set_section((*field)->section() + ASCIIToUTF16("-cc")); | 970 (*field)->set_section((*field)->section() + ASCIIToUTF16("-cc")); |
| 971 else | 971 else |
| 972 (*field)->set_section((*field)->section() + ASCIIToUTF16("-default")); | 972 (*field)->set_section((*field)->section() + ASCIIToUTF16("-default")); |
| 973 } | 973 } |
| 974 } | 974 } |
| OLD | NEW |