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

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

Issue 11066090: Show custom wallpaper container and cannot access wallpaper message when device offline. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: reviews 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 e432e355f75d3e6883e12db0b1f9127b03f41a27..d8a40a6bceb02ff572618d5e1e88ceafd7b573f2 100644
--- a/chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_manager.js
+++ b/chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_manager.js
@@ -83,23 +83,29 @@ function WallpaperManager(dialogDom) {
WallpaperManager.prototype.fetchManifest_ = function() {
var xhr = new XMLHttpRequest();
var locale = navigator.language;
- xhr.open('GET', ManifestBaseURL + locale + '.json', false);
- 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);
- if (xhr.status === 200) {
- this.parseManifest_(xhr.responseText);
- } else {
+ var urls = [
+ ManifestBaseURL + locale + '.json',
+ // Fallback url. Use 'en' locale by default.
+ ManifestBaseURL + 'en.json'];
+
+ for (var i = 0; i < urls.length; i++) {
+ xhr.open('GET', urls[i], false);
+ try {
+ 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);
+ return;
+ }
+ } catch (e) {
this.manifest_ = {};
this.butterBar_.showError_(str('connectionFailed'));
+ return;
}
}
+ this.manifest_ = {};
+ this.butterBar_.showError_(str('connectionFailed'));
// TODO(bshe): Fall back to saved manifest if there is a problem fetching
// manifest from server.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698