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

Unified Diff: components/autofill/core/browser/autofill_profile.cc

Issue 2164143002: Use the max use count on autofill profile merge. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/autofill/core/browser/autofill_profile_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/core/browser/autofill_profile.cc
diff --git a/components/autofill/core/browser/autofill_profile.cc b/components/autofill/core/browser/autofill_profile.cc
index 93b155530f28e092b925939028102f906b01b409..58de538a6929bc20aaa9d249b57c621c39d37732 100644
--- a/components/autofill/core/browser/autofill_profile.cc
+++ b/components/autofill/core/browser/autofill_profile.cc
@@ -464,9 +464,8 @@ bool AutofillProfile::MergeDataFrom(const AutofillProfile& profile,
set_origin(profile.origin());
set_language_code(profile.language_code());
- set_use_count(profile.use_count() + use_count());
- if (profile.use_date() > use_date())
- set_use_date(profile.use_date());
+ 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.
+ set_use_date(std::max(profile.use_date(), use_date()));
// Now that the preferred values have been obtained, update the fields which
// need to be modified, if any. Note: that we're comparing the fields for
« no previous file with comments | « no previous file | components/autofill/core/browser/autofill_profile_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698