Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1631)

Unified Diff: chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_manager.js

Issue 11028121: Convert wallpaper picker to v2 app (Closed) Base URL: http://git.chromium.org/chromium/src.git@AppsV2
Patch Set: Review this patch Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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.

Powered by Google App Engine
This is Rietveld 408576698