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

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

Issue 1891903002: [Autofill] Set basic information when adding a new profiles and credit cards. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Further changes to the sync logic Created 4 years, 8 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 <memory> 10 #include <memory>
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 409
410 return 0; 410 return 0;
411 } 411 }
412 412
413 bool AutofillProfile::EqualsSansOrigin(const AutofillProfile& profile) const { 413 bool AutofillProfile::EqualsSansOrigin(const AutofillProfile& profile) const {
414 return guid() == profile.guid() && 414 return guid() == profile.guid() &&
415 language_code() == profile.language_code() && 415 language_code() == profile.language_code() &&
416 Compare(profile) == 0; 416 Compare(profile) == 0;
417 } 417 }
418 418
419 bool AutofillProfile::EqualsForSyncPurposes(const AutofillProfile& profile) 419 bool AutofillProfile::EqualsForSyncPurposes(
Mathieu 2016/04/22 20:54:27 nit: let's revert those lines to previous formatti
sebsg 2016/04/25 15:35:39 Done.
420 const { 420 const AutofillProfile& profile) const {
421 return use_count() == profile.use_count() && 421 return use_count() == profile.use_count() &&
422 use_date() == profile.use_date() && 422 use_date() == profile.use_date() && EqualsSansGuid(profile);
423 EqualsSansGuid(profile);
424 } 423 }
425 424
426 bool AutofillProfile::operator==(const AutofillProfile& profile) const { 425 bool AutofillProfile::operator==(const AutofillProfile& profile) const {
427 return guid() == profile.guid() && EqualsSansGuid(profile); 426 return guid() == profile.guid() && EqualsSansGuid(profile);
428 } 427 }
429 428
430 bool AutofillProfile::operator!=(const AutofillProfile& profile) const { 429 bool AutofillProfile::operator!=(const AutofillProfile& profile) const {
431 return !operator==(profile); 430 return !operator==(profile);
432 } 431 }
433 432
434 const base::string16 AutofillProfile::PrimaryValue() const { 433 const base::string16 AutofillProfile::PrimaryValue() const {
435 return GetRawInfo(ADDRESS_HOME_LINE1) + GetRawInfo(ADDRESS_HOME_CITY); 434 return GetRawInfo(NAME_FIRST) + GetRawInfo(NAME_LAST) +
435 GetRawInfo(ADDRESS_HOME_LINE1) + GetRawInfo(ADDRESS_HOME_CITY);
436 } 436 }
437 437
438 bool AutofillProfile::IsSubsetOf(const AutofillProfile& profile, 438 bool AutofillProfile::IsSubsetOf(const AutofillProfile& profile,
439 const std::string& app_locale) const { 439 const std::string& app_locale) const {
440 ServerFieldTypeSet types; 440 ServerFieldTypeSet types;
441 GetSupportedTypes(&types); 441 GetSupportedTypes(&types);
442 return IsSubsetOfForFieldSet(profile, app_locale, types); 442 return IsSubsetOfForFieldSet(profile, app_locale, types);
443 } 443 }
444 444
445 bool AutofillProfile::IsSubsetOfForFieldSet( 445 bool AutofillProfile::IsSubsetOfForFieldSet(
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
1024 case TRANSACTION: 1024 case TRANSACTION:
1025 return NULL; 1025 return NULL;
1026 } 1026 }
1027 1027
1028 NOTREACHED(); 1028 NOTREACHED();
1029 return NULL; 1029 return NULL;
1030 } 1030 }
1031 1031
1032 bool AutofillProfile::EqualsSansGuid(const AutofillProfile& profile) const { 1032 bool AutofillProfile::EqualsSansGuid(const AutofillProfile& profile) const {
1033 return origin() == profile.origin() && 1033 return origin() == profile.origin() &&
1034 language_code() == profile.language_code() && 1034 language_code() == profile.language_code() && Compare(profile) == 0;
Mathieu 2016/04/22 20:54:27 leave previous formatting?
sebsg 2016/04/25 15:35:39 Done.
1035 Compare(profile) == 0;
1036 } 1035 }
1037 1036
1038 // So we can compare AutofillProfiles with EXPECT_EQ(). 1037 // So we can compare AutofillProfiles with EXPECT_EQ().
1039 std::ostream& operator<<(std::ostream& os, const AutofillProfile& profile) { 1038 std::ostream& operator<<(std::ostream& os, const AutofillProfile& profile) {
1040 return os << profile.guid() << " " << profile.origin() << " " 1039 return os << profile.guid() << " " << profile.origin() << " "
1041 << UTF16ToUTF8(profile.GetRawInfo(NAME_FIRST)) << " " 1040 << UTF16ToUTF8(profile.GetRawInfo(NAME_FIRST)) << " "
1042 << UTF16ToUTF8(profile.GetRawInfo(NAME_MIDDLE)) << " " 1041 << UTF16ToUTF8(profile.GetRawInfo(NAME_MIDDLE)) << " "
1043 << UTF16ToUTF8(profile.GetRawInfo(NAME_LAST)) << " " 1042 << UTF16ToUTF8(profile.GetRawInfo(NAME_LAST)) << " "
1044 << UTF16ToUTF8(profile.GetRawInfo(EMAIL_ADDRESS)) << " " 1043 << UTF16ToUTF8(profile.GetRawInfo(EMAIL_ADDRESS)) << " "
1045 << UTF16ToUTF8(profile.GetRawInfo(COMPANY_NAME)) << " " 1044 << UTF16ToUTF8(profile.GetRawInfo(COMPANY_NAME)) << " "
1046 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_LINE1)) << " " 1045 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_LINE1)) << " "
1047 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_LINE2)) << " " 1046 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_LINE2)) << " "
1048 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_DEPENDENT_LOCALITY)) 1047 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_DEPENDENT_LOCALITY))
1049 << " " << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_CITY)) << " " 1048 << " " << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_CITY)) << " "
1050 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_STATE)) << " " 1049 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_STATE)) << " "
1051 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_ZIP)) << " " 1050 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_ZIP)) << " "
1052 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_SORTING_CODE)) << " " 1051 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_SORTING_CODE)) << " "
1053 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_COUNTRY)) << " " 1052 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_COUNTRY)) << " "
1054 << profile.language_code() << " " 1053 << profile.language_code() << " "
1055 << UTF16ToUTF8(profile.GetRawInfo(PHONE_HOME_WHOLE_NUMBER)); 1054 << UTF16ToUTF8(profile.GetRawInfo(PHONE_HOME_WHOLE_NUMBER));
1056 } 1055 }
1057 1056
1058 } // namespace autofill 1057 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698