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

Side by Side Diff: chrome/browser/resources/file_manager/js/default_action_dialog.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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 5
6 /** 6 /**
7 * DefaultActionDialog contains a message, a list box, an ok button, and a 7 * DefaultActionDialog contains a message, a list box, an ok button, and a
8 * cancel button. 8 * cancel button.
9 * This dialog should be used as action picker for file operations. 9 * This dialog should be used as action picker for file operations.
10 */ 10 */
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 this.list_.select(); 53 this.list_.select();
54 }; 54 };
55 55
56 /** 56 /**
57 * Renders item for list. 57 * Renders item for list.
58 * @param {Object} item Item to render. 58 * @param {Object} item Item to render.
59 */ 59 */
60 DefaultActionDialog.prototype.renderItem = function(item) { 60 DefaultActionDialog.prototype.renderItem = function(item) {
61 var result = this.document_.createElement('li'); 61 var result = this.document_.createElement('li');
62 62
63 var iconNode = this.document_.createElement('img'); 63 var div = this.document_.createElement('div');
64 iconNode.src = item.iconUrl; 64 div.textContent = item.label;
65 result.appendChild(iconNode);
66 65
67 var labelNode = this.document_.createElement('span'); 66 if (item.iconType)
68 labelNode.textContent = item.label; 67 div.setAttribute('file-type-icon', item.iconType);
69 result.appendChild(labelNode); 68 else
69 div.style.backgroundImage = 'url(' + item.iconUrl + ')';
70
71 result.appendChild(div);
70 72
71 cr.defineProperty(result, 'lead', cr.PropertyKind.BOOL_ATTR); 73 cr.defineProperty(result, 'lead', cr.PropertyKind.BOOL_ATTR);
72 cr.defineProperty(result, 'selected', cr.PropertyKind.BOOL_ATTR); 74 cr.defineProperty(result, 'selected', cr.PropertyKind.BOOL_ATTR);
73 75
74 return result; 76 return result;
75 } 77 };
76 78
77 /** 79 /**
78 * Shows dialog. 80 * Shows dialog.
79 * 81 *
80 * @param {String} message Message in dialog caption. 82 * @param {String} message Message in dialog caption.
81 * @param {Array} items Items to render in list 83 * @param {Array} items Items to render in list
82 * @param {int} defaultIndex Item to select by default. 84 * @param {int} defaultIndex Item to select by default.
83 * @param {Function} onOk Callback function. 85 * @param {Function} onOk Callback function.
84 * @param {Function} onCancel Callback function. 86 * @param {Function} onCancel Callback function.
85 * @param {Function} onShow Callback function. 87 * @param {Function} onShow Callback function.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 this.onCancelClick_(event); 130 this.onCancelClick_(event);
129 event.preventDefault(); 131 event.preventDefault();
130 } else if (event.keyCode == 32 || event.keyCode == 13) { 132 } else if (event.keyCode == 32 || event.keyCode == 13) {
131 this.onOkClick_(); 133 this.onOkClick_();
132 event.preventDefault(); 134 event.preventDefault();
133 } 135 }
134 }; 136 };
135 137
136 return {DefaultActionDialog: DefaultActionDialog}; 138 return {DefaultActionDialog: DefaultActionDialog};
137 }); 139 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/file_manager/js/combobutton.js ('k') | chrome/browser/resources/file_manager/js/file_manager.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698