OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 /** | 7 /** |
8 * Utilities for FileOperationManager. | 8 * Utilities for FileOperationManager. |
9 */ | 9 */ |
10 var fileOperationUtil = {}; | 10 var fileOperationUtil = {}; |
(...skipping 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1165 | 1165 |
1166 /** | 1166 /** |
1167 * Checks if the move operation is available between the given two locations. | 1167 * Checks if the move operation is available between the given two locations. |
1168 * | 1168 * |
1169 * @param {DirectoryEntry} sourceEntry An entry from the source. | 1169 * @param {DirectoryEntry} sourceEntry An entry from the source. |
1170 * @param {DirectoryEntry} targetDirEntry Directory entry for the target. | 1170 * @param {DirectoryEntry} targetDirEntry Directory entry for the target. |
1171 * @return {boolean} Whether we can move from the source to the target. | 1171 * @return {boolean} Whether we can move from the source to the target. |
1172 */ | 1172 */ |
1173 FileOperationManager.prototype.isMovable = function( | 1173 FileOperationManager.prototype.isMovable = function( |
1174 sourceEntry, targetDirEntry) { | 1174 sourceEntry, targetDirEntry) { |
1175 // TODO(mtomasz): Use the volume manager instead of full paths. | 1175 var sourceLocationInfo = this.volumeManager_.getLocationInfo(sourceEntry); |
1176 return (PathUtil.isDriveBasedPath(sourceEntry.fullPath) && | 1176 var targetDirLocationInfo = this.volumeManager_.getLocationInfo( |
1177 PathUtil.isDriveBasedPath(targetDirEntry.fullPath)) || | 1177 targetDirEntry); |
1178 (PathUtil.getRootPath(sourceEntry.fullPath) == | 1178 |
1179 PathUtil.getRootPath(targetDirEntry.fullPath)); | 1179 return sourceLocationInfo && targetDirLocationInfo && |
| 1180 sourceLocationInfo.volumeInfo === targetDirLocationInfo.volumeInfo; |
1180 }; | 1181 }; |
1181 | 1182 |
1182 /** | 1183 /** |
1183 * Initiate a file copy. | 1184 * Initiate a file copy. |
1184 * | 1185 * |
1185 * @param {DirectoryEntry} targetDirEntry Target directory. | 1186 * @param {DirectoryEntry} targetDirEntry Target directory. |
1186 * @param {Array.<Entry>} entries Entries to copy. | 1187 * @param {Array.<Entry>} entries Entries to copy. |
1187 * @param {boolean} isMove In case of move. | 1188 * @param {boolean} isMove In case of move. |
1188 * @return {FileOperationManager.Task} Copy task. | 1189 * @return {FileOperationManager.Task} Copy task. |
1189 * @private | 1190 * @private |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1406 | 1407 |
1407 /** | 1408 /** |
1408 * Generates new task ID. | 1409 * Generates new task ID. |
1409 * | 1410 * |
1410 * @return {string} New task ID. | 1411 * @return {string} New task ID. |
1411 * @private | 1412 * @private |
1412 */ | 1413 */ |
1413 FileOperationManager.prototype.generateTaskId_ = function() { | 1414 FileOperationManager.prototype.generateTaskId_ = function() { |
1414 return 'file-operation-' + this.taskIdCounter_++; | 1415 return 'file-operation-' + this.taskIdCounter_++; |
1415 }; | 1416 }; |
OLD | NEW |