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..abdf44a1d01374a60b37bab4e7efc9f074cb2a32 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,20 @@ cr.define('options', function() { |
}, |
/** |
+ * Handles image selection change. |
+ * @private |
+ */ |
+ handleImageSelected_: function() { |
+ var imageGrid = $('images-grid'); |
+ var url = imageGrid.selectedItemUrl; |
+ // Ignore empty, programmatical and button selection. |
whywhat
2011/12/08 17:27:50
I'd rather tell reader here what empty url and pro
Ivan Korotkov
2011/12/09 09:30:23
Done.
|
+ if (!imageGrid.inProgramSelection && |
whywhat
2011/12/08 17:27:50
I'd reorder and reformat like this:
if (url &&
Ivan Korotkov
2011/12/09 09:30:23
Done.
|
+ url && ButtonImageUrls.indexOf(url) == -1) { |
+ chrome.send('selectImage', [url]); |
+ } |
+ }, |
+ |
+ /** |
* Handles image activation (by pressing Enter). |
* @private |
*/ |