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

Side by Side Diff: chrome/browser/autofill/autofill_manager.cc

Issue 12079097: Introduce PrefRegistrySyncable, simplifying PrefServiceSyncable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head again; base::File changes conflicted. Created 7 years, 10 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 | Annotate | Revision Log
OLDNEW
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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 registrar_.Add( 221 registrar_.Add(
221 prefs::kPasswordGenerationEnabled, 222 prefs::kPasswordGenerationEnabled,
222 base::Bind(&AutofillManager::OnPasswordGenerationEnabledChanged, 223 base::Bind(&AutofillManager::OnPasswordGenerationEnabledChanged,
223 base::Unretained(this))); 224 base::Unretained(this)));
224 } 225 }
225 226
226 AutofillManager::~AutofillManager() { 227 AutofillManager::~AutofillManager() {
227 } 228 }
228 229
229 // static 230 // static
230 void AutofillManager::RegisterUserPrefs(PrefServiceSyncable* prefs) { 231 void AutofillManager::RegisterUserPrefs(PrefRegistrySyncable* registry) {
231 prefs->RegisterBooleanPref(prefs::kAutofillEnabled, 232 registry->RegisterBooleanPref(prefs::kAutofillEnabled,
232 true, 233 true,
233 PrefServiceSyncable::SYNCABLE_PREF); 234 PrefRegistrySyncable::SYNCABLE_PREF);
234 prefs->RegisterBooleanPref(prefs::kPasswordGenerationEnabled, 235 registry->RegisterBooleanPref(prefs::kPasswordGenerationEnabled,
235 true, 236 true,
236 PrefServiceSyncable::SYNCABLE_PREF); 237 PrefRegistrySyncable::SYNCABLE_PREF);
237 #if defined(OS_MACOSX) 238 #if defined(OS_MACOSX)
238 prefs->RegisterBooleanPref(prefs::kAutofillAuxiliaryProfilesEnabled, 239 registry->RegisterBooleanPref(prefs::kAutofillAuxiliaryProfilesEnabled,
239 true, 240 true,
240 PrefServiceSyncable::SYNCABLE_PREF); 241 PrefRegistrySyncable::SYNCABLE_PREF);
241 #else 242 #else
242 prefs->RegisterBooleanPref(prefs::kAutofillAuxiliaryProfilesEnabled, 243 registry->RegisterBooleanPref(prefs::kAutofillAuxiliaryProfilesEnabled,
243 false, 244 false,
244 PrefServiceSyncable::UNSYNCABLE_PREF); 245 PrefRegistrySyncable::UNSYNCABLE_PREF);
245 #endif 246 #endif
246 prefs->RegisterDoublePref(prefs::kAutofillPositiveUploadRate, 247 registry->RegisterDoublePref(prefs::kAutofillPositiveUploadRate,
247 kAutofillPositiveUploadRateDefaultValue, 248 kAutofillPositiveUploadRateDefaultValue,
248 PrefServiceSyncable::UNSYNCABLE_PREF); 249 PrefRegistrySyncable::UNSYNCABLE_PREF);
249 prefs->RegisterDoublePref(prefs::kAutofillNegativeUploadRate, 250 registry->RegisterDoublePref(prefs::kAutofillNegativeUploadRate,
250 kAutofillNegativeUploadRateDefaultValue, 251 kAutofillNegativeUploadRateDefaultValue,
251 PrefServiceSyncable::UNSYNCABLE_PREF); 252 PrefRegistrySyncable::UNSYNCABLE_PREF);
252 } 253 }
253 254
254 void AutofillManager::RegisterWithSyncService() { 255 void AutofillManager::RegisterWithSyncService() {
255 ProfileSyncServiceBase* service = manager_delegate_->GetProfileSyncService(); 256 ProfileSyncServiceBase* service = manager_delegate_->GetProfileSyncService();
256 if (service) 257 if (service)
257 service->AddObserver(this); 258 service->AddObserver(this);
258 } 259 }
259 260
260 void AutofillManager::SendPasswordGenerationStateToRenderer( 261 void AutofillManager::SendPasswordGenerationStateToRenderer(
261 content::RenderViewHost* host, bool enabled) { 262 content::RenderViewHost* host, bool enabled) {
(...skipping 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after
1304 *profile_guid = IDToGUID(profile_id); 1305 *profile_guid = IDToGUID(profile_id);
1305 } 1306 }
1306 1307
1307 void AutofillManager::UpdateInitialInteractionTimestamp( 1308 void AutofillManager::UpdateInitialInteractionTimestamp(
1308 const TimeTicks& interaction_timestamp) { 1309 const TimeTicks& interaction_timestamp) {
1309 if (initial_interaction_timestamp_.is_null() || 1310 if (initial_interaction_timestamp_.is_null() ||
1310 interaction_timestamp < initial_interaction_timestamp_) { 1311 interaction_timestamp < initial_interaction_timestamp_) {
1311 initial_interaction_timestamp_ = interaction_timestamp; 1312 initial_interaction_timestamp_ = interaction_timestamp;
1312 } 1313 }
1313 } 1314 }
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autofill_manager.h ('k') | chrome/browser/background/background_contents_service_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698