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

Unified Diff: chrome/browser/resources/file_manager/js/combobutton.js

Issue 10790100: [File Manager] Support HiDPI images in action picker and default action picker (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 5 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: chrome/browser/resources/file_manager/js/combobutton.js
diff --git a/chrome/browser/resources/file_manager/js/combobutton.js b/chrome/browser/resources/file_manager/js/combobutton.js
index 7c2fcf1711cdf191664594f21a177764b4ba2cf5..f702452f543ca9e9826468dc44fb957cd57448b1 100644
--- a/chrome/browser/resources/file_manager/js/combobutton.js
+++ b/chrome/browser/resources/file_manager/js/combobutton.js
@@ -31,7 +31,12 @@ cr.define('cr.ui', function() {
addDropDownItem: function(item) {
this.multiple = true;
- this.menu.addMenuItem(item).data = item;
+ var menuitem = this.menu.addMenuItem(item);
+ menuitem.data = item;
+ if (item.iconType) {
+ menuitem.style.backgroundImage = '';
+ menuitem.setAttribute('file-type-icon', item.iconType);
+ }
},
/**
@@ -49,16 +54,17 @@ cr.define('cr.ui', function() {
},
set defaultItem(defaultItem) {
this.defaultItem_ = defaultItem;
- if (defaultItem.label) {
- this.labelNode_.textContent = defaultItem.label;
- } else {
- this.labelNode_.textContent = '';
- }
- if (defaultItem.iconUrl) {
- this.iconNode_.src = defaultItem.iconUrl;
+ this.actionNode_.textContent = defaultItem.label || '';
+
+ if (defaultItem.iconType) {
+ this.actionNode_.style.backgroundImage = '';
+ this.actionNode_.setAttribute('file-type-icon', defaultItem.iconType);
+ } else if (defaultItem.iconUrl) {
+ this.actionNode_.style.backgroundImage =
+ 'url(' + defaultItem.iconUrl + ')';
} else {
- this.iconNode_.src = '';
+ this.actionNode_.style.backgroundImage = '';
}
},
@@ -70,15 +76,14 @@ cr.define('cr.ui', function() {
this.classList.add('combobutton');
- this.iconNode_ = this.ownerDocument.createElement('img');
- this.appendChild(this.iconNode_);
-
- this.labelNode_ = this.ownerDocument.createElement('span');
- this.appendChild(this.labelNode_);
+ this.actionNode_ = this.ownerDocument.createElement('div');
+ this.actionNode_.classList.add('action');
+ this.appendChild(this.actionNode_);
var triggerIcon = this.ownerDocument.createElement('span');
triggerIcon.className = 'disclosureindicator';
this.trigger_ = this.ownerDocument.createElement('div');
+ this.trigger_.classList.add('trigger');
this.trigger_.appendChild(triggerIcon);
this.appendChild(this.trigger_);

Powered by Google App Engine
This is Rietveld 408576698