| Index: chrome/browser/ui/webui/options/sync_setup_handler.cc
|
| diff --git a/chrome/browser/ui/webui/options/sync_setup_handler.cc b/chrome/browser/ui/webui/options/sync_setup_handler.cc
|
| index 6c7dac3b881f8131f39d6a646c2c9e0ba2a9d186..1a58ffb5bb03efaf3f49d1727cf9edef9ec9d9b5 100644
|
| --- a/chrome/browser/ui/webui/options/sync_setup_handler.cc
|
| +++ b/chrome/browser/ui/webui/options/sync_setup_handler.cc
|
| @@ -39,6 +39,7 @@
|
| #include "chrome/grit/chromium_strings.h"
|
| #include "chrome/grit/generated_resources.h"
|
| #include "chrome/grit/locale_settings.h"
|
| +#include "components/autofill/core/common/autofill_pref_names.h"
|
| #include "components/browser_sync/browser/profile_sync_service.h"
|
| #include "components/google/core/browser/google_util.h"
|
| #include "components/signin/core/browser/signin_error_controller.h"
|
| @@ -76,6 +77,7 @@ struct SyncConfigInfo {
|
| bool sync_everything;
|
| bool sync_nothing;
|
| syncer::ModelTypeSet data_types;
|
| + bool payments_integration_enabled;
|
| std::string passphrase;
|
| bool passphrase_is_gaia;
|
| };
|
| @@ -84,8 +86,8 @@ SyncConfigInfo::SyncConfigInfo()
|
| : encrypt_all(false),
|
| sync_everything(false),
|
| sync_nothing(false),
|
| - passphrase_is_gaia(false) {
|
| -}
|
| + payments_integration_enabled(false),
|
| + passphrase_is_gaia(false) {}
|
|
|
| SyncConfigInfo::~SyncConfigInfo() {}
|
|
|
| @@ -110,6 +112,13 @@ bool GetConfiguration(const std::string& json, SyncConfigInfo* config) {
|
| DCHECK(!(config->sync_everything && config->sync_nothing))
|
| << "syncAllDataTypes and syncNothing cannot both be true";
|
|
|
| + if (!result->GetBoolean("paymentsIntegrationEnabled",
|
| + &config->payments_integration_enabled)) {
|
| + DLOG(ERROR) << "GetConfiguration() not passed a paymentsIntegrationEnabled "
|
| + << "value";
|
| + return false;
|
| + }
|
| +
|
| syncer::ModelTypeNameMap type_names = syncer::GetUserSelectableTypeNameMap();
|
|
|
| for (syncer::ModelTypeNameMap::const_iterator it = type_names.begin();
|
| @@ -239,6 +248,7 @@ void SyncSetupHandler::GetStaticLocalizedValues(
|
| { "apps", IDS_SYNC_DATATYPE_APPS },
|
| { "wifiCredentials", IDS_SYNC_DATATYPE_WIFI_CREDENTIALS },
|
| { "openTabs", IDS_SYNC_DATATYPE_TABS },
|
| + { "enablePaymentsIntegration", IDS_AUTOFILL_USE_PAYMENTS_DATA },
|
| { "serviceUnavailableError", IDS_SYNC_SETUP_ABORTED_BY_PENDING_CLEAR },
|
| { "confirmLabel", IDS_SYNC_CONFIRM_PASSPHRASE_LABEL },
|
| { "emptyErrorMessage", IDS_SYNC_EMPTY_PASSPHRASE_ERROR },
|
| @@ -568,6 +578,10 @@ void SyncSetupHandler::HandleConfigure(const base::ListValue* args) {
|
| service->OnUserChoseDatatypes(configuration.sync_everything,
|
| configuration.data_types);
|
|
|
| + PrefService* pref_service = GetProfile()->GetPrefs();
|
| + pref_service->SetBoolean(autofill::prefs::kAutofillWalletImportEnabled,
|
| + configuration.payments_integration_enabled);
|
| +
|
| // Need to call IsPassphraseRequiredForDecryption() *after* calling
|
| // OnUserChoseDatatypes() because the user may have just disabled the
|
| // encrypted datatypes (in which case we just want to exit, not prompt the
|
| @@ -845,6 +859,7 @@ void SyncSetupHandler::DisplayConfigureSync(bool passphrase_failed) {
|
| // syncNothing: true if the user wants to sync nothing
|
| // <data_type>Registered: true if the associated data type is supported
|
| // <data_type>Synced: true if the user wants to sync that specific data type
|
| + // paymentsIntegrationEnabled: true if the user wants Payments integration
|
| // encryptionEnabled: true if sync supports encryption
|
| // encryptAllData: true if user wants to encrypt all data (not just
|
| // passwords)
|
| @@ -868,10 +883,14 @@ void SyncSetupHandler::DisplayConfigureSync(bool passphrase_failed) {
|
| // TODO(treib): How do we want to handle pref groups, i.e. when only some of
|
| // the sync types behind a checkbox are force-enabled? crbug.com/403326
|
| }
|
| - sync_driver::SyncPrefs sync_prefs(GetProfile()->GetPrefs());
|
| + PrefService* pref_service = GetProfile()->GetPrefs();
|
| + sync_driver::SyncPrefs sync_prefs(pref_service);
|
| args.SetBoolean("passphraseFailed", passphrase_failed);
|
| args.SetBoolean("syncAllDataTypes", sync_prefs.HasKeepEverythingSynced());
|
| args.SetBoolean("syncNothing", false); // Always false during initial setup.
|
| + args.SetBoolean(
|
| + "paymentsIntegrationEnabled",
|
| + pref_service->GetBoolean(autofill::prefs::kAutofillWalletImportEnabled));
|
| args.SetBoolean("encryptAllData", service->IsEncryptEverythingEnabled());
|
| args.SetBoolean("encryptAllDataAllowed",
|
| service->IsEncryptEverythingAllowed());
|
|
|