| OLD | NEW |
| 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 'use strict'; | 5 'use strict'; |
| 6 | 6 |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * DefaultActionDialog contains a message, a list box, an ok button, and a | 9 * DefaultActionDialog contains a message, a list box, an ok button, and a |
| 10 * cancel button. | 10 * cancel button. |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 /** | 62 /** |
| 63 * Renders item for list. | 63 * Renders item for list. |
| 64 * @param {Object} item Item to render. | 64 * @param {Object} item Item to render. |
| 65 */ | 65 */ |
| 66 DefaultActionDialog.prototype.renderItem = function(item) { | 66 DefaultActionDialog.prototype.renderItem = function(item) { |
| 67 var result = this.document_.createElement('li'); | 67 var result = this.document_.createElement('li'); |
| 68 | 68 |
| 69 var div = this.document_.createElement('div'); | 69 var div = this.document_.createElement('div'); |
| 70 div.textContent = item.label; | 70 div.textContent = item.label; |
| 71 | 71 |
| 72 if (item.iconType) | 72 if (item.iconType) { |
| 73 div.setAttribute('file-type-icon', item.iconType); | 73 div.setAttribute('file-type-icon', item.iconType); |
| 74 | 74 } else if (item.iconUrl) { |
| 75 if (item.iconUrl) | |
| 76 div.style.backgroundImage = 'url(' + item.iconUrl + ')'; | 75 div.style.backgroundImage = 'url(' + item.iconUrl + ')'; |
| 76 } |
| 77 | 77 |
| 78 if (item.class) | 78 if (item.class) |
| 79 div.classList.add(item.class); | 79 div.classList.add(item.class); |
| 80 | 80 |
| 81 result.appendChild(div); | 81 result.appendChild(div); |
| 82 | 82 |
| 83 cr.defineProperty(result, 'lead', cr.PropertyKind.BOOL_ATTR); | 83 cr.defineProperty(result, 'lead', cr.PropertyKind.BOOL_ATTR); |
| 84 cr.defineProperty(result, 'selected', cr.PropertyKind.BOOL_ATTR); | 84 cr.defineProperty(result, 'selected', cr.PropertyKind.BOOL_ATTR); |
| 85 | 85 |
| 86 return result; | 86 return result; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 this.onCancelClick_(event); | 144 this.onCancelClick_(event); |
| 145 event.preventDefault(); | 145 event.preventDefault(); |
| 146 } else if (event.keyCode == 32 || event.keyCode == 13) { | 146 } else if (event.keyCode == 32 || event.keyCode == 13) { |
| 147 this.onOkClick_(); | 147 this.onOkClick_(); |
| 148 event.preventDefault(); | 148 event.preventDefault(); |
| 149 } | 149 } |
| 150 }; | 150 }; |
| 151 | 151 |
| 152 return {DefaultActionDialog: DefaultActionDialog}; | 152 return {DefaultActionDialog: DefaultActionDialog}; |
| 153 }); | 153 }); |
| OLD | NEW |