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

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

Issue 1137513002: Autofill: Add WalletIntegrationAvailable() to components. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Created 5 years, 7 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "components/autofill/core/browser/options_util.h"
6
7 #include "base/prefs/pref_service.h"
8 #include "components/autofill/core/browser/personal_data_manager.h"
9 #include "components/autofill/core/common/autofill_pref_names.h"
10 #include "components/sync_driver/sync_service.h"
11
12 namespace autofill {
13
14 bool WalletIntegrationAvailable(sync_driver::SyncService* sync_service,
15 PrefService* pref_service,
Evan Stade 2015/05/07 19:59:46 this should be const ref
bondd 2015/05/07 21:19:24 Done.
16 PersonalDataManager* personal_data_manager) {
Evan Stade 2015/05/07 19:59:46 this should be const ref
bondd 2015/05/07 21:19:24 Done.
17 if (!(sync_service && sync_service->IsSyncEnabledAndLoggedIn() &&
18 sync_service->GetPreferredDataTypes().Has(syncer::AUTOFILL_PROFILE))) {
19 return false;
20 }
21
22 DCHECK(personal_data_manager);
23 if (!personal_data_manager->IsExperimentalWalletIntegrationEnabled())
24 return false;
25
26 // If the user is signed in and the feature is enabled, but no data is being
27 // synced, hide the option. The user doesn't have a Wallet account. If the
28 // feature is disabled, we can't know, so show the checkbox.
29 DCHECK(pref_service);
30 if (!pref_service->GetBoolean(prefs::kAutofillWalletImportEnabled))
31 return true;
32
33 // If wallet is preferred but we haven't gotten the sync data yet, we don't
34 // know, so show the checkbox.
35 if (!sync_service->GetActiveDataTypes().Has(syncer::AUTOFILL_WALLET_DATA))
36 return true;
37
38 return personal_data_manager->HasServerData();
39 }
40
41 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698