Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(727)

Side by Side Diff: chrome/browser/resources/file_manager/js/directory_model.js

Issue 12212187: [Cleanup] Files.app: Misc style fixes in Javascript code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
11 /** 11 /**
12 * Data model of the file manager. 12 * Data model of the file manager.
13 * 13 *
14 * @constructor
15 * @param {DirectoryEntry} root File system root. 14 * @param {DirectoryEntry} root File system root.
16 * @param {boolean} singleSelection True if only one file could be selected 15 * @param {boolean} singleSelection True if only one file could be selected
17 * at the time. 16 * at the time.
18 * @param {MetadataCache} metadataCache The metadata cache service. 17 * @param {MetadataCache} metadataCache The metadata cache service.
19 * @param {VolumeManager} volumeManager The volume manager. 18 * @param {VolumeManager} volumeManager The volume manager.
20 * @param {boolean} isDriveEnabled True if DRIVE enabled (initial value). 19 * @param {boolean} isDriveEnabled True if DRIVE enabled (initial value).
20 * @constructor
21 */ 21 */
22 function DirectoryModel(root, singleSelection, 22 function DirectoryModel(root, singleSelection,
23 metadataCache, volumeManager, isDriveEnabled) { 23 metadataCache, volumeManager, isDriveEnabled) {
24 this.root_ = root; 24 this.root_ = root;
25 var fileList = new cr.ui.ArrayDataModel([]); 25 var fileList = new cr.ui.ArrayDataModel([]);
26 this.fileListSelection_ = singleSelection ? 26 this.fileListSelection_ = singleSelection ?
27 new cr.ui.ListSingleSelectionModel() : new cr.ui.ListSelectionModel(); 27 new cr.ui.ListSingleSelectionModel() : new cr.ui.ListSelectionModel();
28 28
29 this.runningScan_ = null; 29 this.runningScan_ = null;
30 this.pendingScan_ = null; 30 this.pendingScan_ = null;
31 this.rescanTime_ = null; 31 this.rescanTime_ = null;
32 this.scanFailures_ = 0; 32 this.scanFailures_ = 0;
33 this.driveEnabled_ = isDriveEnabled; 33 this.driveEnabled_ = isDriveEnabled;
34 34
35 this.currentFileListContext_ = new FileListContext( 35 this.currentFileListContext_ = new FileListContext(
36 metadataCache, fileList, false); 36 metadataCache, fileList, false);
37 this.currentDirContents_ = new DirectoryContentsBasic( 37 this.currentDirContents_ = new DirectoryContentsBasic(
38 this.currentFileListContext_, root); 38 this.currentFileListContext_, root);
39 39
40 this.rootsList_ = new cr.ui.ArrayDataModel([]); 40 this.rootsList_ = new cr.ui.ArrayDataModel([]);
41 this.rootsListSelection_ = new cr.ui.ListSingleSelectionModel(); 41 this.rootsListSelection_ = new cr.ui.ListSingleSelectionModel();
42 this.rootsListSelection_.addEventListener( 42 this.rootsListSelection_.addEventListener(
43 'change', this.onRootChange_.bind(this)); 43 'change', this.onRootChange_.bind(this));
44 44
45 this.rootsListSelection_.addEventListener( 45 this.rootsListSelection_.addEventListener(
46 'beforeChange', this.onBeforeRootChange_.bind(this)); 46 'beforeChange', this.onBeforeRootChange_.bind(this));
47 47
48 /** 48 /**
49 * A map root.fullPath -> currentDirectory.fullPath. 49 * A map root.fullPath -> currentDirectory.fullPath.
50 * @type {Object.<string, string>}
50 * @private 51 * @private
51 * @type {Object.<string, string>}
52 */ 52 */
53 this.currentDirByRoot_ = {}; 53 this.currentDirByRoot_ = {};
54 54
55 this.volumeManager_ = volumeManager; 55 this.volumeManager_ = volumeManager;
56 } 56 }
57 57
58 /** 58 /**
59 * Fake entry to be used in currentDirEntry_ when current directory is 59 * Fake entry to be used in currentDirEntry_ when current directory is
60 * unmounted DRIVE. 60 * unmounted DRIVE.
61 * @private 61 * @private
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 }; 233 };
234 234
235 /** 235 /**
236 * @return {string} Path for the current directory. 236 * @return {string} Path for the current directory.
237 */ 237 */
238 DirectoryModel.prototype.getCurrentDirPath = function() { 238 DirectoryModel.prototype.getCurrentDirPath = function() {
239 return this.currentDirContents_.getPath(); 239 return this.currentDirContents_.getPath();
240 }; 240 };
241 241
242 /** 242 /**
243 * @return {Array.<string>} File paths of selected files.
243 * @private 244 * @private
244 * @return {Array.<string>} File paths of selected files.
245 */ 245 */
246 DirectoryModel.prototype.getSelectedPaths_ = function() { 246 DirectoryModel.prototype.getSelectedPaths_ = function() {
247 var indexes = this.fileListSelection_.selectedIndexes; 247 var indexes = this.fileListSelection_.selectedIndexes;
248 var fileList = this.getFileList(); 248 var fileList = this.getFileList();
249 if (fileList) { 249 if (fileList) {
250 return indexes.map(function(i) { 250 return indexes.map(function(i) {
251 return fileList.item(i).fullPath; 251 return fileList.item(i).fullPath;
252 }); 252 });
253 } 253 }
254 return []; 254 return [];
255 }; 255 };
256 256
257 /** 257 /**
258 * @param {Array.<string>} value List of file paths of selected files.
258 * @private 259 * @private
259 * @param {Array.<string>} value List of file paths of selected files.
260 */ 260 */
261 DirectoryModel.prototype.setSelectedPaths_ = function(value) { 261 DirectoryModel.prototype.setSelectedPaths_ = function(value) {
262 var indexes = []; 262 var indexes = [];
263 var fileList = this.getFileList(); 263 var fileList = this.getFileList();
264 264
265 var safeKey = function(key) { 265 var safeKey = function(key) {
266 // The transformation must: 266 // The transformation must:
267 // 1. Never generate a reserved name ('__proto__') 267 // 1. Never generate a reserved name ('__proto__')
268 // 2. Keep different keys different. 268 // 2. Keep different keys different.
269 return '#' + key; 269 return '#' + key;
270 }; 270 };
271 271
272 var hash = {}; 272 var hash = {};
273 273
274 for (var i = 0; i < value.length; i++) 274 for (var i = 0; i < value.length; i++)
275 hash[safeKey(value[i])] = 1; 275 hash[safeKey(value[i])] = 1;
276 276
277 for (var i = 0; i < fileList.length; i++) { 277 for (var i = 0; i < fileList.length; i++) {
278 if (hash.hasOwnProperty(safeKey(fileList.item(i).fullPath))) 278 if (hash.hasOwnProperty(safeKey(fileList.item(i).fullPath)))
279 indexes.push(i); 279 indexes.push(i);
280 } 280 }
281 this.fileListSelection_.selectedIndexes = indexes; 281 this.fileListSelection_.selectedIndexes = indexes;
282 }; 282 };
283 283
284 /** 284 /**
285 * @return {string} Lead item file path.
285 * @private 286 * @private
286 * @return {string} Lead item file path.
287 */ 287 */
288 DirectoryModel.prototype.getLeadPath_ = function() { 288 DirectoryModel.prototype.getLeadPath_ = function() {
289 var index = this.fileListSelection_.leadIndex; 289 var index = this.fileListSelection_.leadIndex;
290 return index >= 0 && this.getFileList().item(index).fullPath; 290 return index >= 0 && this.getFileList().item(index).fullPath;
291 }; 291 };
292 292
293 /** 293 /**
294 * @param {string} value The name of new lead index.
294 * @private 295 * @private
295 * @param {string} value The name of new lead index.
296 */ 296 */
297 DirectoryModel.prototype.setLeadPath_ = function(value) { 297 DirectoryModel.prototype.setLeadPath_ = function(value) {
298 var fileList = this.getFileList(); 298 var fileList = this.getFileList();
299 for (var i = 0; i < fileList.length; i++) { 299 for (var i = 0; i < fileList.length; i++) {
300 if (fileList.item(i).fullPath === value) { 300 if (fileList.item(i).fullPath === value) {
301 this.fileListSelection_.leadIndex = i; 301 this.fileListSelection_.leadIndex = i;
302 return; 302 return;
303 } 303 }
304 } 304 }
305 }; 305 };
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 387
388 this.scan_(dirContents, successCallback); 388 this.scan_(dirContents, successCallback);
389 }; 389 };
390 390
391 /** 391 /**
392 * Run scan on the current DirectoryContents. The active fileList is cleared and 392 * Run scan on the current DirectoryContents. The active fileList is cleared and
393 * the entries are added directly. 393 * the entries are added directly.
394 * 394 *
395 * This should be used when changing directory or initiating a new search. 395 * This should be used when changing directory or initiating a new search.
396 * 396 *
397 * @private
398 * @param {DirectoryContentes} newDirContents New DirectoryContents instance to 397 * @param {DirectoryContentes} newDirContents New DirectoryContents instance to
399 * replace currentDirContents_. 398 * replace currentDirContents_.
400 * @param {Function} opt_callback Called on success. 399 * @param {Function} opt_callback Called on success.
400 * @private
401 */ 401 */
402 DirectoryModel.prototype.clearAndScan_ = function(newDirContents, 402 DirectoryModel.prototype.clearAndScan_ = function(newDirContents,
403 opt_callback) { 403 opt_callback) {
404 if (this.currentDirContents_.isScanning()) 404 if (this.currentDirContents_.isScanning())
405 this.currentDirContents_.cancelScan(); 405 this.currentDirContents_.cancelScan();
406 this.currentDirContents_ = newDirContents; 406 this.currentDirContents_ = newDirContents;
407 this.clearRescanTimeout_(); 407 this.clearRescanTimeout_();
408 408
409 if (this.pendingScan_) 409 if (this.pendingScan_)
410 this.pendingScan_ = false; 410 this.pendingScan_ = false;
(...skipping 13 matching lines...) Expand all
424 var fileList = this.getFileList(); 424 var fileList = this.getFileList();
425 fileList.splice(0, fileList.length); 425 fileList.splice(0, fileList.length);
426 cr.dispatchSimpleEvent(this, 'scan-started'); 426 cr.dispatchSimpleEvent(this, 'scan-started');
427 this.scan_(this.currentDirContents_, onDone); 427 this.scan_(this.currentDirContents_, onDone);
428 }; 428 };
429 429
430 /** 430 /**
431 * Perform a directory contents scan. Should be called only from rescan() and 431 * Perform a directory contents scan. Should be called only from rescan() and
432 * clearAndScan_(). 432 * clearAndScan_().
433 * 433 *
434 * @private
435 * @param {DirectoryContents} dirContents DirectoryContents instance on which 434 * @param {DirectoryContents} dirContents DirectoryContents instance on which
436 * the scan will be run. 435 * the scan will be run.
437 * @param {function} successCallback Callback on success. 436 * @param {function} successCallback Callback on success.
437 * @private
438 */ 438 */
439 DirectoryModel.prototype.scan_ = function(dirContents, successCallback) { 439 DirectoryModel.prototype.scan_ = function(dirContents, successCallback) {
440 var self = this; 440 var self = this;
441 441
442 /** 442 /**
443 * Runs pending scan if there is one. 443 * Runs pending scan if there is one.
444 * 444 *
445 * @return {boolean} Did pending scan exist. 445 * @return {boolean} Did pending scan exist.
446 */ 446 */
447 var maybeRunPendingRescan = function() { 447 var maybeRunPendingRescan = function() {
(...skipping 25 matching lines...) Expand all
473 473
474 this.runningScan_ = dirContents; 474 this.runningScan_ = dirContents;
475 475
476 dirContents.addEventListener('scan-completed', onSuccess); 476 dirContents.addEventListener('scan-completed', onSuccess);
477 dirContents.addEventListener('scan-failed', onFailure); 477 dirContents.addEventListener('scan-failed', onFailure);
478 dirContents.addEventListener('scan-cancelled', this.dispatchEvent.bind(this)); 478 dirContents.addEventListener('scan-cancelled', this.dispatchEvent.bind(this));
479 dirContents.scan(); 479 dirContents.scan();
480 }; 480 };
481 481
482 /** 482 /**
483 * @param {DirectoryContents} dirContents DirectoryContents instance.
483 * @private 484 * @private
484 * @param {DirectoryContents} dirContents DirectoryContents instance.
485 */ 485 */
486 DirectoryModel.prototype.replaceDirectoryContents_ = function(dirContents) { 486 DirectoryModel.prototype.replaceDirectoryContents_ = function(dirContents) {
487 cr.dispatchSimpleEvent(this, 'begin-update-files'); 487 cr.dispatchSimpleEvent(this, 'begin-update-files');
488 this.fileListSelection_.beginChange(); 488 this.fileListSelection_.beginChange();
489 489
490 var selectedPaths = this.getSelectedPaths_(); 490 var selectedPaths = this.getSelectedPaths_();
491 var selectedIndices = this.fileListSelection_.selectedIndexes; 491 var selectedIndices = this.fileListSelection_.selectedIndexes;
492 492
493 // Restore leadIndex in case leadName no longer exists. 493 // Restore leadIndex in case leadName no longer exists.
494 var leadIndex = this.fileListSelection_.leadIndex; 494 var leadIndex = this.fileListSelection_.leadIndex;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 547
548 var index = self.findIndexByName_(name); 548 var index = self.findIndexByName_(name);
549 if (index >= 0) 549 if (index >= 0)
550 fileList.splice(index, 1); 550 fileList.splice(index, 1);
551 }; 551 };
552 552
553 util.resolvePath(currentEntry, name, onEntryFound, onError); 553 util.resolvePath(currentEntry, name, onEntryFound, onError);
554 }; 554 };
555 555
556 /** 556 /**
557 * @private
558 * @param {string} name Filename. 557 * @param {string} name Filename.
559 * @return {number} The index in the fileList. 558 * @return {number} The index in the fileList.
559 * @private
560 */ 560 */
561 DirectoryModel.prototype.findIndexByName_ = function(name) { 561 DirectoryModel.prototype.findIndexByName_ = function(name) {
562 var fileList = this.getFileList(); 562 var fileList = this.getFileList();
563 for (var i = 0; i < fileList.length; i++) 563 for (var i = 0; i < fileList.length; i++)
564 if (fileList.item(i).name == name) 564 if (fileList.item(i).name == name)
565 return i; 565 return i;
566 return -1; 566 return -1;
567 }; 567 };
568 568
569 /** 569 /**
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 if (path == '/') { 700 if (path == '/') {
701 successCallback(this.root_); 701 successCallback(this.root_);
702 return; 702 return;
703 } 703 }
704 704
705 this.root_.getDirectory(path, {create: false}, 705 this.root_.getDirectory(path, {create: false},
706 successCallback, errorCallback); 706 successCallback, errorCallback);
707 }; 707 };
708 708
709 /** 709 /**
710 * @return {Entry} Directory entry of the root selected in rootsList.
710 * @private 711 * @private
711 * @return {Entry} Directory entry of the root selected in rootsList.
712 */ 712 */
713 DirectoryModel.prototype.getSelectedRootDirEntry_ = function() { 713 DirectoryModel.prototype.getSelectedRootDirEntry_ = function() {
714 return this.rootsList_.item(this.rootsListSelection_.selectedIndex); 714 return this.rootsList_.item(this.rootsListSelection_.selectedIndex);
715 }; 715 };
716 716
717 /** 717 /**
718 * Handler before root item change. 718 * Handler before root item change.
719 * @param {Event} event The event. 719 * @param {Event} event The event.
720 * @private 720 * @private
721 */ 721 */
722 DirectoryModel.prototype.onBeforeRootChange_ = function(event) { 722 DirectoryModel.prototype.onBeforeRootChange_ = function(event) {
723 if (event.changes.length == 1 && !event.changes[0].selected) 723 if (event.changes.length == 1 && !event.changes[0].selected)
724 event.preventDefault(); 724 event.preventDefault();
725 }; 725 };
726 726
727 /** 727 /**
728 * Handler for root item being clicked. 728 * Handler for root item being clicked.
729 * @param {Event} event The event.
729 * @private 730 * @private
730 * @param {Event} event The event.
731 */ 731 */
732 DirectoryModel.prototype.onRootChange_ = function(event) { 732 DirectoryModel.prototype.onRootChange_ = function(event) {
733 var newRootDir = this.getSelectedRootDirEntry_(); 733 var newRootDir = this.getSelectedRootDirEntry_();
734 if (newRootDir) 734 if (newRootDir)
735 this.changeRoot(newRootDir.fullPath); 735 this.changeRoot(newRootDir.fullPath);
736 }; 736 };
737 737
738 /** 738 /**
739 * Changes directory. If path points to a root (except current one) 739 * Changes directory. If path points to a root (except current one)
740 * then directory changed to the last used one for the root. 740 * then directory changed to the last used one for the root.
741 * 741 *
742 * @param {string} path New current directory path or new root. 742 * @param {string} path New current directory path or new root.
743 */ 743 */
744 DirectoryModel.prototype.changeRoot = function(path) { 744 DirectoryModel.prototype.changeRoot = function(path) {
745 var currentDir = this.currentDirByRoot_[path] || path; 745 var currentDir = this.currentDirByRoot_[path] || path;
746 if (currentDir == this.getCurrentDirPath()) 746 if (currentDir == this.getCurrentDirPath())
747 return; 747 return;
748 var onError = path != currentDir && path != this.getCurrentDirPath() ? 748 var onError = path != currentDir && path != this.getCurrentDirPath() ?
749 this.changeDirectory.bind(this, path) : null; 749 this.changeDirectory.bind(this, path) : null;
750 this.resolveDirectory( 750 this.resolveDirectory(
751 currentDir, 751 currentDir,
752 this.changeDirectoryEntry_.bind(this, false), 752 this.changeDirectoryEntry_.bind(this, false),
753 onError); 753 onError);
754 }; 754 };
755 755
756 /** 756 /**
757 * @private
758 * @param {DirectoryEntry} dirEntry The absolute path to the new directory. 757 * @param {DirectoryEntry} dirEntry The absolute path to the new directory.
759 * @param {function} opt_callback Executed if the directory loads successfully. 758 * @param {function} opt_callback Executed if the directory loads successfully.
759 * @private
760 */ 760 */
761 DirectoryModel.prototype.changeDirectoryEntrySilent_ = function(dirEntry, 761 DirectoryModel.prototype.changeDirectoryEntrySilent_ = function(dirEntry,
762 opt_callback) { 762 opt_callback) {
763 var onScanComplete = function() { 763 var onScanComplete = function() {
764 if (opt_callback) 764 if (opt_callback)
765 opt_callback(); 765 opt_callback();
766 // For tests that open the dialog to empty directories, everything 766 // For tests that open the dialog to empty directories, everything
767 // is loaded at this point. 767 // is loaded at this point.
768 chrome.test.sendMessage('directory-change-complete'); 768 chrome.test.sendMessage('directory-change-complete');
769 }; 769 };
770 this.clearAndScan_(new DirectoryContentsBasic(this.currentFileListContext_, 770 this.clearAndScan_(new DirectoryContentsBasic(this.currentFileListContext_,
771 dirEntry), 771 dirEntry),
772 onScanComplete.bind(this)); 772 onScanComplete.bind(this));
773 this.currentDirByRoot_[this.getCurrentRootPath()] = dirEntry.fullPath; 773 this.currentDirByRoot_[this.getCurrentRootPath()] = dirEntry.fullPath;
774 this.updateRootsListSelection_(); 774 this.updateRootsListSelection_();
775 }; 775 };
776 776
777 /** 777 /**
778 * Change the current directory to the directory represented by a 778 * Change the current directory to the directory represented by a
779 * DirectoryEntry. 779 * DirectoryEntry.
780 * 780 *
781 * Dispatches the 'directory-changed' event when the directory is successfully 781 * Dispatches the 'directory-changed' event when the directory is successfully
782 * changed. 782 * changed.
783 * 783 *
784 * @private
785 * @param {boolean} initial True if it comes from setupPath and 784 * @param {boolean} initial True if it comes from setupPath and
786 * false if caused by an user action. 785 * false if caused by an user action.
787 * @param {DirectoryEntry} dirEntry The absolute path to the new directory. 786 * @param {DirectoryEntry} dirEntry The absolute path to the new directory.
788 * @param {function} opt_callback Executed if the directory loads successfully. 787 * @param {function} opt_callback Executed if the directory loads successfully.
788 * @private
789 */ 789 */
790 DirectoryModel.prototype.changeDirectoryEntry_ = function(initial, dirEntry, 790 DirectoryModel.prototype.changeDirectoryEntry_ = function(initial, dirEntry,
791 opt_callback) { 791 opt_callback) {
792 if (dirEntry == DirectoryModel.fakeDriveEntry_ && 792 if (dirEntry == DirectoryModel.fakeDriveEntry_ &&
793 this.volumeManager_.getDriveStatus() == 793 this.volumeManager_.getDriveStatus() ==
794 VolumeManager.DriveStatus.UNMOUNTED) { 794 VolumeManager.DriveStatus.UNMOUNTED) {
795 this.volumeManager_.mountDrive(function() {}, function() {}); 795 this.volumeManager_.mountDrive(function() {}, function() {});
796 } 796 }
797 797
798 this.clearSearch_(); 798 this.clearSearch_();
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
984 // this.focusCurrentList_(); 984 // this.focusCurrentList_();
985 if (index >= this.getFileList().length) 985 if (index >= this.getFileList().length)
986 return; 986 return;
987 987
988 // If a list bound with the model it will do scrollIndexIntoView(index). 988 // If a list bound with the model it will do scrollIndexIntoView(index).
989 this.fileListSelection_.selectedIndex = index; 989 this.fileListSelection_.selectedIndex = index;
990 }; 990 };
991 991
992 /** 992 /**
993 * Get root entries asynchronously. 993 * Get root entries asynchronously.
994 * @param {function(Array.<Entry>)} callback Called when roots are resolved.
994 * @private 995 * @private
995 * @param {function(Array.<Entry>)} callback Called when roots are resolved.
996 */ 996 */
997 DirectoryModel.prototype.resolveRoots_ = function(callback) { 997 DirectoryModel.prototype.resolveRoots_ = function(callback) {
998 var groups = { 998 var groups = {
999 downloads: null, 999 downloads: null,
1000 archives: null, 1000 archives: null,
1001 removables: null, 1001 removables: null,
1002 drive: null 1002 drive: null
1003 }; 1003 };
1004 var self = this; 1004 var self = this;
1005 1005
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
1281 1281
1282 /** 1282 /**
1283 * @param {string} name Filter identifier. 1283 * @param {string} name Filter identifier.
1284 */ 1284 */
1285 DirectoryModel.prototype.removeFilter = function(name) { 1285 DirectoryModel.prototype.removeFilter = function(name) {
1286 this.currentFileListContext_.removeFilter(name); 1286 this.currentFileListContext_.removeFilter(name);
1287 }; 1287 };
1288 1288
1289 1289
1290 /** 1290 /**
1291 * @constructor
1292 * @param {DirectoryEntry} root Root entry. 1291 * @param {DirectoryEntry} root Root entry.
1293 * @param {DirectoryModel} directoryModel Model to watch. 1292 * @param {DirectoryModel} directoryModel Model to watch.
1294 * @param {VolumeManager} volumeManager Manager to watch. 1293 * @param {VolumeManager} volumeManager Manager to watch.
1294 * @constructor
1295 */ 1295 */
1296 function FileWatcher(root, directoryModel, volumeManager) { 1296 function FileWatcher(root, directoryModel, volumeManager) {
1297 this.root_ = root; 1297 this.root_ = root;
1298 this.dm_ = directoryModel; 1298 this.dm_ = directoryModel;
1299 this.vm_ = volumeManager; 1299 this.vm_ = volumeManager;
1300 this.watchedDirectoryEntry_ = null; 1300 this.watchedDirectoryEntry_ = null;
1301 this.updateWatchedDirectoryBound_ = 1301 this.updateWatchedDirectoryBound_ =
1302 this.updateWatchedDirectory_.bind(this); 1302 this.updateWatchedDirectory_.bind(this);
1303 this.onDirectoryChangedBound_ = 1303 this.onDirectoryChangedBound_ =
1304 this.onDirectoryChanged_.bind(this); 1304 this.onDirectoryChanged_.bind(this);
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698