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 <memory> | 10 #include <memory> |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
457 !comparator.MergeEmailAddresses(profile, *this, &email) || | 457 !comparator.MergeEmailAddresses(profile, *this, &email) || |
458 !comparator.MergeCompanyNames(profile, *this, &company) || | 458 !comparator.MergeCompanyNames(profile, *this, &company) || |
459 !comparator.MergePhoneNumbers(profile, *this, &phone_number) || | 459 !comparator.MergePhoneNumbers(profile, *this, &phone_number) || |
460 !comparator.MergeAddresses(profile, *this, &address)) { | 460 !comparator.MergeAddresses(profile, *this, &address)) { |
461 NOTREACHED(); | 461 NOTREACHED(); |
462 return false; | 462 return false; |
463 } | 463 } |
464 | 464 |
465 set_origin(profile.origin()); | 465 set_origin(profile.origin()); |
466 set_language_code(profile.language_code()); | 466 set_language_code(profile.language_code()); |
467 set_use_count(profile.use_count() + use_count()); | 467 set_use_count(std::max(profile.use_count(), use_count())); |
Mathieu
2016/07/21 19:16:01
Let's add the rationale for the future reader!
Roger McFarlane (Chromium)
2016/07/22 01:15:25
Done.
| |
468 if (profile.use_date() > use_date()) | 468 set_use_date(std::max(profile.use_date(), use_date())); |
469 set_use_date(profile.use_date()); | |
470 | 469 |
471 // Now that the preferred values have been obtained, update the fields which | 470 // Now that the preferred values have been obtained, update the fields which |
472 // need to be modified, if any. Note: that we're comparing the fields for | 471 // need to be modified, if any. Note: that we're comparing the fields for |
473 // representational equality below (i.e., are the values byte for byte the | 472 // representational equality below (i.e., are the values byte for byte the |
474 // same). | 473 // same). |
475 | 474 |
476 bool modified = false; | 475 bool modified = false; |
477 | 476 |
478 if (name_ != name) { | 477 if (name_ != name) { |
479 name_ = name; | 478 name_ = name; |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
846 << " " << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_CITY)) << " " | 845 << " " << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_CITY)) << " " |
847 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_STATE)) << " " | 846 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_STATE)) << " " |
848 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_ZIP)) << " " | 847 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_ZIP)) << " " |
849 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_SORTING_CODE)) << " " | 848 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_SORTING_CODE)) << " " |
850 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_COUNTRY)) << " " | 849 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_COUNTRY)) << " " |
851 << profile.language_code() << " " | 850 << profile.language_code() << " " |
852 << UTF16ToUTF8(profile.GetRawInfo(PHONE_HOME_WHOLE_NUMBER)); | 851 << UTF16ToUTF8(profile.GetRawInfo(PHONE_HOME_WHOLE_NUMBER)); |
853 } | 852 } |
854 | 853 |
855 } // namespace autofill | 854 } // namespace autofill |
OLD | NEW |