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 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 'rotate(' + transform.rotate90 * 90 + 'deg)' : | 576 'rotate(' + transform.rotate90 * 90 + 'deg)' : |
577 ''; | 577 ''; |
578 }; | 578 }; |
579 | 579 |
580 /** | 580 /** |
581 * Makes filesystem: URL from the path. | 581 * Makes filesystem: URL from the path. |
582 * @param {string} path File or directory path. | 582 * @param {string} path File or directory path. |
583 * @return {string} URL. | 583 * @return {string} URL. |
584 */ | 584 */ |
585 util.makeFilesystemUrl = function(path) { | 585 util.makeFilesystemUrl = function(path) { |
| 586 path = path.split('/').map(encodeURIComponent).join('/'); |
586 return 'filesystem:' + chrome.extension.getURL('external' + path); | 587 return 'filesystem:' + chrome.extension.getURL('external' + path); |
587 }; | 588 }; |
588 | 589 |
589 /** | 590 /** |
590 * Extracts path from filesystem: URL. | 591 * Extracts path from filesystem: URL. |
591 * @param {string} url Filesystem URL. | 592 * @param {string} url Filesystem URL. |
592 * @return {string} The path. | 593 * @return {string} The path. |
593 */ | 594 */ |
594 util.extractFilePath = function(url) { | 595 util.extractFilePath = function(url) { |
595 var path = /^filesystem:[\w-]*:\/\/[\w]*\/(external|persistent)(\/.*)$/. | 596 var path = /^filesystem:[\w-]*:\/\/[\w]*\/(external|persistent)(\/.*)$/. |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 * Wrapper function to make dealing with translated strings more concise. | 684 * Wrapper function to make dealing with translated strings more concise. |
684 * Equivilant to loadTimeData.getStringF(id, ...). | 685 * Equivilant to loadTimeData.getStringF(id, ...). |
685 * | 686 * |
686 * @param {string} id The id of the string to return. | 687 * @param {string} id The id of the string to return. |
687 * @param {...string} var_args The values to replace into the string. | 688 * @param {...string} var_args The values to replace into the string. |
688 * @return {string} The translated string with replaced values. | 689 * @return {string} The translated string with replaced values. |
689 */ | 690 */ |
690 function strf(id, var_args) { | 691 function strf(id, var_args) { |
691 return loadTimeData.getStringF.apply(loadTimeData, arguments); | 692 return loadTimeData.getStringF.apply(loadTimeData, arguments); |
692 } | 693 } |
OLD | NEW |