Index: components/autofill/core/browser/personal_data_manager_mac.mm |
diff --git a/components/autofill/core/browser/personal_data_manager_mac.mm b/components/autofill/core/browser/personal_data_manager_mac.mm |
index 42e517f38d1bbccad25c584f49d20facde02fd65..9054a8198292a547c997595fbca89709d2631540 100644 |
--- a/components/autofill/core/browser/personal_data_manager_mac.mm |
+++ b/components/autofill/core/browser/personal_data_manager_mac.mm |
@@ -18,6 +18,7 @@ |
#include "base/prefs/pref_service.h" |
#include "base/strings/stringprintf.h" |
#include "base/strings/sys_string_conversions.h" |
+#include "base/time/time.h" |
#include "components/autofill/core/browser/autofill_country.h" |
#include "components/autofill/core/browser/autofill_profile.h" |
#include "components/autofill/core/browser/autofill_type.h" |
@@ -79,6 +80,7 @@ void RecordAccessSkipped(bool skipped) { |
ABAddressBook* GetAddressBook(PrefService* pref_service) { |
bool first_access = !HasQueriedMacAddressBook(pref_service); |
+ base::Time start_time = base::Time::Now(); |
// +[ABAddressBook sharedAddressBook] throws an exception internally in |
// circumstances that aren't clear. The exceptions are only observed in crash |
// reports, so it is unknown whether they would be caught by AppKit and nil |
@@ -88,6 +90,13 @@ ABAddressBook* GetAddressBook(PrefService* pref_service) { |
^{ return [ABAddressBook sharedAddressBook]; }); |
UMA_HISTOGRAM_BOOLEAN("Autofill.AddressBookAvailable", addressBook != nil); |
+ if (!g_accessed_address_book) { |
+ // The amount of time that the access takes gives a good indication as to |
+ // whether the user was shown a prompt. |
+ UMA_HISTOGRAM_TIMES("Autofill.AddressBook.AccessTime", |
+ base::Time::Now() - start_time); |
+ } |
+ |
if (first_access) { |
UMA_HISTOGRAM_BOOLEAN("Autofill.AddressBookAvailableOnFirstAttempt", |
addressBook != nil); |
@@ -169,8 +178,11 @@ void AuxiliaryProfilesImpl::GetAddressBookMeCard(const std::string& app_locale, |
ABAddressBook* addressBook = GetAddressBook(pref_service); |
ABPerson* me = [addressBook me]; |
- if (!me) |
+ if (!me) { |
+ UMA_HISTOGRAM_BOOLEAN("Autofill.AddressBook.ContainedUsefulInformation", |
Ilya Sherman
2015/05/14 21:46:28
For parallelism with existing histograms, please u
erikchen
2015/05/15 21:04:50
Done.
|
+ false); |
return; |
+ } |
ABMultiValue* addresses = [me valueForProperty:kABAddressProperty]; |
@@ -182,6 +194,10 @@ void AuxiliaryProfilesImpl::GetAddressBookMeCard(const std::string& app_locale, |
const size_t kNumHexDigits = 16; |
const size_t kMaxAddressCount = pow(kNumHexDigits, kNumAddressGUIDChars); |
NSUInteger count = MIN([addresses count], kMaxAddressCount); |
+ |
+ UMA_HISTOGRAM_BOOLEAN("Autofill.AddressBook.ContainedUsefulInformation", |
Ilya Sherman
2015/05/14 21:46:28
I'd prefer not to repeat the string constant, to a
erikchen
2015/05/15 21:04:50
Done.
|
+ count != 0); |
+ |
for (NSUInteger i = 0; i < count; i++) { |
NSDictionary* address = [addresses valueAtIndex:i]; |
NSString* addressLabelRaw = [addresses labelAtIndex:i]; |