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

Unified Diff: chrome/browser/resources/file_manager/js/image_editor/gallery.js

Issue 8773008: Photo Editor: Fix the Share button (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/file_manager/js/image_editor/gallery.js
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 82d6abc2eb7d1261e19bdfcbf0908951f1d985af..7176fc20c97cb68b8010719fee6de0802ff4bce4 100644
--- a/chrome/browser/resources/file_manager/js/image_editor/gallery.js
+++ b/chrome/browser/resources/file_manager/js/image_editor/gallery.js
@@ -158,10 +158,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;
}
@@ -261,10 +260,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_();
@@ -939,18 +943,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';
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698