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

Unified Diff: ui/file_manager/file_manager/foreground/js/ui/commandbutton.js

Issue 900743002: Move preview panel's components to toolbar and footer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a TODO comment about customized CommandButton. Created 5 years, 10 months 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
Index: ui/file_manager/file_manager/foreground/js/ui/commandbutton.js
diff --git a/ui/file_manager/file_manager/foreground/js/ui/commandbutton.js b/ui/file_manager/file_manager/foreground/js/ui/commandbutton.js
index 570dc57c1c0edf981746762045e57b06b3e49512..60f8cc088f76745a7c2469d7ea1f66ce0e209a25 100644
--- a/ui/file_manager/file_manager/foreground/js/ui/commandbutton.js
+++ b/ui/file_manager/file_manager/foreground/js/ui/commandbutton.js
@@ -88,7 +88,7 @@ CommandButton.prototype.setCommand = function(command) {
* @return {string} Button label.
*/
CommandButton.prototype.getLabel = function() {
- return this.textContent;
+ return this.command_ ? this.command_.label : '';
};
/**
@@ -96,7 +96,16 @@ CommandButton.prototype.getLabel = function() {
* @param {string} label New button label.
*/
CommandButton.prototype.setLabel = function(label) {
- this.textContent = label;
+ // Swap the textContent with current label only when this button doesn't have
+ // any elements as children.
+ //
+ // TODO(fukino): If a user customize the button content, it becomes the
+ // user's responsibility to update the content on command label's change.
+ // Updating the label in customized button content should be done
+ // automatically by specifying an element which should be synced with the
+ // command label using class name or polymer's template binding.
+ if (!this.firstElementChild)
+ this.textContent = label;
};
/**

Powered by Google App Engine
This is Rietveld 408576698