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

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

Issue 301343002: mac: Clean up autofill integration with Address Book. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@autofill_cleanup2_base
Patch Set: Address comments from isherman. Created 6 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 8bceedd686b0bc8d9a61a4f6bee5dcdac12f4ca8..ecb996e557a77a1f1b2abea13a64e1ccc40ee3ef 100644
--- a/components/autofill/core/browser/autofill_manager.cc
+++ b/components/autofill/core/browser/autofill_manager.cc
@@ -226,7 +226,33 @@ void AutofillManager::RegisterProfilePrefs(
prefs::kAutofillNegativeUploadRate,
kAutofillNegativeUploadRateDefaultValue,
user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
+
+#if defined(OS_MACOSX) && !defined(OS_IOS)
+ registry->RegisterBooleanPref(
+ prefs::kAutofillUseMacAddressBook,
+ false,
+ user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
+ registry->RegisterBooleanPref(
+ prefs::kAutofillUseMacAddressBookMigration,
Ilya Sherman 2014/06/02 22:54:27 Optional nit: Perhaps something more like "kAutofi
erikchen 2014/06/03 01:34:19 Done.
+ false,
+ user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
+#endif
+}
+
+#if defined(OS_MACOSX) && !defined(OS_IOS)
+void AutofillManager::MigrateUserPrefs(PrefService* prefs) {
+ if (prefs->GetBoolean(prefs::kAutofillUseMacAddressBookMigration))
+ return;
+
+ // Whether Chrome has already tried to access the user's Address Book.
+ bool accessed = prefs->GetBoolean(prefs::kAutofillAuxiliaryProfilesQueried);
+ // Whether the user wants to use the Address Book to populate autofill.
+ bool enabled = prefs->GetBoolean(prefs::kAutofillAuxiliaryProfilesEnabled);
+
+ prefs->SetBoolean(prefs::kAutofillUseMacAddressBook, accessed && enabled);
+ prefs->SetBoolean(prefs::kAutofillUseMacAddressBookMigration, true);
}
+#endif
void AutofillManager::SetExternalDelegate(AutofillExternalDelegate* delegate) {
// TODO(jrg): consider passing delegate into the ctor. That won't

Powered by Google App Engine
This is Rietveld 408576698