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

Side by Side Diff: components/autofill/core/browser/autofill_wallet_data_type_controller.cc

Issue 2549223003: [Sync] Rename NonUIDataTypeController to AsyncDirectoryTypeController (Closed)
Patch Set: Created 4 years 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_wallet_data_type_controller. h" 5 #include "components/autofill/core/browser/autofill_wallet_data_type_controller. h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "components/autofill/core/browser/personal_data_manager.h" 10 #include "components/autofill/core/browser/personal_data_manager.h"
11 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" 11 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h"
12 #include "components/autofill/core/common/autofill_pref_names.h" 12 #include "components/autofill/core/common/autofill_pref_names.h"
13 #include "components/prefs/pref_service.h" 13 #include "components/prefs/pref_service.h"
14 #include "components/sync/driver/sync_client.h" 14 #include "components/sync/driver/sync_client.h"
15 #include "components/sync/driver/sync_service.h" 15 #include "components/sync/driver/sync_service.h"
16 #include "components/sync/model/sync_error.h" 16 #include "components/sync/model/sync_error.h"
17 #include "components/sync/model/syncable_service.h" 17 #include "components/sync/model/syncable_service.h"
18 18
19 namespace browser_sync { 19 namespace browser_sync {
20 20
21 AutofillWalletDataTypeController::AutofillWalletDataTypeController( 21 AutofillWalletDataTypeController::AutofillWalletDataTypeController(
22 syncer::ModelType type, 22 syncer::ModelType type,
23 scoped_refptr<base::SingleThreadTaskRunner> db_thread, 23 scoped_refptr<base::SingleThreadTaskRunner> db_thread,
24 const base::Closure& dump_stack, 24 const base::Closure& dump_stack,
25 syncer::SyncClient* sync_client, 25 syncer::SyncClient* sync_client,
26 const scoped_refptr<autofill::AutofillWebDataService>& web_data_service) 26 const scoped_refptr<autofill::AutofillWebDataService>& web_data_service)
27 : NonUIDataTypeController(type, 27 : AsyncDirectoryTypeController(type,
28 dump_stack, 28 dump_stack,
29 sync_client, 29 sync_client,
30 syncer::GROUP_DB, 30 syncer::GROUP_DB,
31 std::move(db_thread)), 31 std::move(db_thread)),
32 callback_registered_(false), 32 callback_registered_(false),
33 web_data_service_(web_data_service), 33 web_data_service_(web_data_service),
34 currently_enabled_(IsEnabled()) { 34 currently_enabled_(IsEnabled()) {
35 DCHECK(type == syncer::AUTOFILL_WALLET_DATA || 35 DCHECK(type == syncer::AUTOFILL_WALLET_DATA ||
36 type == syncer::AUTOFILL_WALLET_METADATA); 36 type == syncer::AUTOFILL_WALLET_METADATA);
37 pref_registrar_.Init(sync_client_->GetPrefService()); 37 pref_registrar_.Init(sync_client_->GetPrefService());
38 pref_registrar_.Add( 38 pref_registrar_.Add(
39 autofill::prefs::kAutofillWalletImportEnabled, 39 autofill::prefs::kAutofillWalletImportEnabled,
40 base::Bind(&AutofillWalletDataTypeController::OnUserPrefChanged, 40 base::Bind(&AutofillWalletDataTypeController::OnUserPrefChanged,
41 base::AsWeakPtr(this))); 41 base::AsWeakPtr(this)));
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 116
117 bool AutofillWalletDataTypeController::IsEnabled() { 117 bool AutofillWalletDataTypeController::IsEnabled() {
118 DCHECK(CalledOnValidThread()); 118 DCHECK(CalledOnValidThread());
119 119
120 // Require the user-visible pref to be enabled to sync Wallet data/metadata. 120 // Require the user-visible pref to be enabled to sync Wallet data/metadata.
121 PrefService* ps = sync_client_->GetPrefService(); 121 PrefService* ps = sync_client_->GetPrefService();
122 return ps->GetBoolean(autofill::prefs::kAutofillWalletImportEnabled); 122 return ps->GetBoolean(autofill::prefs::kAutofillWalletImportEnabled);
123 } 123 }
124 124
125 } // namespace browser_sync 125 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698