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

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

Issue 956403003: Fix the issue that wallpaper changes twice when both "onChanged" and "onAlarm" are fired. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address the code review comments. Created 5 years, 9 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/util.js
diff --git a/chrome/browser/resources/chromeos/wallpaper_manager/js/util.js b/chrome/browser/resources/chromeos/wallpaper_manager/js/util.js
index 272fb2224869217f606fdcab88c9186bd51be5f4..0722977066d97e3cddd7cda23b66c2e5f4b5830c 100644
--- a/chrome/browser/resources/chromeos/wallpaper_manager/js/util.js
+++ b/chrome/browser/resources/chromeos/wallpaper_manager/js/util.js
@@ -306,9 +306,11 @@ WallpaperUtil.saveWallpaperInfo = function(url, layout, source) {
* @param {function} onSuccess The success callback. It must be called with
* current XMLHttprequest object.
* @param {function} onFailure The failure callback.
+ * @param {function} onNotFound The not found callback.
* @param {XMLHttpRequest=} opt_xhr The XMLHttpRequest object.
*/
-WallpaperUtil.fetchURL = function(url, type, onSuccess, onFailure, opt_xhr) {
+WallpaperUtil.fetchURL = function(
+ url, type, onSuccess, onFailure, onNotFound, opt_xhr) {
bshe 2015/03/09 14:16:09 I think it is probably better to handle onNotFound
xdai1 2015/03/09 21:07:10 Done.
var xhr;
if (opt_xhr)
xhr = opt_xhr;
@@ -322,6 +324,9 @@ WallpaperUtil.fetchURL = function(url, type, onSuccess, onFailure, opt_xhr) {
xhr.addEventListener('load', function(e) {
if (this.status == 200) {
onSuccess(this);
+ } else if (this.status == 404) {
+ if (onNotFound)
+ onNotFound();
} else {
onFailure();
}

Powered by Google App Engine
This is Rietveld 408576698