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

Side by Side 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, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/autofill/core/browser/autofill_manager.h" 5 #include "components/autofill/core/browser/autofill_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <limits> 9 #include <limits>
10 #include <map> 10 #include <map>
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 #if defined(OS_MACOSX) || defined(OS_ANDROID) 204 #if defined(OS_MACOSX) || defined(OS_ANDROID)
205 registry->RegisterBooleanPref( 205 registry->RegisterBooleanPref(
206 prefs::kAutofillAuxiliaryProfilesEnabled, 206 prefs::kAutofillAuxiliaryProfilesEnabled,
207 true, 207 true,
208 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); 208 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
209 #else // defined(OS_MACOSX) || defined(OS_ANDROID) 209 #else // defined(OS_MACOSX) || defined(OS_ANDROID)
210 registry->RegisterBooleanPref( 210 registry->RegisterBooleanPref(
211 prefs::kAutofillAuxiliaryProfilesEnabled, 211 prefs::kAutofillAuxiliaryProfilesEnabled,
212 false, 212 false,
213 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 213 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
214 #endif // defined(OS_MACOSX) || defined(OS_ANDROID) 214 #endif // defined(OS_MACOSX) || defined(OS_ANDROID)
Ilya Sherman 2014/06/02 22:54:27 This is only needed on Android now, right? It's p
erikchen 2014/06/03 01:34:19 Done. I've kept the OS_MACOSX preprocessor conditi
215 #if defined(OS_MACOSX) 215 #if defined(OS_MACOSX)
216 registry->RegisterBooleanPref( 216 registry->RegisterBooleanPref(
217 prefs::kAutofillAuxiliaryProfilesQueried, 217 prefs::kAutofillAuxiliaryProfilesQueried,
Ilya Sherman 2014/06/02 22:54:27 nit: It's probably worth renaming this pref to mat
erikchen 2014/06/03 01:34:19 Done.
218 false, 218 false,
219 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 219 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
220 #endif // defined(OS_MACOSX) 220 #endif // defined(OS_MACOSX)
221 registry->RegisterDoublePref( 221 registry->RegisterDoublePref(
222 prefs::kAutofillPositiveUploadRate, 222 prefs::kAutofillPositiveUploadRate,
223 kAutofillPositiveUploadRateDefaultValue, 223 kAutofillPositiveUploadRateDefaultValue,
224 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 224 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
225 registry->RegisterDoublePref( 225 registry->RegisterDoublePref(
226 prefs::kAutofillNegativeUploadRate, 226 prefs::kAutofillNegativeUploadRate,
227 kAutofillNegativeUploadRateDefaultValue, 227 kAutofillNegativeUploadRateDefaultValue,
228 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 228 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
229
230 #if defined(OS_MACOSX) && !defined(OS_IOS)
231 registry->RegisterBooleanPref(
232 prefs::kAutofillUseMacAddressBook,
233 false,
234 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
235 registry->RegisterBooleanPref(
236 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.
237 false,
238 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
239 #endif
229 } 240 }
230 241
242 #if defined(OS_MACOSX) && !defined(OS_IOS)
243 void AutofillManager::MigrateUserPrefs(PrefService* prefs) {
244 if (prefs->GetBoolean(prefs::kAutofillUseMacAddressBookMigration))
245 return;
246
247 // Whether Chrome has already tried to access the user's Address Book.
248 bool accessed = prefs->GetBoolean(prefs::kAutofillAuxiliaryProfilesQueried);
249 // Whether the user wants to use the Address Book to populate autofill.
250 bool enabled = prefs->GetBoolean(prefs::kAutofillAuxiliaryProfilesEnabled);
251
252 prefs->SetBoolean(prefs::kAutofillUseMacAddressBook, accessed && enabled);
253 prefs->SetBoolean(prefs::kAutofillUseMacAddressBookMigration, true);
254 }
255 #endif
256
231 void AutofillManager::SetExternalDelegate(AutofillExternalDelegate* delegate) { 257 void AutofillManager::SetExternalDelegate(AutofillExternalDelegate* delegate) {
232 // TODO(jrg): consider passing delegate into the ctor. That won't 258 // TODO(jrg): consider passing delegate into the ctor. That won't
233 // work if the delegate has a pointer to the AutofillManager, but 259 // work if the delegate has a pointer to the AutofillManager, but
234 // future directions may not need such a pointer. 260 // future directions may not need such a pointer.
235 external_delegate_ = delegate; 261 external_delegate_ = delegate;
236 autocomplete_history_manager_->SetExternalDelegate(delegate); 262 autocomplete_history_manager_->SetExternalDelegate(delegate);
237 } 263 }
238 264
239 void AutofillManager::ShowAutofillSettings() { 265 void AutofillManager::ShowAutofillSettings() {
240 manager_delegate_->ShowAutofillSettings(); 266 manager_delegate_->ShowAutofillSettings();
(...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after
1160 return false; 1186 return false;
1161 1187
1162 // Disregard forms that we wouldn't ever autofill in the first place. 1188 // Disregard forms that we wouldn't ever autofill in the first place.
1163 if (!form.ShouldBeParsed(true)) 1189 if (!form.ShouldBeParsed(true))
1164 return false; 1190 return false;
1165 1191
1166 return true; 1192 return true;
1167 } 1193 }
1168 1194
1169 } // namespace autofill 1195 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698