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 // If directory files changes too often, don't rescan directory more than once | 5 // If directory files changes too often, don't rescan directory more than once |
6 // per specified interval | 6 // per specified interval |
7 var SIMULTANEOUS_RESCAN_INTERVAL = 500; | 7 var SIMULTANEOUS_RESCAN_INTERVAL = 500; |
8 // Used for operations that require almost instant rescan. | 8 // Used for operations that require almost instant rescan. |
9 var SHORT_RESCAN_INTERVAL = 100; | 9 var SHORT_RESCAN_INTERVAL = 100; |
10 | 10 |
(...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
996 !this.volumeManager_.getVolumeInfo(this.getCurrentDirEntry())) { | 996 !this.volumeManager_.getVolumeInfo(this.getCurrentDirEntry())) { |
997 this.volumeManager_.getDefaultDisplayRoot(function(displayRoot) { | 997 this.volumeManager_.getDefaultDisplayRoot(function(displayRoot) { |
998 this.changeDirectoryEntry(displayRoot); | 998 this.changeDirectoryEntry(displayRoot); |
999 }.bind(this)); | 999 }.bind(this)); |
1000 } | 1000 } |
1001 | 1001 |
1002 // If a new provided volume is mounted, then redirect to it in the focused | 1002 // If a new provided volume is mounted, then redirect to it in the focused |
1003 // window. Note, that this is a temporary solution for crbug.com/427776. | 1003 // window. Note, that this is a temporary solution for crbug.com/427776. |
1004 if (window.isFocused() && | 1004 if (window.isFocused() && |
1005 event.added.length === 1 && | 1005 event.added.length === 1 && |
1006 event.added[0].volumeType == | 1006 event.added[0].volumeType === VolumeManagerCommon.VolumeType.PROVIDED) { |
1007 VolumeManagerCommon.VolumeType.VOLUME_TYPE_PROVIDED && | 1007 event.added[0].resolveDisplayRoot().then(function(displayRoot) { |
1008 event.added[0].displayRoot) { | 1008 // Resolving a display root on FSP volumes is instant, despite the |
1009 this.changeDirectoryEntry(event.added[0].displayRoot); | 1009 // asynchronous call. |
| 1010 this.changeDirectoryEntry(event.added[0].displayRoot); |
| 1011 }.bind(this)); |
1010 } | 1012 } |
1011 }; | 1013 }; |
1012 | 1014 |
1013 /** | 1015 /** |
1014 * Creates directory contents for the entry and query. | 1016 * Creates directory contents for the entry and query. |
1015 * | 1017 * |
1016 * @param {FileListContext} context File list context. | 1018 * @param {FileListContext} context File list context. |
1017 * @param {DirectoryEntry} entry Current directory. | 1019 * @param {DirectoryEntry} entry Current directory. |
1018 * @param {string=} opt_query Search query string. | 1020 * @param {string=} opt_query Search query string. |
1019 * @return {DirectoryContents} Directory contents. | 1021 * @return {DirectoryContents} Directory contents. |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1135 if (this.onSearchCompleted_) { | 1137 if (this.onSearchCompleted_) { |
1136 this.removeEventListener('scan-completed', this.onSearchCompleted_); | 1138 this.removeEventListener('scan-completed', this.onSearchCompleted_); |
1137 this.onSearchCompleted_ = null; | 1139 this.onSearchCompleted_ = null; |
1138 } | 1140 } |
1139 | 1141 |
1140 if (this.onClearSearch_) { | 1142 if (this.onClearSearch_) { |
1141 this.onClearSearch_(); | 1143 this.onClearSearch_(); |
1142 this.onClearSearch_ = null; | 1144 this.onClearSearch_ = null; |
1143 } | 1145 } |
1144 }; | 1146 }; |
OLD | NEW |