summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkaznacheev@chromium.org <kaznacheev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-01 16:11:40 +0000
committerkaznacheev@chromium.org <kaznacheev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-01 16:11:40 +0000
commit6cef305bfaada60cecd6aea1d1a676ec60c01d4a (patch)
treee877017546b5fbbc92baa9dc1e10a83169120777
parent45647af87d1e7e5ed607c6fd82a1ac32a708a725 (diff)
downloadchromium_src-6cef305bfaada60cecd6aea1d1a676ec60c01d4a.zip
chromium_src-6cef305bfaada60cecd6aea1d1a676ec60c01d4a.tar.gz
chromium_src-6cef305bfaada60cecd6aea1d1a676ec60c01d4a.tar.bz2
Photo Editor: Fix the Share button
BUG=chromium-os:23608,chromium-os:23609 TEST= Review URL: http://codereview.chromium.org/8773008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112470 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/resources/file_manager/js/image_editor/gallery.js24
1 files changed, 15 insertions, 9 deletions
diff --git a/chrome/browser/resources/file_manager/js/image_editor/gallery.js b/chrome/browser/resources/file_manager/js/image_editor/gallery.js
index 8af4942..b74dc13 100644
--- a/chrome/browser/resources/file_manager/js/image_editor/gallery.js
+++ b/chrome/browser/resources/file_manager/js/image_editor/gallery.js
@@ -172,10 +172,9 @@ Gallery.prototype.initDom_ = function(shareActions) {
if (shareActions.length > 0) {
this.shareMode_ = new ShareMode(
- this.container_, this.toolbar_, shareActions,
+ this.editor_, this.container_, this.toolbar_, shareActions,
this.onShare_.bind(this), this.onActionExecute_.bind(this),
this.displayStringFunction_);
-
} else {
this.shareMode_ = null;
}
@@ -363,10 +362,15 @@ Gallery.prototype.isEditing_ = function() {
Gallery.prototype.onEdit_ = function() {
ImageUtil.setAttribute(this.container_, 'editing', !this.isEditing_());
+ // The user has just clicked on the Edit button. Dismiss the Share menu.
+ if (this.isSharing_()) {
+ this.onShare_();
+ }
+
// isEditing_ has just been flipped to a new value.
if (this.isEditing_()) {
this.cancelFading_();
- } else if (!this.isSharing_()) {
+ } else {
var item = this.ribbon_.getSelectedItem();
this.editor_.requestImage(item.updateThumbnail.bind(item));
this.initiateFading_();
@@ -1045,18 +1049,20 @@ Ribbon.Item.prototype.setMetadata = function(metadata) {
}
};
-function ShareMode(container, toolbar, shareActions,
+function ShareMode(editor, container, toolbar, shareActions,
onClick, actionCallback, displayStringFunction) {
ImageEditor.Mode.call(this, 'share');
this.message_ = null;
var doc = container.ownerDocument;
- this.button_ = doc.createElement('div');
- this.button_.className = 'button share';
- this.button_.textContent = displayStringFunction('share');
- this.button_.addEventListener('click', onClick);
- toolbar.appendChild(this.button_);
+ var button = doc.createElement('div');
+ button.className = 'button share';
+ button.textContent = displayStringFunction('share');
+ button.addEventListener('click', onClick);
+ toolbar.appendChild(button);
+
+ this.bind(editor, button);
this.menu_ = doc.createElement('div');
this.menu_.className = 'share-menu';