| Index: chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_manager.js
|
| diff --git a/chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_manager.js b/chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_manager.js
|
| index 7c2040cddfc743df4adf768e2dea57cc142bf04e..f0754bbdda230df65bb3ec6ccee3abac363927e0 100644
|
| --- a/chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_manager.js
|
| +++ b/chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_manager.js
|
| @@ -21,7 +21,6 @@ function WallpaperManager(dialogDom) {
|
| this.customWallpaperData_ = null;
|
| this.currentWallpaper_ = null;
|
| this.fetchManifest_();
|
| - this.initDom_();
|
| }
|
|
|
| // Anonymous 'namespace'.
|
| @@ -83,23 +82,31 @@ function WallpaperManager(dialogDom) {
|
| WallpaperManager.prototype.fetchManifest_ = function() {
|
| var xhr = new XMLHttpRequest();
|
| var locale = navigator.language;
|
| - xhr.open('GET', ManifestBaseURL + locale + '.json', false);
|
| + xhr.open('GET', ManifestBaseURL + locale + '.json', true);
|
| xhr.send(null);
|
| - // TODO(bshe): We should save the downloaded manifest to local disk. Other
|
| - // components may want to use it (i.e. screen saver).
|
| - if (xhr.status === 200) {
|
| - this.parseManifest_(xhr.responseText);
|
| - } else {
|
| - // Fall back to en locale if current locale is not supported.
|
| - xhr.open('GET', ManifestBaseURL + 'en.json', false);
|
| - xhr.send(null);
|
| + var self = this;
|
| +
|
| + xhr.addEventListener('load', function(e) {
|
| + // TODO(bshe): We should save the downloaded manifest to local disk. Other
|
| + // components may want to use it (i.e. screen saver).
|
| if (xhr.status === 200) {
|
| - this.parseManifest_(xhr.responseText);
|
| + self.parseManifest_(xhr.responseText);
|
| + self.initDom_();
|
| } else {
|
| - this.manifest_ = {};
|
| - this.butterBar_.showError_(str('connectionFailed'));
|
| + // Fall back to en locale if current locale is not supported.
|
| + xhr.open('GET', ManifestBaseURL + 'en.json', true);
|
| + xhr.send(null);
|
| + xhr.addEventListener('load', function(e) {
|
| + if (xhr.status === 200) {
|
| + self.parseManifest_(xhr.responseText);
|
| + } else {
|
| + self.manifest_ = {};
|
| + self.butterBar_.showError_(str('connectionFailed'));
|
| + }
|
| + self.initDom_();
|
| + });
|
| }
|
| - }
|
| + });
|
|
|
| // TODO(bshe): Fall back to saved manifest if there is a problem fetching
|
| // manifest from server.
|
|
|