diff options
-rw-r--r-- | chrome/browser/resources/options2/browser_options.js | 14 | ||||
-rw-r--r-- | chrome/browser/ui/webui/options2/browser_options_handler2.cc | 16 |
2 files changed, 13 insertions, 17 deletions
diff --git a/chrome/browser/resources/options2/browser_options.js b/chrome/browser/resources/options2/browser_options.js index 1545ad2..af6ec2c 100644 --- a/chrome/browser/resources/options2/browser_options.js +++ b/chrome/browser/resources/options2/browser_options.js @@ -46,8 +46,7 @@ cr.define('options', function() { OptionsPage.prototype.initializePage.call(this); // Sync (Sign in) section. - if (templateData.syncData) - this.updateSyncState_(templateData.syncData); + this.updateSyncState_(templateData.syncData); $('sync-action-link').onclick = function(event) { SyncSetupOverlay.showErrorUI(); @@ -254,6 +253,12 @@ cr.define('options', function() { * @private */ updateSyncState_: function(syncData) { + if (!syncData.syncSystemEnabled) { + $('sync-section').hidden = true; + return; + } + + $('sync-section').hidden = false; this.syncSetupCompleted = syncData.setupCompleted; $('customize-sync').hidden = !syncData.setupCompleted; @@ -299,10 +304,6 @@ cr.define('options', function() { $('profiles-section').hidden = !visible; }, - hideSyncSection_: function() { - $('sync-section').hidden = true; - }, - /** * Get the start/stop sync button DOM element. Used for testing. * @return {DOMElement} The start/stop sync button. @@ -587,7 +588,6 @@ cr.define('options', function() { //Forward public APIs to private implementations. [ 'getStartStopSyncButton', - 'hideSyncSection', 'setGtkThemeButtonEnabled', 'setInstantFieldTrialStatus', 'setProfilesInfo', diff --git a/chrome/browser/ui/webui/options2/browser_options_handler2.cc b/chrome/browser/ui/webui/options2/browser_options_handler2.cc index 354fe46..5d98a7d 100644 --- a/chrome/browser/ui/webui/options2/browser_options_handler2.cc +++ b/chrome/browser/ui/webui/options2/browser_options_handler2.cc @@ -232,9 +232,7 @@ void BrowserOptionsHandler::GetLocalizedValues( #endif // Pass along sync status early so it will be available during page init. - DictionaryValue* syncData = GetSyncStateDictionary(); - if (syncData) - localized_strings->Set("syncData", syncData); + localized_strings->Set("syncData", GetSyncStateDictionary()); } void BrowserOptionsHandler::RegisterMessages() { @@ -300,12 +298,9 @@ void BrowserOptionsHandler::Initialize() { ProfileSyncService* sync_service(ProfileSyncServiceFactory:: GetInstance()->GetForProfile(Profile::FromWebUI(web_ui()))); - if (sync_service) { + if (sync_service) sync_service->AddObserver(this); - OnStateChanged(); - } else { - web_ui()->CallJavascriptFunction("options.BrowserOptions.hideSyncSection"); - } + OnStateChanged(); // Create our favicon data source. profile->GetChromeURLDataManager()->AddDataSource( @@ -744,12 +739,13 @@ void BrowserOptionsHandler::IncreaseScreenBrightnessCallback( #endif DictionaryValue* BrowserOptionsHandler::GetSyncStateDictionary() { + DictionaryValue* sync_status = new DictionaryValue; ProfileSyncService* service(ProfileSyncServiceFactory:: GetInstance()->GetForProfile(Profile::FromWebUI(web_ui()))); + sync_status->SetBoolean("syncSystemEnabled", !!service); if (!service) - return NULL; + return sync_status; - DictionaryValue* sync_status = new DictionaryValue; sync_status->SetBoolean("setupCompleted", service->HasSyncSetupCompleted()); sync_status->SetBoolean("setupInProgress", service->SetupInProgress()); |