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

Unified Diff: chrome/browser/resources/shared/js/cr/ui/menu_item.js

Issue 10377169: Added menuItem icon support, and little API for menu modification. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added separator API. Simplified code. Created 8 years, 7 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
« no previous file with comments | « chrome/browser/resources/shared/js/cr/ui/menu.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/shared/js/cr/ui/menu_item.js
diff --git a/chrome/browser/resources/shared/js/cr/ui/menu_item.js b/chrome/browser/resources/shared/js/cr/ui/menu_item.js
index 667d2f0c539ce26fb77acad8cb6176b70f950248..5b1ce65338d05bef1bbb0ee05db8631a7ad74026 100644
--- a/chrome/browser/resources/shared/js/cr/ui/menu_item.js
+++ b/chrome/browser/resources/shared/js/cr/ui/menu_item.js
@@ -39,6 +39,10 @@ cr.define('cr.ui', function() {
// Adding the 'custom-appearance' class prevents widgets.css from changing
// the appearance of this element.
this.classList.add('custom-appearance');
+
+ var iconUrl;
+ if ((iconUrl = this.getAttribute('icon')))
+ this.iconUrl = iconUrl;
James Hawkins 2012/05/16 17:12:18 Why not: this.iconUrl = this.getAttribute('icon')
Dmitry Zvorygin 2012/05/17 12:11:15 We don't want to set iconUrl to 'undefined'. Just
},
/**
@@ -92,6 +96,17 @@ cr.define('cr.ui', function() {
},
/**
+ * Menu icon.
+ * @type {string}
+ */
+ get iconUrl() {
+ return this.style.backgroundImage;
+ },
+ set iconUrl(url) {
+ this.style.backgroundImage = 'url(' + url + ')';
+ },
+
+ /**
* @return {boolean} Whether the menu item is a separator.
*/
isSeparator: function() {
« no previous file with comments | « chrome/browser/resources/shared/js/cr/ui/menu.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698