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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * WallpaperManager constructor. 6 * WallpaperManager constructor.
7 * 7 *
8 * WallpaperManager objects encapsulate the functionality of the wallpaper 8 * WallpaperManager objects encapsulate the functionality of the wallpaper
9 * manager extension. 9 * manager extension.
10 * 10 *
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 this.manifest_ = {}; 76 this.manifest_ = {};
77 } 77 }
78 }; 78 };
79 79
80 /** 80 /**
81 * Requests wallpaper manifest file from server. 81 * Requests wallpaper manifest file from server.
82 */ 82 */
83 WallpaperManager.prototype.fetchManifest_ = function() { 83 WallpaperManager.prototype.fetchManifest_ = function() {
84 var xhr = new XMLHttpRequest(); 84 var xhr = new XMLHttpRequest();
85 var locale = navigator.language; 85 var locale = navigator.language;
86 xhr.open('GET', ManifestBaseURL + locale + '.json', false); 86 var urls = [
87 xhr.send(null); 87 ManifestBaseURL + locale + '.json',
88 // TODO(bshe): We should save the downloaded manifest to local disk. Other 88 // Fallback url. Use 'en' locale by default.
89 // components may want to use it (i.e. screen saver). 89 ManifestBaseURL + 'en.json'];
90 if (xhr.status === 200) { 90
91 this.parseManifest_(xhr.responseText); 91 for (var i = 0; i < urls.length; i++) {
92 } else { 92 xhr.open('GET', urls[i], false);
93 // Fall back to en locale if current locale is not supported. 93 try {
94 xhr.open('GET', ManifestBaseURL + 'en.json', false); 94 xhr.send(null);
95 xhr.send(null); 95 // TODO(bshe): We should save the downloaded manifest to local disk.
96 if (xhr.status === 200) { 96 // Other components may want to use it (i.e. screen saver).
97 this.parseManifest_(xhr.responseText); 97 if (xhr.status === 200) {
98 } else { 98 this.parseManifest_(xhr.responseText);
99 return;
100 }
101 } catch (e) {
99 this.manifest_ = {}; 102 this.manifest_ = {};
100 this.butterBar_.showError_(str('connectionFailed')); 103 this.butterBar_.showError_(str('connectionFailed'));
104 return;
101 } 105 }
102 } 106 }
107 this.manifest_ = {};
108 this.butterBar_.showError_(str('connectionFailed'));
103 109
104 // TODO(bshe): Fall back to saved manifest if there is a problem fetching 110 // TODO(bshe): Fall back to saved manifest if there is a problem fetching
105 // manifest from server. 111 // manifest from server.
106 }; 112 };
107 113
108 /** 114 /**
109 * One-time initialization of various DOM nodes. 115 * One-time initialization of various DOM nodes.
110 */ 116 */
111 WallpaperManager.prototype.initDom_ = function() { 117 WallpaperManager.prototype.initDom_ = function() {
112 i18nTemplate.process(this.document_, loadTimeData); 118 i18nTemplate.process(this.document_, loadTimeData);
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 selectedItem = wallpaperInfo; 390 selectedItem = wallpaperInfo;
385 } 391 }
386 } 392 }
387 } 393 }
388 this.wallpaperGrid_.dataModel = wallpapersDataModel; 394 this.wallpaperGrid_.dataModel = wallpapersDataModel;
389 this.wallpaperGrid_.selectedItem = selectedItem; 395 this.wallpaperGrid_.selectedItem = selectedItem;
390 } 396 }
391 }; 397 };
392 398
393 })(); 399 })();
OLDNEW
« 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