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

Side by Side Diff: chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_manager.js

Issue 24040002: Fix unexpected error message when quickly select different wallpapers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 500
501 // Falls back to request wallpaper from server. 501 // Falls back to request wallpaper from server.
502 if (self.wallpaperRequest_) 502 if (self.wallpaperRequest_)
503 self.wallpaperRequest_.abort(); 503 self.wallpaperRequest_.abort();
504 504
505 self.wallpaperRequest_ = new XMLHttpRequest(); 505 self.wallpaperRequest_ = new XMLHttpRequest();
506 self.progressManager_.reset(self.wallpaperRequest_, selectedGridItem); 506 self.progressManager_.reset(self.wallpaperRequest_, selectedGridItem);
507 507
508 var onSuccess = function(xhr) { 508 var onSuccess = function(xhr) {
509 var image = xhr.response; 509 var image = xhr.response;
510 chrome.wallpaperPrivate.setWallpaper(image, selectedItem.layout, 510 if (image) {
flackr 2013/09/06 15:44:00 onSuccess can actually be called if there's no res
511 wallpaperURL, 511 chrome.wallpaperPrivate.setWallpaper(image, selectedItem.layout,
512 self.onFinished_.bind(self, selectedGridItem, selectedItem)); 512 wallpaperURL,
513 self.currentWallpaper_ = wallpaperURL; 513 self.onFinished_.bind(self, selectedGridItem, selectedItem));
514 WallpaperUtil.saveWallpaperInfo(wallpaperURL, selectedItem.layout, 514 self.currentWallpaper_ = wallpaperURL;
515 selectedItem.source); 515 WallpaperUtil.saveWallpaperInfo(wallpaperURL, selectedItem.layout,
516 self.wallpaperRequest_ = null; 516 selectedItem.source);
517 self.wallpaperRequest_ = null;
518 }
517 }; 519 };
518 var onFailure = function() { 520 var onFailure = function() {
519 self.progressManager_.hideProgressBar(selectedGridItem); 521 self.progressManager_.hideProgressBar(selectedGridItem);
520 self.showError_(str('downloadFailed')); 522 self.showError_(str('downloadFailed'));
521 self.wallpaperRequest_ = null; 523 self.wallpaperRequest_ = null;
522 }; 524 };
523 WallpaperUtil.fetchURL(wallpaperURL, 'arraybuffer', onSuccess, 525 WallpaperUtil.fetchURL(wallpaperURL, 'arraybuffer', onSuccess,
524 onFailure, self.wallpaperRequest_); 526 onFailure, self.wallpaperRequest_);
525 }); 527 });
526 break; 528 break;
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 } 987 }
986 } 988 }
987 } 989 }
988 this.wallpaperGrid_.dataModel = wallpapersDataModel; 990 this.wallpaperGrid_.dataModel = wallpapersDataModel;
989 this.wallpaperGrid_.selectedItem = selectedItem; 991 this.wallpaperGrid_.selectedItem = selectedItem;
990 this.wallpaperGrid_.activeItem = selectedItem; 992 this.wallpaperGrid_.activeItem = selectedItem;
991 } 993 }
992 }; 994 };
993 995
994 })(); 996 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698