Index: components/autofill/core/browser/autofill_external_delegate.cc |
diff --git a/components/autofill/core/browser/autofill_external_delegate.cc b/components/autofill/core/browser/autofill_external_delegate.cc |
index b8e4a066ec1ac94a3cf072cae6b38c8297e964e1..b450668b2bc626ad7575e61b76b8c23b48170a70 100644 |
--- a/components/autofill/core/browser/autofill_external_delegate.cc |
+++ b/components/autofill/core/browser/autofill_external_delegate.cc |
@@ -5,6 +5,7 @@ |
#include "components/autofill/core/browser/autofill_external_delegate.h" |
#include "base/message_loop/message_loop.h" |
+#include "base/metrics/histogram.h" |
#include "base/strings/utf_string_conversions.h" |
#include "components/autofill/core/browser/autocomplete_history_manager.h" |
#include "components/autofill/core/browser/autofill_driver.h" |
@@ -13,6 +14,25 @@ |
#include "grit/components_strings.h" |
#include "ui/base/l10n/l10n_util.h" |
+#if defined(OS_MACOSX) && !defined(OS_IOS) |
+namespace { |
+ |
+enum AccessAddressBookEventType { |
+ // An autofill entry was shown that prompts the user to give Chrome access to |
Ilya Sherman
2014/06/02 22:54:27
nit: "autofill" -> "Autofill"
erikchen
2014/06/03 01:34:19
I've gone through the CL and replaced all instance
|
+ // the user's Address Book. |
+ SHOWED_ACCESS_AB_ENTRY = 0, |
Ilya Sherman
2014/06/02 22:54:27
nit: "AB" -> "ADDRESS_BOOK"
erikchen
2014/06/03 01:34:19
Done.
|
+ |
+ // The user selected the autofill entry which prompts Chrome to access the |
+ // user's Address Book. |
+ SELECTED_ACCESS_AB_ENTRY, |
+ |
+ // Always keep this at the end. |
+ ACCESS_AB_ENTRY_MAX, |
+}; |
+ |
+} // namespace |
+#endif |
+ |
namespace autofill { |
AutofillExternalDelegate::AutofillExternalDelegate(AutofillManager* manager, |
@@ -98,8 +118,12 @@ void AutofillExternalDelegate::OnSuggestionsReturned( |
values.push_back( |
l10n_util::GetStringUTF16(IDS_AUTOFILL_ACCESS_MAC_CONTACTS)); |
labels.push_back(base::string16()); |
- icons.push_back(base::string16()); |
+ icons.push_back(base::ASCIIToUTF16("macContactsIcon")); |
ids.push_back(POPUP_ITEM_ID_MAC_ACCESS_CONTACTS); |
+ |
+ UMA_HISTOGRAM_ENUMERATION("Autofill.MacAccessAddressBook", |
Ilya Sherman
2014/06/02 22:54:27
Optional nit: I'd drop "Access" from the histogram
erikchen
2014/06/03 01:34:19
Done.
|
+ SHOWED_ACCESS_AB_ENTRY, |
+ ACCESS_AB_ENTRY_MAX); |
Ilya Sherman
2014/06/02 22:54:27
nit: Please define a wrapper function for emitting
erikchen
2014/06/03 01:34:19
Done.
|
} |
#endif |
@@ -171,6 +195,10 @@ void AutofillExternalDelegate::DidAcceptSuggestion(const base::string16& value, |
driver_->RendererShouldFillFieldWithValue(value); |
} else if (identifier == POPUP_ITEM_ID_MAC_ACCESS_CONTACTS) { |
#if defined(OS_MACOSX) && !defined(OS_IOS) |
+ UMA_HISTOGRAM_ENUMERATION("Autofill.MacAccessAddressBook", |
+ SELECTED_ACCESS_AB_ENTRY, |
+ ACCESS_AB_ENTRY_MAX); |
+ |
// User wants to give Chrome access to user's address book. |
manager_->AccessAddressBook(); |