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 = 1000; | 7 var SIMULTANEOUS_RESCAN_INTERVAL = 1000; |
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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 }; | 164 }; |
165 | 165 |
166 /** | 166 /** |
167 * @return {boolean} True if current directory is read only. | 167 * @return {boolean} True if current directory is read only. |
168 */ | 168 */ |
169 DirectoryModel.prototype.isReadOnly = function() { | 169 DirectoryModel.prototype.isReadOnly = function() { |
170 return this.isPathReadOnly(this.getCurrentRootPath()); | 170 return this.isPathReadOnly(this.getCurrentRootPath()); |
171 }; | 171 }; |
172 | 172 |
173 /** | 173 /** |
| 174 * @return {boolean} True if the a scan is active. |
| 175 */ |
| 176 DirectoryModel.prototype.isScanning = function() { |
| 177 return this.currentDirContents_.isScanning(); |
| 178 }; |
| 179 |
| 180 /** |
174 * @return {boolean} True if search is in progress. | 181 * @return {boolean} True if search is in progress. |
175 */ | 182 */ |
176 DirectoryModel.prototype.isSearching = function() { | 183 DirectoryModel.prototype.isSearching = function() { |
177 return this.currentDirContents_.isSearch(); | 184 return this.currentDirContents_.isSearch(); |
178 }; | 185 }; |
179 | 186 |
180 /** | 187 /** |
181 * @param {string} path Path to check. | 188 * @param {string} path Path to check. |
182 * @return {boolean} True if the |path| is read only. | 189 * @return {boolean} True if the |path| is read only. |
183 */ | 190 */ |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 return; | 460 return; |
454 | 461 |
455 if (self.scanFailures_ <= 1) | 462 if (self.scanFailures_ <= 1) |
456 self.rescanLater(); | 463 self.rescanLater(); |
457 } | 464 } |
458 | 465 |
459 this.runningScan_ = dirContents; | 466 this.runningScan_ = dirContents; |
460 | 467 |
461 dirContents.addEventListener('scan-completed', onSuccess); | 468 dirContents.addEventListener('scan-completed', onSuccess); |
462 dirContents.addEventListener('scan-failed', onFailure); | 469 dirContents.addEventListener('scan-failed', onFailure); |
| 470 dirContents.addEventListener('scan-cancelled', this.dispatchEvent.bind(this)); |
463 dirContents.scan(); | 471 dirContents.scan(); |
464 }; | 472 }; |
465 | 473 |
466 /** | 474 /** |
467 * @private | 475 * @private |
468 * @param {DirectoryContents} dirContents DirectoryContents instance. | 476 * @param {DirectoryContents} dirContents DirectoryContents instance. |
469 */ | 477 */ |
470 DirectoryModel.prototype.replaceDirectoryContents_ = function(dirContents) { | 478 DirectoryModel.prototype.replaceDirectoryContents_ = function(dirContents) { |
471 cr.dispatchSimpleEvent(this, 'begin-update-files'); | 479 cr.dispatchSimpleEvent(this, 'begin-update-files'); |
472 this.fileListSelection_.beginChange(); | 480 this.fileListSelection_.beginChange(); |
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1344 }.bind(this)); | 1352 }.bind(this)); |
1345 } | 1353 } |
1346 }; | 1354 }; |
1347 | 1355 |
1348 /** | 1356 /** |
1349 * @return {DirectoryEntry} Current watched directory entry. | 1357 * @return {DirectoryEntry} Current watched directory entry. |
1350 */ | 1358 */ |
1351 FileWatcher.prototype.getWatchedDirectoryEntry = function() { | 1359 FileWatcher.prototype.getWatchedDirectoryEntry = function() { |
1352 return this.watchedDirectoryEntry_; | 1360 return this.watchedDirectoryEntry_; |
1353 }; | 1361 }; |
OLD | NEW |