diff options
author | ivankr@chromium.org <ivankr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-12 13:43:02 +0000 |
---|---|---|
committer | ivankr@chromium.org <ivankr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-12 13:43:02 +0000 |
commit | 19fbfc885e530c6122428177f834172ee2ace8ee (patch) | |
tree | 1dc8faaa7e6b8300d330e0a8834e76e3f292e8e6 /chrome/browser/resources/options | |
parent | f626ee5e06374a78696faf795a3dcec3ff584e40 (diff) | |
download | chromium_src-19fbfc885e530c6122428177f834172ee2ace8ee.zip chromium_src-19fbfc885e530c6122428177f834172ee2ace8ee.tar.gz chromium_src-19fbfc885e530c6122428177f834172ee2ace8ee.tar.bz2 |
[cros] Profile image no longer selected when user clicks Take Photo/Choose File buttons.
BUG=chromium-os:23237
TEST=Manual: see bug description; choosing any user picture on Change Picture pref page should work.
Review URL: http://codereview.chromium.org/8879015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114014 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/resources/options')
-rw-r--r-- | chrome/browser/resources/options/chromeos/change_picture_options.js | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/chrome/browser/resources/options/chromeos/change_picture_options.js b/chrome/browser/resources/options/chromeos/change_picture_options.js index 338ce53..2416e37 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 */ |