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

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

Issue 1138373002: Autofill: Fix WalletIntegrationAvailable() regression. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pay_07_check_wallet_available_03
Patch Set: Add missing dep for GN build. 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
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/options_util.h" 5 #include "components/autofill/core/browser/options_util.h"
6 6
7 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "components/autofill/core/browser/personal_data_manager.h" 8 #include "components/autofill/core/browser/personal_data_manager.h"
9 #include "components/autofill/core/common/autofill_pref_names.h" 9 #include "components/autofill/core/common/autofill_pref_names.h"
10 #include "components/sync_driver/sync_service.h" 10 #include "components/sync_driver/sync_service.h"
11 11
12 namespace autofill { 12 namespace autofill {
13 13
14 bool WalletIntegrationAvailable( 14 bool WalletIntegrationAvailable(
15 sync_driver::SyncService* sync_service, 15 sync_driver::SyncService* sync_service,
16 const PrefService& pref_service, 16 const PrefService& pref_service,
17 const PersonalDataManager& personal_data_manager) { 17 const PersonalDataManager& personal_data_manager) {
18 if (!(sync_service && sync_service->IsSyncEnabledAndLoggedIn() && 18 if (!(sync_service && sync_service->IsSyncEnabledAndLoggedIn() &&
19 sync_service->GetPreferredDataTypes().Has(syncer::AUTOFILL_PROFILE))) { 19 sync_service->GetPreferredDataTypes().Has(syncer::AUTOFILL_PROFILE))) {
20 return false; 20 return false;
21 } 21 }
22 22
23 if (!personal_data_manager.IsExperimentalWalletIntegrationEnabled()) 23 if (!personal_data_manager.IsExperimentalWalletIntegrationEnabled())
24 return false; 24 return false;
25 25
26 // If the user is signed in and the feature is enabled, but no data is being 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 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. 28 // feature is disabled, we can't know, so show the checkbox.
29 if (pref_service.GetBoolean(prefs::kAutofillWalletImportEnabled)) 29 if (!pref_service.GetBoolean(prefs::kAutofillWalletImportEnabled))
30 return true; 30 return true;
31 31
32 // If wallet is preferred but we haven't gotten the sync data yet, we don't 32 // If wallet is preferred but we haven't gotten the sync data yet, we don't
33 // know, so show the checkbox. 33 // know, so show the checkbox.
34 if (!sync_service->GetActiveDataTypes().Has(syncer::AUTOFILL_WALLET_DATA)) 34 if (!sync_service->GetActiveDataTypes().Has(syncer::AUTOFILL_WALLET_DATA))
35 return true; 35 return true;
36 36
37 return personal_data_manager.HasServerData(); 37 return personal_data_manager.HasServerData();
38 } 38 }
39 39
40 } // namespace autofill 40 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/BUILD.gn ('k') | components/autofill/core/browser/options_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698