Commit e4f56cef authored by estade's avatar estade Committed by Commit bot

Retry rc50285a9 with fix for browser test crash

```-------
  Show Autofill/Wallet options only when signed in.

  Before this patch, you could still see the options if you signed into a whitelisted account (setting the sync experiment preference) and then signed out of the account.

  BUG=none
  R=brettw@chromium.org
```

-------

Review URL: https://codereview.chromium.org/961773003

Cr-Commit-Position: refs/heads/master@{#318573}
parent 7e17b6be
...@@ -342,7 +342,13 @@ static jboolean IsAutofillManaged(JNIEnv* env, jclass clazz) { ...@@ -342,7 +342,13 @@ static jboolean IsAutofillManaged(JNIEnv* env, jclass clazz) {
// Returns whether the Wallet import feature is available. // Returns whether the Wallet import feature is available.
static jboolean IsWalletImportFeatureAvailable(JNIEnv* env, jclass clazz) { static jboolean IsWalletImportFeatureAvailable(JNIEnv* env, jclass clazz) {
return false; // TODO(estade): what to do in the IsManaged case?
ProfileSyncService* service =
ProfileSyncServiceFactory::GetInstance()->GetForProfile(GetProfile());
PersonalDataManager* pdm = PersonalDataManagerFactory::GetForProfile(
GetProfile());
return service && service->IsSyncEnabledAndLoggedIn() &&
pdm->IsExperimentalWalletIntegrationEnabled();
} }
// Returns whether the Wallet import feature is enabled. // Returns whether the Wallet import feature is enabled.
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
#include "chrome/browser/autofill/personal_data_manager_factory.h" #include "chrome/browser/autofill/personal_data_manager_factory.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/browser/ui/autofill/country_combobox_model.h" #include "chrome/browser/ui/autofill/country_combobox_model.h"
#include "chrome/common/url_constants.h" #include "chrome/common/url_constants.h"
#include "chrome/grit/generated_resources.h" #include "chrome/grit/generated_resources.h"
...@@ -339,8 +341,13 @@ void AutofillOptionsHandler::GetLocalizedValues( ...@@ -339,8 +341,13 @@ void AutofillOptionsHandler::GetLocalizedValues(
SetAddressOverlayStrings(localized_strings); SetAddressOverlayStrings(localized_strings);
SetCreditCardOverlayStrings(localized_strings); SetCreditCardOverlayStrings(localized_strings);
ProfileSyncService* service =
ProfileSyncServiceFactory::GetInstance()->GetForProfile(
Profile::FromWebUI(web_ui()));
localized_strings->SetBoolean( localized_strings->SetBoolean(
"enableAutofillWalletIntegration", false); "enableAutofillWalletIntegration",
service && service->IsSyncEnabledAndLoggedIn() &&
personal_data_->IsExperimentalWalletIntegrationEnabled());
localized_strings->SetString( localized_strings->SetString(
"manageWalletAddressesUrl", "manageWalletAddressesUrl",
autofill::wallet::GetManageAddressesUrl(0).spec()); autofill::wallet::GetManageAddressesUrl(0).spec());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment