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 var MAX_DRAG_THUMBAIL_COUNT = 4; | 5 var MAX_DRAG_THUMBAIL_COUNT = 4; |
6 | 6 |
7 /** | 7 /** |
8 * Global (placed in the window object) variable name to hold internal | 8 * Global (placed in the window object) variable name to hold internal |
9 * file dragging information. Needed to show visual feedback while dragging | 9 * file dragging information. Needed to show visual feedback while dragging |
10 * since DataTransfer object is in protected state. Reachable from other | 10 * since DataTransfer object is in protected state. Reachable from other |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 // queryCommandEnabled returns true if event.returnValue is false. | 393 // queryCommandEnabled returns true if event.returnValue is false. |
394 event.returnValue = !this.canPasteOrDrop_(event.clipboardData); | 394 event.returnValue = !this.canPasteOrDrop_(event.clipboardData); |
395 }, | 395 }, |
396 | 396 |
397 canPasteOrDrop_: function(dataTransfer, opt_destinationPath) { | 397 canPasteOrDrop_: function(dataTransfer, opt_destinationPath) { |
398 var destinationPath = opt_destinationPath || | 398 var destinationPath = opt_destinationPath || |
399 this.directoryModel_.getCurrentDirPath(); | 399 this.directoryModel_.getCurrentDirPath(); |
400 if (this.directoryModel_.isPathReadOnly(destinationPath)) { | 400 if (this.directoryModel_.isPathReadOnly(destinationPath)) { |
401 return false; | 401 return false; |
402 } | 402 } |
| 403 if (util.isSpecialReadonlyDirectory(destinationPath)) |
| 404 return false; |
403 | 405 |
404 if (!dataTransfer.types || dataTransfer.types.indexOf('fs/tag') == -1) | 406 if (!dataTransfer.types || dataTransfer.types.indexOf('fs/tag') == -1) |
405 return false; // Unsupported type of content. | 407 return false; // Unsupported type of content. |
406 if (dataTransfer.getData('fs/tag') == '') { | 408 if (dataTransfer.getData('fs/tag') == '') { |
407 // Data protected. Other checks are not possible but it makes sense to | 409 // Data protected. Other checks are not possible but it makes sense to |
408 // let the user try. | 410 // let the user try. |
409 return true; | 411 return true; |
410 } | 412 } |
411 | 413 |
412 var directories = dataTransfer.getData('fs/directories').split('\n'). | 414 var directories = dataTransfer.getData('fs/directories').split('\n'). |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 return 'move'; | 523 return 'move'; |
522 } | 524 } |
523 if (event.dataTransfer.effectAllowed == 'copyMove' && | 525 if (event.dataTransfer.effectAllowed == 'copyMove' && |
524 event.shiftKey) { | 526 event.shiftKey) { |
525 return 'move'; | 527 return 'move'; |
526 } | 528 } |
527 return 'copy'; | 529 return 'copy'; |
528 } | 530 } |
529 }; | 531 }; |
530 | 532 |
OLD | NEW |