Chromium Code Reviews| 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 "components/autofill/core/browser/autofill_profile.h" | 5 #include "components/autofill/core/browser/autofill_profile.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <ostream> | 10 #include <ostream> |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 64 ADDRESS_HOME_LINE2, | 64 ADDRESS_HOME_LINE2, |
| 65 ADDRESS_HOME_CITY, | 65 ADDRESS_HOME_CITY, |
| 66 ADDRESS_HOME_STATE, | 66 ADDRESS_HOME_STATE, |
| 67 ADDRESS_HOME_ZIP, | 67 ADDRESS_HOME_ZIP, |
| 68 ADDRESS_HOME_COUNTRY, | 68 ADDRESS_HOME_COUNTRY, |
| 69 EMAIL_ADDRESS, | 69 EMAIL_ADDRESS, |
| 70 PHONE_HOME_WHOLE_NUMBER, | 70 PHONE_HOME_WHOLE_NUMBER, |
| 71 COMPANY_NAME, | 71 COMPANY_NAME, |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 std::vector<ServerFieldType> default_fields; | |
| 74 if (!suggested_fields) { | 75 if (!suggested_fields) { |
| 75 DCHECK_EQ(excluded_field, UNKNOWN_TYPE); | 76 default_fields.assign( |
| 76 distinguishing_fields->assign( | |
| 77 kDefaultDistinguishingFields, | 77 kDefaultDistinguishingFields, |
| 78 kDefaultDistinguishingFields + arraysize(kDefaultDistinguishingFields)); | 78 kDefaultDistinguishingFields + arraysize(kDefaultDistinguishingFields)); |
| 79 return; | 79 suggested_fields = &default_fields; |
| 80 if (excluded_field == UNKNOWN_TYPE) { | |
|
Ilya Sherman
2014/08/06 01:28:17
Why might there be an excluded field without a lis
Evan Stade
2014/08/06 17:59:19
Because Android puts the full name on the first li
Evan Stade
2014/08/06 18:00:47
(I'm talking about the preferences UI on desktop a
| |
| 81 distinguishing_fields->swap(default_fields); | |
| 82 return; | |
| 83 } | |
| 80 } | 84 } |
| 81 | 85 |
| 82 // Keep track of which fields we've seen so that we avoid duplicate entries. | 86 // Keep track of which fields we've seen so that we avoid duplicate entries. |
| 83 // Always ignore fields of unknown type and the excluded field. | 87 // Always ignore fields of unknown type and the excluded field. |
| 84 std::set<ServerFieldType> seen_fields; | 88 std::set<ServerFieldType> seen_fields; |
| 85 seen_fields.insert(UNKNOWN_TYPE); | 89 seen_fields.insert(UNKNOWN_TYPE); |
| 86 seen_fields.insert(GetStorableTypeCollapsingNames(excluded_field)); | 90 seen_fields.insert(GetStorableTypeCollapsingNames(excluded_field)); |
| 87 | 91 |
| 88 distinguishing_fields->clear(); | 92 distinguishing_fields->clear(); |
| 89 for (std::vector<ServerFieldType>::const_iterator it = | 93 for (std::vector<ServerFieldType>::const_iterator it = |
| (...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 981 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_SORTING_CODE)) | 985 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_SORTING_CODE)) |
| 982 << " " | 986 << " " |
| 983 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_COUNTRY)) | 987 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_COUNTRY)) |
| 984 << " " | 988 << " " |
| 985 << profile.language_code() | 989 << profile.language_code() |
| 986 << " " | 990 << " " |
| 987 << UTF16ToUTF8(MultiString(profile, PHONE_HOME_WHOLE_NUMBER)); | 991 << UTF16ToUTF8(MultiString(profile, PHONE_HOME_WHOLE_NUMBER)); |
| 988 } | 992 } |
| 989 | 993 |
| 990 } // namespace autofill | 994 } // namespace autofill |
| OLD | NEW |