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

Unified Diff: chrome/browser/resources/file_manager/js/file_copy_manager.js

Issue 15785004: Move from drive/other to drive/root should not use the copy+delete bypass. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/drive/file_system/move_operation.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/file_manager/js/file_copy_manager.js
diff --git a/chrome/browser/resources/file_manager/js/file_copy_manager.js b/chrome/browser/resources/file_manager/js/file_copy_manager.js
index b29bd499fd5c2cabc91cae58bcee0ba1bac3f277..1339ff922ea329a7e340ef942069bd3d069a258b 100644
--- a/chrome/browser/resources/file_manager/js/file_copy_manager.js
+++ b/chrome/browser/resources/file_manager/js/file_copy_manager.js
@@ -522,18 +522,18 @@ FileCopyManager.prototype.paste = function(files, directories, isCut, isOnDrive,
};
/**
- * Checks if source and target are on the same root.
+ * Checks if the move operation is avaiable between the given two locations.
*
* @param {DirectoryEntry} sourceEntry An entry from the source.
* @param {DirectoryEntry} targetDirEntry Directory entry for the target.
- * @param {boolean} targetOnDrive If target is on Drive.
- * @return {boolean} Whether source and target dir are on the same root.
+ * @return {boolean} Whether we can move from the source to the target.
*/
-FileCopyManager.prototype.isOnSameRoot = function(sourceEntry,
- targetDirEntry,
- targetOnDrive) {
- return PathUtil.getRootPath(sourceEntry.fullPath) ==
- PathUtil.getRootPath(targetDirEntry.fullPath);
+FileCopyManager.prototype.isMovable = function(sourceEntry,
+ targetDirEntry) {
+ return (PathUtil.isDriveBasedPath(sourceEntry.fullPath) &&
+ PathUtil.isDriveBasedPath(targetDirEntry.fullPath)) ||
+ (PathUtil.getRootPath(sourceEntry.fullPath) ==
+ PathUtil.getRootPath(targetDirEntry.fullPath));
};
/**
@@ -556,9 +556,7 @@ FileCopyManager.prototype.queueCopy_ = function(targetDirEntry,
// When copying files, null can be specified as source directory.
var copyTask = new FileCopyManager.Task(targetDirEntry);
if (deleteAfterCopy) {
- // |sourecDirEntry| may be null, so let's check the root for the first of
- // the entries scheduled to be copied.
- if (this.isOnSameRoot(entries[0], targetDirEntry)) {
+ if (this.isMovable(entries[0], targetDirEntry)) {
copyTask.move = true;
} else {
copyTask.deleteAfterCopy = true;
« no previous file with comments | « chrome/browser/chromeos/drive/file_system/move_operation.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698