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

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: Fix a cross-platform problem. 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..eb6a4b7af9f7f74e3ee2c0dd7bc5cd92d2d99446 100644
--- a/components/autofill/core/browser/autofill_manager.cc
+++ b/components/autofill/core/browser/autofill_manager.cc
@@ -203,18 +203,18 @@ void AutofillManager::RegisterProfilePrefs(
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
#if defined(OS_MACOSX) || defined(OS_ANDROID)
registry->RegisterBooleanPref(
- prefs::kAutofillAuxiliaryProfilesEnabled,
+ prefs::kAutofillAndroidAuxiliaryProfilesEnabled,
true,
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
#else // defined(OS_MACOSX) || defined(OS_ANDROID)
registry->RegisterBooleanPref(
- prefs::kAutofillAuxiliaryProfilesEnabled,
+ prefs::kAutofillAndroidAuxiliaryProfilesEnabled,
false,
user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
#endif // defined(OS_MACOSX) || defined(OS_ANDROID)
#if defined(OS_MACOSX)
registry->RegisterBooleanPref(
- prefs::kAutofillAuxiliaryProfilesQueried,
+ prefs::kAutofillMacAddressBookQueried,
false,
user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
#endif // defined(OS_MACOSX)
@@ -226,7 +226,34 @@ 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::kAutofillHasMigratedUseMacAddressBookPref,
+ false,
+ user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
+#endif
+}
+
+#if defined(OS_MACOSX) && !defined(OS_IOS)
+void AutofillManager::MigrateUserPrefs(PrefService* prefs) {
+ if (prefs->GetBoolean(prefs::kAutofillHasMigratedUseMacAddressBookPref))
Ilya Sherman 2014/06/03 23:48:59 It looks like the PrefService exports a method nam
erikchen 2014/06/04 01:51:25 Yes. I've done so.
+ return;
+
+ // Whether Chrome has already tried to access the user's Address Book.
+ bool accessed = prefs->GetBoolean(prefs::kAutofillMacAddressBookQueried);
+ // Whether the user wants to use the Address Book to populate Autofill.
+ bool enabled =
+ prefs->GetBoolean(prefs::kAutofillAndroidAuxiliaryProfilesEnabled);
Ilya Sherman 2014/06/03 23:48:59 Hmm, this looks really odd. It makes me think tha
erikchen 2014/06/04 01:51:25 I reverted to the previous name.
+
+ prefs->SetBoolean(prefs::kAutofillUseMacAddressBook, accessed && enabled);
+ prefs->SetBoolean(prefs::kAutofillHasMigratedUseMacAddressBookPref, 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