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 'use strict'; | 5 'use strict'; |
6 | 6 |
7 // If directory files changes too often, don't rescan directory more than once | 7 // If directory files changes too often, don't rescan directory more than once |
8 // per specified interval | 8 // per specified interval |
9 var SIMULTANEOUS_RESCAN_INTERVAL = 1000; | 9 var SIMULTANEOUS_RESCAN_INTERVAL = 1000; |
10 // Used for operations that require almost instant rescan. | 10 // Used for operations that require almost instant rescan. |
(...skipping 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1029 dirEntry, driveRoot, query, searchOption); | 1029 dirEntry, driveRoot, query, searchOption); |
1030 var previous = this.currentDirContents_.getDirectoryEntry(); | 1030 var previous = this.currentDirContents_.getDirectoryEntry(); |
1031 this.clearAndScan_(newDirContents); | 1031 this.clearAndScan_(newDirContents); |
1032 | 1032 |
1033 var e = new Event('directory-changed'); | 1033 var e = new Event('directory-changed'); |
1034 e.previousDirEntry = previous; | 1034 e.previousDirEntry = previous; |
1035 e.newDirEntry = dirEntry; | 1035 e.newDirEntry = dirEntry; |
1036 this.dispatchEvent(e); | 1036 this.dispatchEvent(e); |
1037 }.bind(this, this.changeDirectorySequence_); | 1037 }.bind(this, this.changeDirectorySequence_); |
1038 | 1038 |
1039 // TODO(hirono): We don't need to obtain the drive root to search. | 1039 volumeInfo.resolveDisplayRoot( |
1040 this.resolveDirectory(volumeInfo.fakeEntries[RootType.DRIVE].fullPath, | 1040 onDriveDirectoryResolved /* success */, function() {} /* failed */); |
1041 onDriveDirectoryResolved /* success */, | |
1042 function() {} /* failed */); | |
1043 }; | 1041 }; |
1044 | 1042 |
1045 /** | 1043 /** |
1046 * In case the search was active, remove listeners and send notifications on | 1044 * In case the search was active, remove listeners and send notifications on |
1047 * its canceling. | 1045 * its canceling. |
1048 * @private | 1046 * @private |
1049 */ | 1047 */ |
1050 DirectoryModel.prototype.clearSearch_ = function() { | 1048 DirectoryModel.prototype.clearSearch_ = function() { |
1051 if (!this.isSearching()) | 1049 if (!this.isSearching()) |
1052 return; | 1050 return; |
1053 | 1051 |
1054 if (this.onSearchCompleted_) { | 1052 if (this.onSearchCompleted_) { |
1055 this.removeEventListener('scan-completed', this.onSearchCompleted_); | 1053 this.removeEventListener('scan-completed', this.onSearchCompleted_); |
1056 this.onSearchCompleted_ = null; | 1054 this.onSearchCompleted_ = null; |
1057 } | 1055 } |
1058 | 1056 |
1059 if (this.onClearSearch_) { | 1057 if (this.onClearSearch_) { |
1060 this.onClearSearch_(); | 1058 this.onClearSearch_(); |
1061 this.onClearSearch_ = null; | 1059 this.onClearSearch_ = null; |
1062 } | 1060 } |
1063 }; | 1061 }; |
OLD | NEW |