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

Unified Diff: ui/file_manager/file_manager/foreground/js/file_transfer_controller.js

Issue 290653002: Files.app: Add 'link' to the allowed effects in dataTransfer objects. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Created 6 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 | « ui/file_manager/file_manager/common/js/util.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/file_manager/file_manager/foreground/js/file_transfer_controller.js
diff --git a/ui/file_manager/file_manager/foreground/js/file_transfer_controller.js b/ui/file_manager/file_manager/foreground/js/file_transfer_controller.js
index 7eabf80f2088320c8953c14ea60ad78e9427006a..5f6535427c30df755a3276a4ee2211b6da475f0b 100644
--- a/ui/file_manager/file_manager/foreground/js/file_transfer_controller.js
+++ b/ui/file_manager/file_manager/foreground/js/file_transfer_controller.js
@@ -165,7 +165,7 @@ FileTransferController.prototype = {
* @this {FileTransferController}
* @param {DataTransfer} dataTransfer DataTransfer from the event.
* @param {string} effectAllowed Value must be valid for the
- * |dataTransfer.effectAllowed| property ('move', 'copy', 'copyMove').
+ * |dataTransfer.effectAllowed| property.
*/
cutOrCopy_: function(dataTransfer, effectAllowed) {
// Existence of the volumeInfo is checked in canXXX methods.
@@ -329,8 +329,9 @@ FileTransferController.prototype = {
// work fine.
var effectAllowed = dataTransfer.effectAllowed !== 'uninitialized' ?
dataTransfer.effectAllowed : dataTransfer.getData('fs/effectallowed');
- var toMove = effectAllowed === 'move' ||
- (effectAllowed === 'copyMove' && opt_effect === 'move');
+ var toMove = util.isDropEffectAllowed(effectAllowed, 'move') &&
+ (!util.isDropEffectAllowed(effectAllowed, 'copy') ||
+ opt_effect === 'move');
var destinationEntry =
opt_destinationEntry || this.currentDirectoryContentEntry;
var entries;
@@ -489,9 +490,9 @@ FileTransferController.prototype = {
var canCut = this.canCutOrDrag_(dt);
if (canCopy || canCut) {
if (canCopy && canCut) {
- this.cutOrCopy_(dt, 'copyMove');
+ this.cutOrCopy_(dt, 'all');
} else if (canCopy) {
- this.cutOrCopy_(dt, 'copy');
+ this.cutOrCopy_(dt, 'copyLink');
} else {
this.cutOrCopy_(dt, 'move');
}
@@ -1047,19 +1048,19 @@ FileTransferController.prototype = {
return 'none';
if (destinationLocationInfo.isReadOnly)
return 'none';
- if (event.dataTransfer.effectAllowed === 'move')
- return 'move';
- // TODO(mtomasz): Use volumeId instead of comparing roots, as soon as
- // volumeId gets unique.
- if (event.dataTransfer.effectAllowed === 'copyMove' &&
- this.getSourceRootURL_(event.dataTransfer) ===
- destinationLocationInfo.volumeInfo.fileSystem.root.toURL() &&
- !event.ctrlKey) {
- return 'move';
- }
- if (event.dataTransfer.effectAllowed === 'copyMove' &&
- event.shiftKey) {
- return 'move';
+ if (util.isDropEffectAllowed(event.dataTransfer.effectAllowed, 'move')) {
+ if (!util.isDropEffectAllowed(event.dataTransfer.effectAllowed, 'copy'))
+ return 'move';
+ // TODO(mtomasz): Use volumeId instead of comparing roots, as soon as
+ // volumeId gets unique.
+ if (this.getSourceRootURL_(event.dataTransfer) ===
+ destinationLocationInfo.volumeInfo.fileSystem.root.toURL() &&
+ !event.ctrlKey) {
+ return 'move';
+ }
+ if (event.shiftKey) {
+ return 'move';
+ }
}
return 'copy';
},
« no previous file with comments | « ui/file_manager/file_manager/common/js/util.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698