diff options
author | estade <estade@chromium.org> | 2015-02-27 18:12:38 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-02-28 02:13:51 +0000 |
commit | e4f56cef9af4457ba0074e963748284d5da35165 (patch) | |
tree | 35638dd390802565df12339e954bcaa55146338e | |
parent | 7e17b6be0609934a2c07cee5a2f79012e8f515ce (diff) | |
download | chromium_src-e4f56cef9af4457ba0074e963748284d5da35165.zip chromium_src-e4f56cef9af4457ba0074e963748284d5da35165.tar.gz chromium_src-e4f56cef9af4457ba0074e963748284d5da35165.tar.bz2 |
Retry rc50285a99bc5523ea 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}
-rw-r--r-- | chrome/browser/autofill/android/personal_data_manager_android.cc | 8 | ||||
-rw-r--r-- | chrome/browser/ui/webui/options/autofill_options_handler.cc | 9 |
2 files changed, 15 insertions, 2 deletions
diff --git a/chrome/browser/autofill/android/personal_data_manager_android.cc b/chrome/browser/autofill/android/personal_data_manager_android.cc index bc59abf..7192239 100644 --- a/chrome/browser/autofill/android/personal_data_manager_android.cc +++ b/chrome/browser/autofill/android/personal_data_manager_android.cc @@ -342,7 +342,13 @@ static jboolean IsAutofillManaged(JNIEnv* env, jclass clazz) { // Returns whether the Wallet import feature is available. 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. diff --git a/chrome/browser/ui/webui/options/autofill_options_handler.cc b/chrome/browser/ui/webui/options/autofill_options_handler.cc index 4bda089..083f0d0 100644 --- a/chrome/browser/ui/webui/options/autofill_options_handler.cc +++ b/chrome/browser/ui/webui/options/autofill_options_handler.cc @@ -18,6 +18,8 @@ #include "chrome/browser/autofill/personal_data_manager_factory.h" #include "chrome/browser/browser_process.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/common/url_constants.h" #include "chrome/grit/generated_resources.h" @@ -339,8 +341,13 @@ void AutofillOptionsHandler::GetLocalizedValues( SetAddressOverlayStrings(localized_strings); SetCreditCardOverlayStrings(localized_strings); + ProfileSyncService* service = + ProfileSyncServiceFactory::GetInstance()->GetForProfile( + Profile::FromWebUI(web_ui())); localized_strings->SetBoolean( - "enableAutofillWalletIntegration", false); + "enableAutofillWalletIntegration", + service && service->IsSyncEnabledAndLoggedIn() && + personal_data_->IsExperimentalWalletIntegrationEnabled()); localized_strings->SetString( "manageWalletAddressesUrl", autofill::wallet::GetManageAddressesUrl(0).spec()); |