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 // 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 const EMPTY_IMAGE_URI = 'data:image/gif;base64,' | 7 const EMPTY_IMAGE_URI = 'data:image/gif;base64,' |
8 + 'R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D'; | 8 + 'R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D'; |
9 | 9 |
10 var g_slideshow_data = null; | 10 var g_slideshow_data = null; |
(...skipping 1583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1594 var fileName = event.sourceUrl.substr( | 1594 var fileName = event.sourceUrl.substr( |
1595 event.sourceUrl.lastIndexOf('/') + 1); | 1595 event.sourceUrl.lastIndexOf('/') + 1); |
1596 self.alert.show(strf('ARCHIVE_MOUNT_FAILED', fileName, | 1596 self.alert.show(strf('ARCHIVE_MOUNT_FAILED', fileName, |
1597 event.status)); | 1597 event.status)); |
1598 } | 1598 } |
1599 } | 1599 } |
1600 return; | 1600 return; |
1601 } | 1601 } |
1602 } | 1602 } |
1603 } | 1603 } |
| 1604 |
| 1605 if (event.eventType == 'unmount' && event.status == 'success' && |
| 1606 self.currentDirEntry_ && |
| 1607 isParentPath(event.mountPath, self.currentDirEntry_.fullPath)) { |
| 1608 self.changeDirectory(getParentPath(event.mountPath)); |
| 1609 return; |
| 1610 } |
| 1611 |
1604 // TODO(dgozman): rescan directory, only if it contains mounted points, | 1612 // TODO(dgozman): rescan directory, only if it contains mounted points, |
1605 // when mounts location will be decided. | 1613 // when mounts location will be decided. |
1606 this.rescanDirectory_(); | 1614 if (event.status == 'success') |
| 1615 self.rescanDirectory_(); |
1607 }); | 1616 }); |
1608 }; | 1617 }; |
1609 | 1618 |
1610 /** | 1619 /** |
1611 * Event handler called when some internal task should be executed. | 1620 * Event handler called when some internal task should be executed. |
1612 */ | 1621 */ |
1613 FileManager.prototype.onFileTaskExecute_ = function(id, details) { | 1622 FileManager.prototype.onFileTaskExecute_ = function(id, details) { |
1614 var urls = details.entries.map(function(entry) { | 1623 var urls = details.entries.map(function(entry) { |
1615 return entry.toURL(); | 1624 return entry.toURL(); |
1616 }); | 1625 }); |
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2251 chrome.test.sendMessage('directory-change-complete'); | 2260 chrome.test.sendMessage('directory-change-complete'); |
2252 }); | 2261 }); |
2253 }; | 2262 }; |
2254 | 2263 |
2255 /** | 2264 /** |
2256 * Update the UI when a disk is mounted or unmounted. | 2265 * Update the UI when a disk is mounted or unmounted. |
2257 * | 2266 * |
2258 * @param {string} path The path that has been mounted or unmounted. | 2267 * @param {string} path The path that has been mounted or unmounted. |
2259 */ | 2268 */ |
2260 FileManager.prototype.onDiskChanged_ = function(event) { | 2269 FileManager.prototype.onDiskChanged_ = function(event) { |
2261 if (event.eventType == 'added') { | |
2262 this.changeDirectory(event.volumeInfo.mountPath); | |
2263 } else if (event.eventType == 'removed') { | |
2264 if (this.currentDirEntry_ && | |
2265 isParentPath(event.volumeInfo.mountPath, | |
2266 this.currentDirEntry_.fullPath)) { | |
2267 this.changeDirectory(getParentPath(event.volumeInfo.mountPath)); | |
2268 } | |
2269 } | |
2270 }; | 2270 }; |
2271 | 2271 |
2272 /** | 2272 /** |
2273 * Rescan the current directory, refreshing the list. | 2273 * Rescan the current directory, refreshing the list. |
2274 * | 2274 * |
2275 * @param {function()} opt_callback Optional function to invoke when the | 2275 * @param {function()} opt_callback Optional function to invoke when the |
2276 * rescan is complete. | 2276 * rescan is complete. |
2277 */ | 2277 */ |
2278 FileManager.prototype.rescanDirectory_ = function(opt_callback) { | 2278 FileManager.prototype.rescanDirectory_ = function(opt_callback) { |
2279 var self = this; | 2279 var self = this; |
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2893 | 2893 |
2894 if (msg) { | 2894 if (msg) { |
2895 console.log('no no no'); | 2895 console.log('no no no'); |
2896 this.alert.show(msg, onAccept); | 2896 this.alert.show(msg, onAccept); |
2897 return false; | 2897 return false; |
2898 } | 2898 } |
2899 | 2899 |
2900 return true; | 2900 return true; |
2901 }; | 2901 }; |
2902 })(); | 2902 })(); |
OLD | NEW |