| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/autofill/autofill_manager.h" | 5 #include "chrome/browser/autofill/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 21 matching lines...) Expand all Loading... |
| 32 #include "chrome/browser/autofill/autofill_metrics.h" | 32 #include "chrome/browser/autofill/autofill_metrics.h" |
| 33 #include "chrome/browser/autofill/autofill_profile.h" | 33 #include "chrome/browser/autofill/autofill_profile.h" |
| 34 #include "chrome/browser/autofill/autofill_type.h" | 34 #include "chrome/browser/autofill/autofill_type.h" |
| 35 #include "chrome/browser/autofill/credit_card.h" | 35 #include "chrome/browser/autofill/credit_card.h" |
| 36 #include "chrome/browser/autofill/form_structure.h" | 36 #include "chrome/browser/autofill/form_structure.h" |
| 37 #include "chrome/browser/autofill/password_generator.h" | 37 #include "chrome/browser/autofill/password_generator.h" |
| 38 #include "chrome/browser/autofill/personal_data_manager.h" | 38 #include "chrome/browser/autofill/personal_data_manager.h" |
| 39 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 39 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
| 40 #include "chrome/browser/autofill/phone_number.h" | 40 #include "chrome/browser/autofill/phone_number.h" |
| 41 #include "chrome/browser/autofill/phone_number_i18n.h" | 41 #include "chrome/browser/autofill/phone_number_i18n.h" |
| 42 #include "chrome/browser/prefs/pref_service.h" |
| 42 #include "chrome/browser/ui/autofill/autofill_dialog_controller.h" | 43 #include "chrome/browser/ui/autofill/autofill_dialog_controller.h" |
| 43 #include "chrome/common/autofill_messages.h" | 44 #include "chrome/common/autofill_messages.h" |
| 44 #include "chrome/common/chrome_notification_types.h" | 45 #include "chrome/common/chrome_notification_types.h" |
| 45 #include "chrome/common/chrome_switches.h" | 46 #include "chrome/common/chrome_switches.h" |
| 46 #include "chrome/common/form_data.h" | 47 #include "chrome/common/form_data.h" |
| 47 #include "chrome/common/form_data_predictions.h" | 48 #include "chrome/common/form_data_predictions.h" |
| 48 #include "chrome/common/form_field_data.h" | 49 #include "chrome/common/form_field_data.h" |
| 49 #include "chrome/common/password_form_fill_data.h" | 50 #include "chrome/common/password_form_fill_data.h" |
| 50 #include "chrome/common/pref_names.h" | 51 #include "chrome/common/pref_names.h" |
| 51 #include "chrome/common/url_constants.h" | 52 #include "chrome/common/url_constants.h" |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 registrar_.Add( | 219 registrar_.Add( |
| 219 prefs::kPasswordGenerationEnabled, | 220 prefs::kPasswordGenerationEnabled, |
| 220 base::Bind(&AutofillManager::OnPasswordGenerationEnabledChanged, | 221 base::Bind(&AutofillManager::OnPasswordGenerationEnabledChanged, |
| 221 base::Unretained(this))); | 222 base::Unretained(this))); |
| 222 } | 223 } |
| 223 | 224 |
| 224 AutofillManager::~AutofillManager() { | 225 AutofillManager::~AutofillManager() { |
| 225 } | 226 } |
| 226 | 227 |
| 227 // static | 228 // static |
| 228 void AutofillManager::RegisterUserPrefs(PrefServiceBase* prefs) { | 229 void AutofillManager::RegisterUserPrefs(PrefServiceSyncable* prefs) { |
| 229 prefs->RegisterBooleanPref(prefs::kAutofillEnabled, | 230 prefs->RegisterBooleanPref(prefs::kAutofillEnabled, |
| 230 true, | 231 true, |
| 231 PrefServiceBase::SYNCABLE_PREF); | 232 PrefServiceSyncable::SYNCABLE_PREF); |
| 232 prefs->RegisterBooleanPref(prefs::kPasswordGenerationEnabled, | 233 prefs->RegisterBooleanPref(prefs::kPasswordGenerationEnabled, |
| 233 true, | 234 true, |
| 234 PrefServiceBase::SYNCABLE_PREF); | 235 PrefServiceSyncable::SYNCABLE_PREF); |
| 235 #if defined(OS_MACOSX) | 236 #if defined(OS_MACOSX) |
| 236 prefs->RegisterBooleanPref(prefs::kAutofillAuxiliaryProfilesEnabled, | 237 prefs->RegisterBooleanPref(prefs::kAutofillAuxiliaryProfilesEnabled, |
| 237 true, | 238 true, |
| 238 PrefServiceBase::SYNCABLE_PREF); | 239 PrefServiceSyncable::SYNCABLE_PREF); |
| 239 #else | 240 #else |
| 240 prefs->RegisterBooleanPref(prefs::kAutofillAuxiliaryProfilesEnabled, | 241 prefs->RegisterBooleanPref(prefs::kAutofillAuxiliaryProfilesEnabled, |
| 241 false, | 242 false, |
| 242 PrefServiceBase::UNSYNCABLE_PREF); | 243 PrefServiceSyncable::UNSYNCABLE_PREF); |
| 243 #endif | 244 #endif |
| 244 prefs->RegisterDoublePref(prefs::kAutofillPositiveUploadRate, | 245 prefs->RegisterDoublePref(prefs::kAutofillPositiveUploadRate, |
| 245 kAutofillPositiveUploadRateDefaultValue, | 246 kAutofillPositiveUploadRateDefaultValue, |
| 246 PrefServiceBase::UNSYNCABLE_PREF); | 247 PrefServiceSyncable::UNSYNCABLE_PREF); |
| 247 prefs->RegisterDoublePref(prefs::kAutofillNegativeUploadRate, | 248 prefs->RegisterDoublePref(prefs::kAutofillNegativeUploadRate, |
| 248 kAutofillNegativeUploadRateDefaultValue, | 249 kAutofillNegativeUploadRateDefaultValue, |
| 249 PrefServiceBase::UNSYNCABLE_PREF); | 250 PrefServiceSyncable::UNSYNCABLE_PREF); |
| 250 } | 251 } |
| 251 | 252 |
| 252 void AutofillManager::RegisterWithSyncService() { | 253 void AutofillManager::RegisterWithSyncService() { |
| 253 ProfileSyncServiceBase* service = manager_delegate_->GetProfileSyncService(); | 254 ProfileSyncServiceBase* service = manager_delegate_->GetProfileSyncService(); |
| 254 if (service) | 255 if (service) |
| 255 service->AddObserver(this); | 256 service->AddObserver(this); |
| 256 } | 257 } |
| 257 | 258 |
| 258 void AutofillManager::SendPasswordGenerationStateToRenderer( | 259 void AutofillManager::SendPasswordGenerationStateToRenderer( |
| 259 content::RenderViewHost* host, bool enabled) { | 260 content::RenderViewHost* host, bool enabled) { |
| (...skipping 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1280 *profile_guid = IDToGUID(profile_id); | 1281 *profile_guid = IDToGUID(profile_id); |
| 1281 } | 1282 } |
| 1282 | 1283 |
| 1283 void AutofillManager::UpdateInitialInteractionTimestamp( | 1284 void AutofillManager::UpdateInitialInteractionTimestamp( |
| 1284 const TimeTicks& interaction_timestamp) { | 1285 const TimeTicks& interaction_timestamp) { |
| 1285 if (initial_interaction_timestamp_.is_null() || | 1286 if (initial_interaction_timestamp_.is_null() || |
| 1286 interaction_timestamp < initial_interaction_timestamp_) { | 1287 interaction_timestamp < initial_interaction_timestamp_) { |
| 1287 initial_interaction_timestamp_ = interaction_timestamp; | 1288 initial_interaction_timestamp_ = interaction_timestamp; |
| 1288 } | 1289 } |
| 1289 } | 1290 } |
| OLD | NEW |