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 /** | 5 /** |
6 * Wrapper for chrome.send. | 6 * Wrapper for chrome.send. |
7 */ | 7 */ |
8 function chromeSend(func, arg) { | 8 function chromeSend(func, arg) { |
9 if (arg == undefined) | 9 if (arg == undefined) |
10 arg = ''; | 10 arg = ''; |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 var elem = document.createElement('li'); | 226 var elem = document.createElement('li'); |
227 elem.className = 'downloadrow'; | 227 elem.className = 'downloadrow'; |
228 elem.id = this.path; | 228 elem.id = this.path; |
229 elem.row = this; | 229 elem.row = this; |
230 this.element = elem; | 230 this.element = elem; |
231 | 231 |
232 list.append(this); | 232 list.append(this); |
233 }, | 233 }, |
234 | 234 |
235 setDangerousIcon_: function(warning) { | 235 setDangerousIcon_: function(warning) { |
| 236 var escapedPath = encodeURIComponent(this.path).replace(/'/g,'%27'); |
236 this.icon.className = warning ? 'iconwarning' : 'icon'; | 237 this.icon.className = warning ? 'iconwarning' : 'icon'; |
237 this.icon.style.background = warning ? '' : | 238 this.icon.style.background = warning ? '' : |
238 'url(chrome://fileicon' + escape(this.path) + | 239 'url(\'chrome://fileicon/' + escapedPath + |
239 '?iconsize=small) no-repeat'; | 240 '?iconsize=small\') no-repeat'; |
240 }, | 241 }, |
241 | 242 |
242 /** | 243 /** |
243 * Create the row button for the left of the row. | 244 * Create the row button for the left of the row. |
244 * This contains the icon, filename and error elements. | 245 * This contains the icon, filename and error elements. |
245 * @private | 246 * @private |
246 */ | 247 */ |
247 createRowButton_: function () { | 248 createRowButton_: function () { |
248 this.rowbutton = createChild('div', 'rowbutton rowbg', this.element); | 249 this.rowbutton = createChild('div', 'rowbutton rowbg', this.element); |
249 | 250 |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 update: function(result) { | 624 update: function(result) { |
624 var row = this.getRow(result.file_path); | 625 var row = this.getRow(result.file_path); |
625 if (!row && !DiscardResult(result)) | 626 if (!row && !DiscardResult(result)) |
626 row = new DownloadRow(this, result); | 627 row = new DownloadRow(this, result); |
627 | 628 |
628 row && row.update(result); | 629 row && row.update(result); |
629 }, | 630 }, |
630 }; | 631 }; |
631 | 632 |
632 document.addEventListener('DOMContentLoaded', init); | 633 document.addEventListener('DOMContentLoaded', init); |
OLD | NEW |