| 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 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 773 // since the current directory is initializing now. | 773 // since the current directory is initializing now. |
| 774 if (this.getCurrentDirEntry() && | 774 if (this.getCurrentDirEntry() && |
| 775 !this.volumeManager_.getVolumeInfo(this.getCurrentDirEntry())) { | 775 !this.volumeManager_.getVolumeInfo(this.getCurrentDirEntry())) { |
| 776 this.volumeManager_.getDefaultDisplayRoot(function(displayRoot) { | 776 this.volumeManager_.getDefaultDisplayRoot(function(displayRoot) { |
| 777 this.changeDirectoryEntry(displayRoot); | 777 this.changeDirectoryEntry(displayRoot); |
| 778 }.bind(this)); | 778 }.bind(this)); |
| 779 } | 779 } |
| 780 }; | 780 }; |
| 781 | 781 |
| 782 /** | 782 /** |
| 783 * Check if the root of the given path is mountable or not. | |
| 784 * | |
| 785 * @param {string} path Path. | |
| 786 * @return {boolean} Return true, if the given path is under mountable root. | |
| 787 * Otherwise, return false. | |
| 788 */ | |
| 789 DirectoryModel.isMountableRoot = function(path) { | |
| 790 var rootType = PathUtil.getRootType(path); | |
| 791 switch (rootType) { | |
| 792 case RootType.DOWNLOADS: | |
| 793 return false; | |
| 794 case RootType.ARCHIVE: | |
| 795 case RootType.REMOVABLE: | |
| 796 case RootType.DRIVE: | |
| 797 return true; | |
| 798 default: | |
| 799 throw new Error('Unknown root type!'); | |
| 800 } | |
| 801 }; | |
| 802 | |
| 803 /** | |
| 804 * Performs search and displays results. The search type is dependent on the | 783 * Performs search and displays results. The search type is dependent on the |
| 805 * current directory. If we are currently on drive, server side content search | 784 * current directory. If we are currently on drive, server side content search |
| 806 * over drive mount point. If the current directory is not on the drive, file | 785 * over drive mount point. If the current directory is not on the drive, file |
| 807 * name search over current directory will be performed. | 786 * name search over current directory will be performed. |
| 808 * | 787 * |
| 809 * @param {string} query Query that will be searched for. | 788 * @param {string} query Query that will be searched for. |
| 810 * @param {function(Event)} onSearchRescan Function that will be called when the | 789 * @param {function(Event)} onSearchRescan Function that will be called when the |
| 811 * search directory is rescanned (i.e. search results are displayed). | 790 * search directory is rescanned (i.e. search results are displayed). |
| 812 * @param {function()} onClearSearch Function to be called when search state | 791 * @param {function()} onClearSearch Function to be called when search state |
| 813 * gets cleared. | 792 * gets cleared. |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 943 if (this.onSearchCompleted_) { | 922 if (this.onSearchCompleted_) { |
| 944 this.removeEventListener('scan-completed', this.onSearchCompleted_); | 923 this.removeEventListener('scan-completed', this.onSearchCompleted_); |
| 945 this.onSearchCompleted_ = null; | 924 this.onSearchCompleted_ = null; |
| 946 } | 925 } |
| 947 | 926 |
| 948 if (this.onClearSearch_) { | 927 if (this.onClearSearch_) { |
| 949 this.onClearSearch_(); | 928 this.onClearSearch_(); |
| 950 this.onClearSearch_ = null; | 929 this.onClearSearch_ = null; |
| 951 } | 930 } |
| 952 }; | 931 }; |
| OLD | NEW |