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 // Setting the src of an img to an empty string can crash the browser, so we | 5 // Setting the src of an img to an empty string can crash the browser, so we |
6 // use an empty 1x1 gif instead. | 6 // use an empty 1x1 gif instead. |
7 | 7 |
8 /** | 8 /** |
9 * FileManager constructor. | 9 * FileManager constructor. |
10 * | 10 * |
(...skipping 2817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2828 var position = 0; | 2828 var position = 0; |
2829 if (urls.length == 1) { | 2829 if (urls.length == 1) { |
2830 // If just a single audio file is selected pass along every audio file | 2830 // If just a single audio file is selected pass along every audio file |
2831 // in the directory. | 2831 // in the directory. |
2832 var selectedUrl = urls[0]; | 2832 var selectedUrl = urls[0]; |
2833 urls = this.getAllUrlsInCurrentDirectory_().filter(FileType.isAudio); | 2833 urls = this.getAllUrlsInCurrentDirectory_().filter(FileType.isAudio); |
2834 position = urls.indexOf(selectedUrl); | 2834 position = urls.indexOf(selectedUrl); |
2835 } | 2835 } |
2836 chrome.mediaPlayerPrivate.play(urls, position); | 2836 chrome.mediaPlayerPrivate.play(urls, position); |
2837 } else if (id == 'mount-archive') { | 2837 } else if (id == 'mount-archive') { |
2838 for (var index = 0; index < urls.length; ++index) { | 2838 var self = this; |
2839 // Url in MountCompleted event won't be escaped, so let's make sure | 2839 this.resolveSelectResults_(urls, function(urls) { |
2840 // we don't use escaped one in mountRequests_. | 2840 for (var index = 0; index < urls.length; ++index) { |
2841 var unescapedUrl = unescape(urls[index]); | 2841 // Url in MountCompleted event won't be escaped, so let's make sure |
2842 this.mountRequests_.push(unescapedUrl); | 2842 // we don't use escaped one in mountRequests_. |
2843 chrome.fileBrowserPrivate.addMount(unescapedUrl, 'file', {}); | 2843 var unescapedUrl = unescape(urls[index]); |
2844 } | 2844 self.mountRequests_.push(unescapedUrl); |
| 2845 chrome.fileBrowserPrivate.addMount(unescapedUrl, 'file', {}); |
| 2846 } |
| 2847 }); |
2845 } else if (id == 'format-device') { | 2848 } else if (id == 'format-device') { |
2846 this.confirm.show(str('FORMATTING_WARNING'), function() { | 2849 this.confirm.show(str('FORMATTING_WARNING'), function() { |
2847 chrome.fileBrowserPrivate.formatDevice(urls[0]); | 2850 chrome.fileBrowserPrivate.formatDevice(urls[0]); |
2848 }); | 2851 }); |
2849 } else if (id == 'gallery') { | 2852 } else if (id == 'gallery') { |
2850 this.openGallery_(urls); | 2853 this.openGallery_(urls); |
2851 } else if (id == 'view-pdf' || id == 'view-in-browser' || | 2854 } else if (id == 'view-pdf' || id == 'view-in-browser' || |
2852 id == 'install-crx' || id == 'open-hosted') { | 2855 id == 'install-crx' || id == 'open-hosted') { |
2853 chrome.fileBrowserPrivate.viewFiles(urls, 'default', function(success) { | 2856 chrome.fileBrowserPrivate.viewFiles(urls, 'default', function(success) { |
2854 if (!success) | 2857 if (!success) |
(...skipping 1595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4450 | 4453 |
4451 chrome.fileBrowserPrivate.setGDataPreferences(changeInfo); | 4454 chrome.fileBrowserPrivate.setGDataPreferences(changeInfo); |
4452 | 4455 |
4453 if (oldValue) { | 4456 if (oldValue) { |
4454 event.target.removeAttribute('checked'); | 4457 event.target.removeAttribute('checked'); |
4455 } else { | 4458 } else { |
4456 event.target.setAttribute('checked', 'checked'); | 4459 event.target.setAttribute('checked', 'checked'); |
4457 } | 4460 } |
4458 }; | 4461 }; |
4459 })(); | 4462 })(); |
OLD | NEW |