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 (this.directoryModel_.isSearching()) | |
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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
474 entries.filter(function(e) {return e.isDirectory}).length == 0 && | 476 entries.filter(function(e) {return e.isDirectory}).length == 0 && |
475 props.filter(function(p) {return !p.availableOffline}).length == 0; | 477 props.filter(function(p) {return !p.availableOffline}).length == 0; |
476 // |Copy| is the only menu item affected by allGDataFilesAvailable. | 478 // |Copy| is the only menu item affected by allGDataFilesAvailable. |
477 // It could be open right now, update its UI. | 479 // It could be open right now, update its UI. |
478 this.copyCommand_.disabled = !this.canCopyOrDrag_(); | 480 this.copyCommand_.disabled = !this.canCopyOrDrag_(); |
479 }.bind(this)); | 481 }.bind(this)); |
480 } | 482 } |
481 }, | 483 }, |
482 | 484 |
483 get currentDirectory() { | 485 get currentDirectory() { |
484 return this.directoryModel_.getCurrentDirEntry(); | 486 return this.directoryModel_.getSearchOrCurrentDirEntry(); |
SeRya
2012/05/15 06:17:01
currentDirectory doesn't make sense for search res
tbarzic
2012/05/16 03:50:04
setting sourceDir to empty string would break copy
| |
485 }, | 487 }, |
486 | 488 |
487 get readonly() { | 489 get readonly() { |
488 return this.directoryModel_.isReadOnly(); | 490 return this.directoryModel_.isReadOnly(); |
489 }, | 491 }, |
490 | 492 |
491 get isOnGData() { | 493 get isOnGData() { |
492 return this.directoryModel_.getRootType() == DirectoryModel.RootType.GDATA; | 494 return this.directoryModel_.getRootType() == DirectoryModel.RootType.GDATA; |
493 }, | 495 }, |
494 | 496 |
(...skipping 26 matching lines...) Expand all 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 |