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 1322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1333 | 1333 |
1334 if (this.watchedDirectoryEntry_) | 1334 if (this.watchedDirectoryEntry_) |
1335 this.changeWatchedEntry(null); | 1335 this.changeWatchedEntry(null); |
1336 }; | 1336 }; |
1337 | 1337 |
1338 /** | 1338 /** |
1339 * @param {Object} event chrome.fileBrowserPrivate.onDirectoryChanged event. | 1339 * @param {Object} event chrome.fileBrowserPrivate.onDirectoryChanged event. |
1340 * @private | 1340 * @private |
1341 */ | 1341 */ |
1342 FileWatcher.prototype.onDirectoryChanged_ = function(event) { | 1342 FileWatcher.prototype.onDirectoryChanged_ = function(event) { |
1343 if (encodeURI(event.directoryUrl) == this.watchedDirectoryEntry_.toURL()) | 1343 if (event.directoryUrl == this.watchedDirectoryEntry_.toURL()) |
1344 this.onFileInWatchedDirectoryChanged(); | 1344 this.onFileInWatchedDirectoryChanged(); |
1345 }; | 1345 }; |
1346 | 1346 |
1347 /** | 1347 /** |
1348 * Called when file in the watched directory changed. | 1348 * Called when file in the watched directory changed. |
1349 */ | 1349 */ |
1350 FileWatcher.prototype.onFileInWatchedDirectoryChanged = function() { | 1350 FileWatcher.prototype.onFileInWatchedDirectoryChanged = function() { |
1351 this.dm_.rescanLater(); | 1351 this.dm_.rescanLater(); |
1352 }; | 1352 }; |
1353 | 1353 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1404 }.bind(this)); | 1404 }.bind(this)); |
1405 } | 1405 } |
1406 }; | 1406 }; |
1407 | 1407 |
1408 /** | 1408 /** |
1409 * @return {DirectoryEntry} Current watched directory entry. | 1409 * @return {DirectoryEntry} Current watched directory entry. |
1410 */ | 1410 */ |
1411 FileWatcher.prototype.getWatchedDirectoryEntry = function() { | 1411 FileWatcher.prototype.getWatchedDirectoryEntry = function() { |
1412 return this.watchedDirectoryEntry_; | 1412 return this.watchedDirectoryEntry_; |
1413 }; | 1413 }; |
OLD | NEW |