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

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: 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 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 name_ = imported_name; 513 name_ = imported_name;
514 return true; 514 return true;
515 } 515 }
516 516
517 bool AutofillProfile::OverwriteWith(const AutofillProfile& profile, 517 bool AutofillProfile::OverwriteWith(const AutofillProfile& profile,
518 const std::string& app_locale) { 518 const std::string& app_locale) {
519 // Verified profiles should never be overwritten with unverified data. 519 // Verified profiles should never be overwritten with unverified data.
520 DCHECK(!IsVerified() || profile.IsVerified()); 520 DCHECK(!IsVerified() || profile.IsVerified());
521 set_origin(profile.origin()); 521 set_origin(profile.origin());
522 set_language_code(profile.language_code()); 522 set_language_code(profile.language_code());
523 set_use_count(profile.use_count() + use_count()); 523 if (profile.use_count() > use_count())
Mathieu 2016/04/19 14:29:35 as discussed, let's keep the + here.
sebsg 2016/04/20 20:25:46 Done.
524 set_use_count(profile.use_count());
524 if (profile.use_date() > use_date()) 525 if (profile.use_date() > use_date())
525 set_use_date(profile.use_date()); 526 set_use_date(profile.use_date());
526 527
527 ServerFieldTypeSet field_types; 528 ServerFieldTypeSet field_types;
528 profile.GetNonEmptyTypes(app_locale, &field_types); 529 profile.GetNonEmptyTypes(app_locale, &field_types);
529 530
530 // Only transfer "full" types (e.g. full name) and not fragments (e.g. 531 // Only transfer "full" types (e.g. full name) and not fragments (e.g.
531 // first name, last name). 532 // first name, last name).
532 CollapseCompoundFieldTypes(&field_types); 533 CollapseCompoundFieldTypes(&field_types);
533 534
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
1049 << " " << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_CITY)) << " " 1050 << " " << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_CITY)) << " "
1050 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_STATE)) << " " 1051 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_STATE)) << " "
1051 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_ZIP)) << " " 1052 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_ZIP)) << " "
1052 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_SORTING_CODE)) << " " 1053 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_SORTING_CODE)) << " "
1053 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_COUNTRY)) << " " 1054 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_COUNTRY)) << " "
1054 << profile.language_code() << " " 1055 << profile.language_code() << " "
1055 << UTF16ToUTF8(profile.GetRawInfo(PHONE_HOME_WHOLE_NUMBER)); 1056 << UTF16ToUTF8(profile.GetRawInfo(PHONE_HOME_WHOLE_NUMBER));
1056 } 1057 }
1057 1058
1058 } // namespace autofill 1059 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698