| Index: chrome/browser/ui/webui/options/autofill_options_handler.cc | 
| diff --git a/chrome/browser/ui/webui/options/autofill_options_handler.cc b/chrome/browser/ui/webui/options/autofill_options_handler.cc | 
| index 681ccdf4026fa09a87e4096de7bb75e3b067cd4b..0b38cdd77b83b0a329c684556b9bcf455ca844fb 100644 | 
| --- a/chrome/browser/ui/webui/options/autofill_options_handler.cc | 
| +++ b/chrome/browser/ui/webui/options/autofill_options_handler.cc | 
| @@ -19,7 +19,6 @@ | 
| #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" | 
| @@ -316,7 +315,8 @@ scoped_ptr<base::ListValue> ValidatePhoneArguments( | 
| namespace options { | 
|  | 
| AutofillOptionsHandler::AutofillOptionsHandler() | 
| -    : personal_data_(NULL) {} | 
| +    : personal_data_(NULL), observer_(this) { | 
| +} | 
|  | 
| AutofillOptionsHandler::~AutofillOptionsHandler() { | 
| if (personal_data_) | 
| @@ -361,19 +361,24 @@ void AutofillOptionsHandler::GetLocalizedValues( | 
| SetAddressOverlayStrings(localized_strings); | 
| SetCreditCardOverlayStrings(localized_strings); | 
|  | 
| -  ProfileSyncService* service = | 
| -      ProfileSyncServiceFactory::GetInstance()->GetForProfile( | 
| -          Profile::FromWebUI(web_ui())); | 
| -  localized_strings->SetBoolean( | 
| -      "enableAutofillWalletIntegration", | 
| -      service && service->IsSyncEnabledAndLoggedIn() && | 
| -          personal_data_->IsExperimentalWalletIntegrationEnabled()); | 
| localized_strings->SetString( | 
| "manageWalletAddressesUrl", | 
| autofill::wallet::GetManageAddressesUrl(0).spec()); | 
| localized_strings->SetString( | 
| "manageWalletPaymentMethodsUrl", | 
| autofill::wallet::GetManageInstrumentsUrl(0).spec()); | 
| + | 
| +  // This is set in loadTimeData to minimize the chance of a load-time flash of | 
| +  // content. | 
| +  ProfileSyncService* service = | 
| +      ProfileSyncServiceFactory::GetInstance()->GetForProfile( | 
| +          Profile::FromWebUI(web_ui())); | 
| +  if (service) | 
| +    observer_.Add(service); | 
| +  localized_strings->SetBoolean( | 
| +      "autofillWalletIntegrationAvailable", | 
| +      service && service->IsSyncEnabledAndLoggedIn() && | 
| +          personal_data_->IsExperimentalWalletIntegrationEnabled()); | 
| } | 
|  | 
| void AutofillOptionsHandler::InitializeHandler() { | 
| @@ -385,6 +390,10 @@ void AutofillOptionsHandler::InitializeHandler() { | 
| void AutofillOptionsHandler::InitializePage() { | 
| if (personal_data_) | 
| LoadAutofillData(); | 
| + | 
| +  // Also update the visibility of the Wallet checkbox (which may have | 
| +  // changed since the localized string dictionary was built). | 
| +  OnStateChanged(); | 
| } | 
|  | 
| void AutofillOptionsHandler::RegisterMessages() { | 
| @@ -433,6 +442,15 @@ void AutofillOptionsHandler::OnPersonalDataChanged() { | 
| LoadAutofillData(); | 
| } | 
|  | 
| +void AutofillOptionsHandler::OnStateChanged() { | 
| +  ProfileSyncService* service = | 
| +      ProfileSyncServiceFactory::GetInstance()->GetForProfile( | 
| +          Profile::FromWebUI(web_ui())); | 
| +  web_ui()->CallJavascriptFunction( | 
| +      "AutofillOptions.walletIntegrationAvailableStateChanged", | 
| +      base::FundamentalValue(service && service->IsSyncEnabledAndLoggedIn())); | 
| +} | 
| + | 
| void AutofillOptionsHandler::SetAddressOverlayStrings( | 
| base::DictionaryValue* localized_strings) { | 
| localized_strings->SetString("autofillEditAddressTitle", | 
|  |