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> |
11 #include <set> | 11 #include <set> |
12 #include <utility> | 12 #include <utility> |
13 | 13 |
14 #include "base/bind.h" | 14 #include "base/bind.h" |
15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
16 #include "base/guid.h" | 16 #include "base/guid.h" |
17 #include "base/logging.h" | 17 #include "base/logging.h" |
18 #include "base/prefs/public/pref_service_base.h" | 18 #include "base/prefs/public/pref_service_base.h" |
19 #include "base/string16.h" | 19 #include "base/string16.h" |
20 #include "base/string_util.h" | 20 #include "base/string_util.h" |
21 #include "base/supports_user_data.h" | 21 #include "base/supports_user_data.h" |
22 #include "base/threading/sequenced_worker_pool.h" | 22 #include "base/threading/sequenced_worker_pool.h" |
23 #include "base/utf_string_conversions.h" | 23 #include "base/utf_string_conversions.h" |
24 #include "chrome/browser/api/infobars/infobar_service.h" | 24 #include "chrome/browser/api/infobars/infobar_service.h" |
25 #include "chrome/browser/api/sync/profile_sync_service_base.h" | 25 #include "chrome/browser/api/sync/profile_sync_service_base.h" |
| 26 #include "chrome/browser/autofill/autocheckout_infobar_delegate.h" |
26 #include "chrome/browser/autofill/autocheckout_manager.h" | 27 #include "chrome/browser/autofill/autocheckout_manager.h" |
27 #include "chrome/browser/autofill/autocheckout_infobar_delegate.h" | |
28 #include "chrome/browser/autofill/autocomplete_history_manager.h" | 28 #include "chrome/browser/autofill/autocomplete_history_manager.h" |
29 #include "chrome/browser/autofill/autofill_cc_infobar_delegate.h" | 29 #include "chrome/browser/autofill/autofill_cc_infobar_delegate.h" |
30 #include "chrome/browser/autofill/autofill_country.h" | 30 #include "chrome/browser/autofill/autofill_country.h" |
31 #include "chrome/browser/autofill/autofill_external_delegate.h" | 31 #include "chrome/browser/autofill/autofill_external_delegate.h" |
32 #include "chrome/browser/autofill/autofill_field.h" | 32 #include "chrome/browser/autofill/autofill_field.h" |
33 #include "chrome/browser/autofill/autofill_manager_delegate.h" | 33 #include "chrome/browser/autofill/autofill_manager_delegate.h" |
34 #include "chrome/browser/autofill/autofill_metrics.h" | 34 #include "chrome/browser/autofill/autofill_metrics.h" |
35 #include "chrome/browser/autofill/autofill_profile.h" | 35 #include "chrome/browser/autofill/autofill_profile.h" |
36 #include "chrome/browser/autofill/autofill_type.h" | 36 #include "chrome/browser/autofill/autofill_type.h" |
37 #include "chrome/browser/autofill/credit_card.h" | 37 #include "chrome/browser/autofill/credit_card.h" |
38 #include "chrome/browser/autofill/form_structure.h" | 38 #include "chrome/browser/autofill/form_structure.h" |
39 #include "chrome/browser/autofill/password_generator.h" | 39 #include "chrome/browser/autofill/password_generator.h" |
40 #include "chrome/browser/autofill/personal_data_manager.h" | 40 #include "chrome/browser/autofill/personal_data_manager.h" |
41 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 41 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
42 #include "chrome/browser/autofill/phone_number.h" | 42 #include "chrome/browser/autofill/phone_number.h" |
43 #include "chrome/browser/autofill/phone_number_i18n.h" | 43 #include "chrome/browser/autofill/phone_number_i18n.h" |
| 44 #include "chrome/browser/prefs/pref_registry_syncable.h" |
44 #include "chrome/browser/prefs/pref_service.h" | 45 #include "chrome/browser/prefs/pref_service.h" |
45 #include "chrome/common/autofill_messages.h" | 46 #include "chrome/common/autofill_messages.h" |
46 #include "chrome/common/chrome_notification_types.h" | 47 #include "chrome/common/chrome_notification_types.h" |
47 #include "chrome/common/chrome_switches.h" | 48 #include "chrome/common/chrome_switches.h" |
48 #include "chrome/common/form_data.h" | 49 #include "chrome/common/form_data.h" |
49 #include "chrome/common/form_data_predictions.h" | 50 #include "chrome/common/form_data_predictions.h" |
50 #include "chrome/common/form_field_data.h" | 51 #include "chrome/common/form_field_data.h" |
51 #include "chrome/common/password_form_fill_data.h" | 52 #include "chrome/common/password_form_fill_data.h" |
52 #include "chrome/common/pref_names.h" | 53 #include "chrome/common/pref_names.h" |
53 #include "chrome/common/url_constants.h" | 54 #include "chrome/common/url_constants.h" |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 registrar_.Add( | 220 registrar_.Add( |
220 prefs::kPasswordGenerationEnabled, | 221 prefs::kPasswordGenerationEnabled, |
221 base::Bind(&AutofillManager::OnPasswordGenerationEnabledChanged, | 222 base::Bind(&AutofillManager::OnPasswordGenerationEnabledChanged, |
222 base::Unretained(this))); | 223 base::Unretained(this))); |
223 } | 224 } |
224 | 225 |
225 AutofillManager::~AutofillManager() { | 226 AutofillManager::~AutofillManager() { |
226 } | 227 } |
227 | 228 |
228 // static | 229 // static |
229 void AutofillManager::RegisterUserPrefs(PrefServiceSyncable* prefs) { | 230 void AutofillManager::RegisterUserPrefs(PrefRegistrySyncable* registry) { |
230 prefs->RegisterBooleanPref(prefs::kAutofillEnabled, | 231 registry->RegisterBooleanPref(prefs::kAutofillEnabled, |
231 true, | 232 true, |
232 PrefServiceSyncable::SYNCABLE_PREF); | 233 PrefRegistrySyncable::SYNCABLE_PREF); |
233 prefs->RegisterBooleanPref(prefs::kPasswordGenerationEnabled, | 234 registry->RegisterBooleanPref(prefs::kPasswordGenerationEnabled, |
234 true, | 235 true, |
235 PrefServiceSyncable::SYNCABLE_PREF); | 236 PrefRegistrySyncable::SYNCABLE_PREF); |
236 #if defined(OS_MACOSX) | 237 #if defined(OS_MACOSX) |
237 prefs->RegisterBooleanPref(prefs::kAutofillAuxiliaryProfilesEnabled, | 238 registry->RegisterBooleanPref(prefs::kAutofillAuxiliaryProfilesEnabled, |
238 true, | 239 true, |
239 PrefServiceSyncable::SYNCABLE_PREF); | 240 PrefRegistrySyncable::SYNCABLE_PREF); |
240 #else | 241 #else |
241 prefs->RegisterBooleanPref(prefs::kAutofillAuxiliaryProfilesEnabled, | 242 registry->RegisterBooleanPref(prefs::kAutofillAuxiliaryProfilesEnabled, |
242 false, | 243 false, |
243 PrefServiceSyncable::UNSYNCABLE_PREF); | 244 PrefRegistrySyncable::UNSYNCABLE_PREF); |
244 #endif | 245 #endif |
245 prefs->RegisterDoublePref(prefs::kAutofillPositiveUploadRate, | 246 registry->RegisterDoublePref(prefs::kAutofillPositiveUploadRate, |
246 kAutofillPositiveUploadRateDefaultValue, | 247 kAutofillPositiveUploadRateDefaultValue, |
247 PrefServiceSyncable::UNSYNCABLE_PREF); | 248 PrefRegistrySyncable::UNSYNCABLE_PREF); |
248 prefs->RegisterDoublePref(prefs::kAutofillNegativeUploadRate, | 249 registry->RegisterDoublePref(prefs::kAutofillNegativeUploadRate, |
249 kAutofillNegativeUploadRateDefaultValue, | 250 kAutofillNegativeUploadRateDefaultValue, |
250 PrefServiceSyncable::UNSYNCABLE_PREF); | 251 PrefRegistrySyncable::UNSYNCABLE_PREF); |
251 } | 252 } |
252 | 253 |
253 void AutofillManager::RegisterWithSyncService() { | 254 void AutofillManager::RegisterWithSyncService() { |
254 ProfileSyncServiceBase* service = manager_delegate_->GetProfileSyncService(); | 255 ProfileSyncServiceBase* service = manager_delegate_->GetProfileSyncService(); |
255 if (service) | 256 if (service) |
256 service->AddObserver(this); | 257 service->AddObserver(this); |
257 } | 258 } |
258 | 259 |
259 void AutofillManager::SendPasswordGenerationStateToRenderer( | 260 void AutofillManager::SendPasswordGenerationStateToRenderer( |
260 content::RenderViewHost* host, bool enabled) { | 261 content::RenderViewHost* host, bool enabled) { |
(...skipping 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1307 *profile_guid = IDToGUID(profile_id); | 1308 *profile_guid = IDToGUID(profile_id); |
1308 } | 1309 } |
1309 | 1310 |
1310 void AutofillManager::UpdateInitialInteractionTimestamp( | 1311 void AutofillManager::UpdateInitialInteractionTimestamp( |
1311 const TimeTicks& interaction_timestamp) { | 1312 const TimeTicks& interaction_timestamp) { |
1312 if (initial_interaction_timestamp_.is_null() || | 1313 if (initial_interaction_timestamp_.is_null() || |
1313 interaction_timestamp < initial_interaction_timestamp_) { | 1314 interaction_timestamp < initial_interaction_timestamp_) { |
1314 initial_interaction_timestamp_ = interaction_timestamp; | 1315 initial_interaction_timestamp_ = interaction_timestamp; |
1315 } | 1316 } |
1316 } | 1317 } |
OLD | NEW |