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 06a3878689035c98781c432a71e356c2b53d272a..33ac00b341ac5d20377c2d2e6c2eff75ad352634 100644 |
--- a/components/autofill/core/browser/autofill_profile.cc |
+++ b/components/autofill/core/browser/autofill_profile.cc |
@@ -23,6 +23,7 @@ |
#include "components/autofill/core/browser/address_i18n.h" |
#include "components/autofill/core/browser/autofill_country.h" |
#include "components/autofill/core/browser/autofill_field.h" |
+#include "components/autofill/core/browser/autofill_metrics.h" |
#include "components/autofill/core/browser/autofill_type.h" |
#include "components/autofill/core/browser/contact_info.h" |
#include "components/autofill/core/browser/phone_number.h" |
@@ -509,7 +510,7 @@ void AutofillProfile::OverwriteName(const NameInfo& imported_name, |
name_ = imported_name; |
} |
-void AutofillProfile::OverwriteWith(const AutofillProfile& profile, |
+bool AutofillProfile::OverwriteWith(const AutofillProfile& profile, |
const std::string& app_locale) { |
// Verified profiles should never be overwritten with unverified data. |
DCHECK(!IsVerified() || profile.IsVerified()); |
@@ -545,6 +546,8 @@ void AutofillProfile::OverwriteWith(const AutofillProfile& profile, |
field_types.erase(ADDRESS_HOME_LINE2); |
} |
+ bool did_overwrite = false; |
+ |
for (ServerFieldTypeSet::const_iterator iter = field_types.begin(); |
iter != field_types.end(); ++iter) { |
FieldTypeGroup group = AutofillType(*iter).group(); |
@@ -555,9 +558,13 @@ void AutofillProfile::OverwriteWith(const AutofillProfile& profile, |
} |
base::string16 new_value = profile.GetRawInfo(*iter); |
- if (!compare.StringsEqual(GetRawInfo(*iter), new_value)) |
+ if (!compare.StringsEqual(GetRawInfo(*iter), new_value)) { |
SetRawInfo(*iter, new_value); |
+ did_overwrite = true; |
+ } |
} |
+ |
+ return did_overwrite; |
} |
bool AutofillProfile::SaveAdditionalInfo(const AutofillProfile& profile, |
@@ -613,8 +620,15 @@ bool AutofillProfile::SaveAdditionalInfo(const AutofillProfile& profile, |
} |
} |
- if (!IsVerified() || profile.IsVerified()) |
- OverwriteWith(profile, app_locale); |
+ if (!IsVerified() || profile.IsVerified()) { |
+ if (OverwriteWith(profile, app_locale)) { |
+ AutofillMetrics::LogProfileActionOnFormSubmitted( |
+ AutofillMetrics::EXISTING_PROFILE_UPDATED); |
+ } else { |
+ AutofillMetrics::LogProfileActionOnFormSubmitted( |
+ AutofillMetrics::EXISTING_PROFILE_USED); |
+ } |
+ } |
return true; |
} |