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

Unified Diff: components/autofill/core/browser/personal_data_manager_mac.mm

Issue 578383002: mac: Only show the access Address Book prompt a fixed number of times. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@autofill-contacts
Patch Set: Created 6 years, 3 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/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 c6f8eef8b0205bce729cdcf3c88c53aed5e7530b..b457e8b464cf9f7b2f0ae997a7758e3e92f22350 100644
--- a/components/autofill/core/browser/personal_data_manager_mac.mm
+++ b/components/autofill/core/browser/personal_data_manager_mac.mm
@@ -31,6 +31,10 @@
namespace autofill {
namespace {
+// The maximum number of instances when the access Address Book prompt should
+// be shown.
+int kMaxTimesToShowMacAddressBookCount = 5;
Evan Stade 2014/09/18 21:26:37 nit: "Times" and "Count" seem redundant
erikchen 2014/09/18 21:55:57 Changed to kMaxTimesToShowMacAddressBook
+
// There is an uncommon sequence of events that causes the Address Book
// permissions dialog to appear more than once for a given install of Chrome.
// 1. Chrome has previously presented the Address Book permissions dialog.
@@ -374,6 +378,10 @@ bool PersonalDataManager::ShouldShowAccessAddressBookSuggestion(
if (HasPromptedForAccessToAddressBook(pref_service_))
return false;
+ if (pref_service_->GetInteger(prefs::kAutofillMacAddressBookShowedCount) >=
+ kMaxTimesToShowMacAddressBookCount)
Evan Stade 2014/09/18 21:26:37 nit: 4 more indent
erikchen 2014/09/18 21:55:57 Doesn't apply anymore, since conditional fits on a
+ return false;
Evan Stade 2014/09/18 21:26:37 nit: curlies
erikchen 2014/09/18 21:55:57 N/A
+
switch (type.group()) {
case ADDRESS_BILLING:
case ADDRESS_HOME:
@@ -394,6 +402,13 @@ bool PersonalDataManager::ShouldShowAccessAddressBookSuggestion(
return false;
}
+void PersonalDataManager::ShowedAccessAddressBookPrompt() {
+ int count =
+ pref_service_->GetInteger(prefs::kAutofillMacAddressBookShowedCount);
+ pref_service_->SetInteger(prefs::kAutofillMacAddressBookShowedCount,
+ count + 1);
+}
+
void PersonalDataManager::BinaryChanging() {
g_binary_changed = true;
}

Powered by Google App Engine
This is Rietveld 408576698