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 * Namespace for utility functions. | 6 * Namespace for utility functions. |
7 */ | 7 */ |
8 var util = {}; | 8 var util = {}; |
9 | 9 |
10 /** | 10 /** |
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 result.fileName.slice(result.fileName.indexOf('.') + 1); | 640 result.fileName.slice(result.fileName.indexOf('.') + 1); |
641 result.resourceId = | 641 result.resourceId = |
642 result.fileName.substr(0, result.fileName.indexOf('.')); | 642 result.fileName.substr(0, result.fileName.indexOf('.')); |
643 | 643 |
644 if (result.fileName.length > 0 && result.displayName.length > 0) { | 644 if (result.fileName.length > 0 && result.displayName.length > 0) { |
645 return result; | 645 return result; |
646 } else { | 646 } else { |
647 return null; | 647 return null; |
648 } | 648 } |
649 }; | 649 }; |
| 650 |
| 651 /** |
| 652 * Makes filesystem: URL from the path. |
| 653 * @param {string} path File or directory path. |
| 654 * @return {string} URL. |
| 655 */ |
| 656 util.makeFilesystemUrl = function(path) { |
| 657 return 'filesystem:' + chrome.extension.getURL('external' + path); |
| 658 }; |
OLD | NEW |