Index: chrome/browser/resources/chromeos/user_images_grid.js |
diff --git a/chrome/browser/resources/chromeos/user_images_grid.js b/chrome/browser/resources/chromeos/user_images_grid.js |
index f22f5db0648c62ae746714061f8ffea053f94e89..f252379e0a2a980c54043e2b1dc1785a684a7733 100644 |
--- a/chrome/browser/resources/chromeos/user_images_grid.js |
+++ b/chrome/browser/resources/chromeos/user_images_grid.js |
@@ -211,6 +211,11 @@ cr.define('options', function() { |
imageInfo.clickHandler, |
imageIndex, |
imageInfo.decorateFn); |
+ // Update image data with the reset of the keys from the old data. |
+ for (k in imageInfo) { |
+ if (!(k in newInfo)) |
+ newInfo[k] = imageInfo[k]; |
+ } |
if (wasSelected) |
this.selectedItem = newInfo; |
return newInfo; |
@@ -223,8 +228,14 @@ cr.define('options', function() { |
removeItem: function(imageInfo) { |
var index = this.indexOf(imageInfo); |
if (index != -1) { |
+ var wasSelected = this.selectionModel.selectedIndex == index; |
this.inProgramSelection_ = true; |
this.dataModel.splice(index, 1); |
+ if (wasSelected) { |
+ // If item removed was selected, select the item next to it. |
+ this.selectedItem = this.dataModel.item( |
+ Math.min(this.dataModel.length - 1, index)); |
+ } |
this.inProgramSelection_ = false; |
} |
}, |