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

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

Issue 1130773004: mac: Add histograms to measure impact of Address Book integration. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments from isherman, round four. Created 5 years, 7 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
Index: components/autofill/core/browser/autofill_manager.cc
diff --git a/components/autofill/core/browser/autofill_manager.cc b/components/autofill/core/browser/autofill_manager.cc
index 5df3ca14bda7fa0fee2dde5a92456f091613c803..3bf5af92ad5f3b1f1bb8ded786b5377d56401523 100644
--- a/components/autofill/core/browser/autofill_manager.cc
+++ b/components/autofill/core/browser/autofill_manager.cc
@@ -17,6 +17,7 @@
#include "base/logging.h"
#include "base/message_loop/message_loop.h"
#include "base/metrics/field_trial.h"
+#include "base/metrics/histogram_macros.h"
#include "base/prefs/pref_service.h"
#include "base/strings/string16.h"
#include "base/strings/string_util.h"
@@ -616,6 +617,10 @@ void AutofillManager::FillOrPreviewForm(
const FormData& form,
const FormFieldData& field,
int unique_id) {
+#if defined(OS_MACOSX) && !defined(OS_IOS)
+ EmitIsFromAddressBookMetric(unique_id);
+#endif // defined(OS_MACOSX) && !defined(OS_IOS)
+
if (!IsValidFormData(form) || !IsValidFormFieldData(field))
return;
@@ -1517,4 +1522,20 @@ bool AutofillManager::ShouldUploadForm(const FormStructure& form) {
return true;
}
+#if defined(OS_MACOSX) && !defined(OS_IOS)
+void AutofillManager::EmitIsFromAddressBookMetric(int unique_id) {
+ size_t variant = 0;
+ const AutofillProfile* profile = nullptr;
+ bool result = GetProfile(unique_id, &profile, &variant);
+ if (!result)
+ return;
+
+ bool is_from_address_book =
+ profile->record_type() == AutofillProfile::AUXILIARY_PROFILE;
+ UMA_HISTOGRAM_BOOLEAN(
+ "Autofill.MacAddressBook.AcceptedSuggestionIsFromAddressBook",
+ is_from_address_book);
+}
+#endif // defined(OS_MACOSX) && !defined(OS_IOS)
+
} // namespace autofill

Powered by Google App Engine
This is Rietveld 408576698