Index: chrome/browser/resources/options/chromeos/change_picture_options.js |
diff --git a/chrome/browser/resources/options/chromeos/change_picture_options.js b/chrome/browser/resources/options/chromeos/change_picture_options.js |
index 338ce539af0c58d1706c99a6ae4eb1426e8555cc..2416e37bb7ae26bca354b8d67c1ab3190cb02baa 100644 |
--- a/chrome/browser/resources/options/chromeos/change_picture_options.js |
+++ b/chrome/browser/resources/options/chromeos/change_picture_options.js |
@@ -48,13 +48,8 @@ cr.define('options', function() { |
var imageGrid = $('images-grid'); |
UserImagesGrid.decorate(imageGrid); |
- imageGrid.addEventListener('change', function(e) { |
- // Ignore programmatical selection. |
- if (!imageGrid.inProgramSelection) { |
- // Button selections will be ignored by Chrome handler. |
- chrome.send('selectImage', [this.selectedItemUrl || '']); |
- } |
- }); |
+ imageGrid.addEventListener('change', |
+ this.handleImageSelected_.bind(this)); |
imageGrid.addEventListener('activate', |
this.handleImageActivated_.bind(this)); |
imageGrid.addEventListener('dblclick', |
@@ -120,6 +115,22 @@ cr.define('options', function() { |
}, |
/** |
+ * Handles image selection change. |
+ * @private |
+ */ |
+ handleImageSelected_: function() { |
+ var imageGrid = $('images-grid'); |
+ var url = imageGrid.selectedItemUrl; |
+ // Ignore deselection, selection change caused by program itself and |
+ // selection of one of the action buttons. |
+ if (url && |
+ !imageGrid.inProgramSelection && |
+ ButtonImageUrls.indexOf(url) == -1) { |
+ chrome.send('selectImage', [url]); |
+ } |
+ }, |
+ |
+ /** |
* Handles image activation (by pressing Enter). |
* @private |
*/ |