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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
186 }; | 186 }; |
187 | 187 |
188 /** | 188 /** |
189 * @return {DirectoryEntry} Current directory. | 189 * @return {DirectoryEntry} Current directory. |
190 */ | 190 */ |
191 DirectoryModel.prototype.getCurrentDirEntry = function() { | 191 DirectoryModel.prototype.getCurrentDirEntry = function() { |
192 return this.currentDirContents_.getDirectoryEntry(); | 192 return this.currentDirContents_.getDirectoryEntry(); |
193 }; | 193 }; |
194 | 194 |
195 /** | 195 /** |
196 * TODO(hirono): Remove the method. | |
hirono
2013/12/27 07:16:28
Thanks!
| |
197 * @return {string} URL of the current directory. or null if unavailable. | |
198 */ | |
199 DirectoryModel.prototype.getCurrentDirectoryURL = function() { | |
200 var entry = this.currentDirContents_.getDirectoryEntry(); | |
201 if (!entry) | |
202 return null; | |
203 return util.isFakeEntry(entry) ? | |
204 util.makeFilesystemUrl(entry.fullPath) : entry.toURL(); | |
205 }; | |
206 | |
207 /** | |
208 * @return {string} Path for the current directory, or empty string if the | |
209 * current directory is not yet set. | |
210 */ | |
211 DirectoryModel.prototype.getCurrentDirPath = function() { | |
212 var entry = this.currentDirContents_.getDirectoryEntry(); | |
213 return entry ? entry.fullPath : ''; | |
214 }; | |
215 | |
216 /** | |
217 * @return {Array.<string>} File paths of selected files. | 196 * @return {Array.<string>} File paths of selected files. |
218 * @private | 197 * @private |
219 */ | 198 */ |
220 DirectoryModel.prototype.getSelectedPaths_ = function() { | 199 DirectoryModel.prototype.getSelectedPaths_ = function() { |
221 var indexes = this.fileListSelection_.selectedIndexes; | 200 var indexes = this.fileListSelection_.selectedIndexes; |
222 var fileList = this.getFileList(); | 201 var fileList = this.getFileList(); |
223 if (fileList) { | 202 if (fileList) { |
224 return indexes.map(function(i) { | 203 return indexes.map(function(i) { |
225 return fileList.item(i).fullPath; | 204 return fileList.item(i).fullPath; |
226 }); | 205 }); |
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
897 } | 876 } |
898 } | 877 } |
899 } | 878 } |
900 } | 879 } |
901 | 880 |
902 // When the volume where we are is unmounted, fallback to | 881 // When the volume where we are is unmounted, fallback to |
903 // DEFAULT_MOUNT_POINT. If current directory path is empty, stop the fallback | 882 // DEFAULT_MOUNT_POINT. If current directory path is empty, stop the fallback |
904 // since the current directory is initializing now. | 883 // since the current directory is initializing now. |
905 // TODO(mtomasz): DEFAULT_MOUNT_POINT is deprecated. Use VolumeManager:: | 884 // TODO(mtomasz): DEFAULT_MOUNT_POINT is deprecated. Use VolumeManager:: |
906 // getDefaultVolume() after it is implemented. | 885 // getDefaultVolume() after it is implemented. |
907 if (this.getCurrentDirPath() && | 886 if (this.getCurrentDirEntry() && |
908 !this.volumeManager_.getVolumeInfo(this.getCurrentDirPath())) | 887 !this.volumeManager_.getVolumeInfo(this.getCurrentDirEntry())) |
909 this.changeDirectory(PathUtil.DEFAULT_MOUNT_POINT); | 888 this.changeDirectory(PathUtil.DEFAULT_MOUNT_POINT); |
910 }; | 889 }; |
911 | 890 |
912 /** | 891 /** |
913 * Check if the root of the given path is mountable or not. | 892 * Check if the root of the given path is mountable or not. |
914 * | 893 * |
915 * @param {string} path Path. | 894 * @param {string} path Path. |
916 * @return {boolean} Return true, if the given path is under mountable root. | 895 * @return {boolean} Return true, if the given path is under mountable root. |
917 * Otherwise, return false. | 896 * Otherwise, return false. |
918 */ | 897 */ |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1075 if (this.onSearchCompleted_) { | 1054 if (this.onSearchCompleted_) { |
1076 this.removeEventListener('scan-completed', this.onSearchCompleted_); | 1055 this.removeEventListener('scan-completed', this.onSearchCompleted_); |
1077 this.onSearchCompleted_ = null; | 1056 this.onSearchCompleted_ = null; |
1078 } | 1057 } |
1079 | 1058 |
1080 if (this.onClearSearch_) { | 1059 if (this.onClearSearch_) { |
1081 this.onClearSearch_(); | 1060 this.onClearSearch_(); |
1082 this.onClearSearch_ = null; | 1061 this.onClearSearch_ = null; |
1083 } | 1062 } |
1084 }; | 1063 }; |
OLD | NEW |