| OLD | NEW |
| 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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 registry->RegisterDoublePref( | 223 registry->RegisterDoublePref( |
| 224 prefs::kAutofillNegativeUploadRate, | 224 prefs::kAutofillNegativeUploadRate, |
| 225 kAutofillNegativeUploadRateDefaultValue, | 225 kAutofillNegativeUploadRateDefaultValue, |
| 226 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 226 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 227 | 227 |
| 228 #if defined(OS_MACOSX) && !defined(OS_IOS) | 228 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 229 registry->RegisterBooleanPref( | 229 registry->RegisterBooleanPref( |
| 230 prefs::kAutofillUseMacAddressBook, | 230 prefs::kAutofillUseMacAddressBook, |
| 231 false, | 231 false, |
| 232 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 232 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 233 registry->RegisterIntegerPref( |
| 234 prefs::kAutofillMacAddressBookShowedCount, |
| 235 0, |
| 236 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 233 #endif // defined(OS_MACOSX) && !defined(OS_IOS) | 237 #endif // defined(OS_MACOSX) && !defined(OS_IOS) |
| 234 } | 238 } |
| 235 | 239 |
| 236 #if defined(OS_MACOSX) && !defined(OS_IOS) | 240 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 237 void AutofillManager::MigrateUserPrefs(PrefService* prefs) { | 241 void AutofillManager::MigrateUserPrefs(PrefService* prefs) { |
| 238 const PrefService::Preference* pref = | 242 const PrefService::Preference* pref = |
| 239 prefs->FindPreference(prefs::kAutofillUseMacAddressBook); | 243 prefs->FindPreference(prefs::kAutofillUseMacAddressBook); |
| 240 | 244 |
| 241 // If the pref is not its default value, then the migration has already been | 245 // If the pref is not its default value, then the migration has already been |
| 242 // performed. | 246 // performed. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 | 302 |
| 299 return personal_data_->ShouldShowAccessAddressBookSuggestion( | 303 return personal_data_->ShouldShowAccessAddressBookSuggestion( |
| 300 autofill_field->Type()); | 304 autofill_field->Type()); |
| 301 } | 305 } |
| 302 | 306 |
| 303 bool AutofillManager::AccessAddressBook() { | 307 bool AutofillManager::AccessAddressBook() { |
| 304 if (!personal_data_) | 308 if (!personal_data_) |
| 305 return false; | 309 return false; |
| 306 return personal_data_->AccessAddressBook(); | 310 return personal_data_->AccessAddressBook(); |
| 307 } | 311 } |
| 312 |
| 313 void AutofillManager::ShowedAccessAddressBookPrompt() { |
| 314 if (!personal_data_) |
| 315 return; |
| 316 return personal_data_->ShowedAccessAddressBookPrompt(); |
| 317 } |
| 308 #endif // defined(OS_MACOSX) && !defined(OS_IOS) | 318 #endif // defined(OS_MACOSX) && !defined(OS_IOS) |
| 309 | 319 |
| 310 bool AutofillManager::OnFormSubmitted(const FormData& form, | 320 bool AutofillManager::OnFormSubmitted(const FormData& form, |
| 311 const TimeTicks& timestamp) { | 321 const TimeTicks& timestamp) { |
| 312 if (!IsValidFormData(form)) | 322 if (!IsValidFormData(form)) |
| 313 return false; | 323 return false; |
| 314 | 324 |
| 315 // Let Autocomplete know as well. | 325 // Let Autocomplete know as well. |
| 316 autocomplete_history_manager_->OnFormSubmitted(form); | 326 autocomplete_history_manager_->OnFormSubmitted(form); |
| 317 | 327 |
| (...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1223 return false; | 1233 return false; |
| 1224 | 1234 |
| 1225 // Disregard forms that we wouldn't ever autofill in the first place. | 1235 // Disregard forms that we wouldn't ever autofill in the first place. |
| 1226 if (!form.ShouldBeParsed()) | 1236 if (!form.ShouldBeParsed()) |
| 1227 return false; | 1237 return false; |
| 1228 | 1238 |
| 1229 return true; | 1239 return true; |
| 1230 } | 1240 } |
| 1231 | 1241 |
| 1232 } // namespace autofill | 1242 } // namespace autofill |
| OLD | NEW |