Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Side by Side Diff: components/autofill/core/browser/autofill_profile.cc

Issue 440283002: Android: Get AutofillProfile summary labels from PersonalDataManagerAndroid (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: after early return Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 if (excluded_field == UNKNOWN_TYPE) {
80 distinguishing_fields->swap(default_fields);
81 return;
82 }
83 suggested_fields = &default_fields;
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698