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

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

Issue 10532048: [cros] Initial WebRTC-enabled implementation of user image picker on OOBE. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Revert ImageDecoder changes. Created 8 years, 6 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/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;
}
},

Powered by Google App Engine
This is Rietveld 408576698