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

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

Issue 14244011: Fix custom wallpaper going back from wallpaper 2 to wallpaper 1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: flackr's review Created 7 years, 8 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 | « chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_images_grid.js ('k') | 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 22ef6cf57eef24ae5f76e37cd0d7a736552f0510..274fc76588e0d0ef1f7f8288a9fd6c9748e52ec1 100644
--- a/chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_manager.js
+++ b/chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_manager.js
@@ -621,11 +621,20 @@ function WallpaperManager(dialogDom) {
*/
WallpaperManager.prototype.onThumbnailSelectionChanged_ = function() {
flackr 2013/04/16 01:28:41 This method and description seem to be inaccuratel
bshe 2013/04/16 16:19:26 Done.
var selectedItem = this.wallpaperGrid_.selectedItem;
- if (selectedItem && selectedItem.source == 'ADDNEW')
+ this.setWallpaperAttribution_(selectedItem);
+
+ // splice may dispatch a change event because the position of selected
+ // element changing. But the actual selected element didn't change after
+ // splice. Check if the new selected element equals to the previous selected
+ // element before continuing. Otherwise, wallpaper may reset to previous one
+ // as described in http://crbug.com/229036.
+ if (!selectedItem || selectedItem.source == 'ADDNEW' ||
+ selectedItem == this.wallpaperGrid_.previousSelectedItem) {
return;
+ }
- if (selectedItem && selectedItem.baseURL &&
- !this.wallpaperGrid_.inProgramSelection) {
+ this.wallpaperGrid_.previousSelectedItem = selectedItem;
flackr 2013/04/16 01:28:41 previousSelectedItem doesn't belong in wallpaperGr
bshe 2013/04/16 16:19:26 I can't use currentWallpaper or activeItem to repl
+ if (selectedItem.baseURL && !this.wallpaperGrid_.inProgramSelection) {
if (selectedItem.source == wallpapers.WallpaperSourceEnum.Custom) {
var items = {};
var key = selectedItem.baseURL;
@@ -638,7 +647,6 @@ function WallpaperManager(dialogDom) {
this.setSelectedWallpaper_(selectedItem);
}
}
- this.setWallpaperAttribution_(selectedItem);
};
/**
@@ -769,7 +777,6 @@ function WallpaperManager(dialogDom) {
self.currentWallpaper_ = fileName;
var items = {};
items[self.currentWallpaper_] = layout;
- self.storage_.set(items, function() {});
self.wallpaperGrid_.dataModel.splice(0, 0, wallpaperInfo);
self.wallpaperGrid_.selectedItem = wallpaperInfo;
self.wallpaperGrid_.activeItem = wallpaperInfo;
« no previous file with comments | « chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_images_grid.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698