| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 * Namespace for utility functions. | 6 * Namespace for utility functions. |
| 7 */ | 7 */ |
| 8 var util = { | 8 var util = { |
| 9 /** | 9 /** |
| 10 * Returns a function that console.log's its arguments, prefixed by |msg|. | 10 * Returns a function that console.log's its arguments, prefixed by |msg|. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 getFileErrorMnemonic: function(code) { | 51 getFileErrorMnemonic: function(code) { |
| 52 for (var key in FileError) { | 52 for (var key in FileError) { |
| 53 if (key.search(/_ERR$/) != -1 && FileError[key] == code) | 53 if (key.search(/_ERR$/) != -1 && FileError[key] == code) |
| 54 return key; | 54 return key; |
| 55 } | 55 } |
| 56 | 56 |
| 57 return code; | 57 return code; |
| 58 }, | 58 }, |
| 59 | 59 |
| 60 htmlUnescape: function(str) { |
| 61 return str.replace(/&(lt|gt|amp);/g, function(entity) { |
| 62 switch (entity) { |
| 63 case '<': return '<'; |
| 64 case '>': return '>'; |
| 65 case '&': return '&'; |
| 66 } |
| 67 }); |
| 68 }, |
| 69 |
| 60 /** | 70 /** |
| 61 * Given a list of Entries, recurse any DirectoryEntries, and call back | 71 * Given a list of Entries, recurse any DirectoryEntries, and call back |
| 62 * with a list of all file and directory entries encountered (including the | 72 * with a list of all file and directory entries encountered (including the |
| 63 * original set). | 73 * original set). |
| 64 */ | 74 */ |
| 65 recurseAndResolveEntries: function(entries, successCallback, errorCallback) { | 75 recurseAndResolveEntries: function(entries, successCallback, errorCallback) { |
| 66 var pendingSubdirectories = 0; | 76 var pendingSubdirectories = 0; |
| 67 var pendingFiles = 0; | 77 var pendingFiles = 0; |
| 68 | 78 |
| 69 var dirEntries = []; | 79 var dirEntries = []; |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 if (typeof(arg) == 'string') { | 384 if (typeof(arg) == 'string') { |
| 375 element.appendChild(document.createTextNode(arg)); | 385 element.appendChild(document.createTextNode(arg)); |
| 376 } else { | 386 } else { |
| 377 element.appendChild(arg); | 387 element.appendChild(arg); |
| 378 } | 388 } |
| 379 } | 389 } |
| 380 | 390 |
| 381 return element; | 391 return element; |
| 382 } | 392 } |
| 383 }; | 393 }; |
| OLD | NEW |