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

Side by Side Diff: chrome/browser/resources/file_manager/js/file_transfer_controller.js

Issue 12677002: Adds animation on a hovered directory/volume when dragging files in Files.app (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/resources/file_manager/css/file_manager.css ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 /** 5 /**
6 * Global (placed in the window object) variable name to hold internal 6 * Global (placed in the window object) variable name to hold internal
7 * file dragging information. Needed to show visual feedback while dragging 7 * file dragging information. Needed to show visual feedback while dragging
8 * since DataTransfer object is in protected state. Reachable from other 8 * since DataTransfer object is in protected state. Reachable from other
9 * file manager instances. 9 * file manager instances.
10 */ 10 */
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 event.preventDefault(); 417 event.preventDefault();
418 this.paste(event.dataTransfer, destinationPath, 418 this.paste(event.dataTransfer, destinationPath,
419 this.selectDropEffect_(event, destinationPath)); 419 this.selectDropEffect_(event, destinationPath));
420 this.setDropTarget_(null); 420 this.setDropTarget_(null);
421 }, 421 },
422 422
423 /** 423 /**
424 * @this {FileTransferController} 424 * @this {FileTransferController}
425 */ 425 */
426 setDropTarget_: function(domElement, isDirectory, opt_dataTransfer, 426 setDropTarget_: function(domElement, isDirectory, opt_dataTransfer,
427 opt_destinationPath) { 427 opt_destinationPath) {
yoshiki 2013/03/08 08:10:38 Could you add @param annotations?
mtomasz 2013/03/11 03:17:50 Done.
428 if (this.dropTarget_ == domElement) 428 if (this.dropTarget_ == domElement)
429 return; 429 return;
430 430
431 /** @type {string?} */ 431 /** @type {string?} */
432 this.destinationPath_ = null; 432 this.destinationPath_ = null;
433 if (domElement) { 433 if (domElement) {
434 if (isDirectory && 434 if (isDirectory &&
435 this.canPasteOrDrop_(opt_dataTransfer, opt_destinationPath)) { 435 this.canPasteOrDrop_(opt_dataTransfer, opt_destinationPath)) {
yoshiki 2013/03/08 08:10:38 The first argument of |canPasteOrDrop_| seems not
mtomasz 2013/03/11 03:17:50 Done.
436 domElement.classList.add('accepts'); 436 domElement.classList.add('accepts');
437 this.destinationPath_ = opt_destinationPath; 437 this.destinationPath_ = opt_destinationPath;
438 } 438 }
439 } 439 }
440 if (this.dropTarget_ && this.dropTarget_.classList.contains('accepts')) { 440 if (this.dropTarget_ && this.dropTarget_.classList.contains('accepts')) {
441 var oldDropTarget = this.dropTarget_; 441 var oldDropTarget = this.dropTarget_;
442 var self = this; 442 var self = this;
443 setTimeout(function() { 443 setTimeout(function() {
444 if (oldDropTarget != self.dropTarget_) 444 if (oldDropTarget != self.dropTarget_)
445 oldDropTarget.classList.remove('accepts'); 445 oldDropTarget.classList.remove('accepts');
446 }, 0); 446 }, 0);
447 } 447 }
448 this.dropTarget_ = domElement; 448 this.dropTarget_ = domElement;
449 if (this.navigateTimer_ !== undefined) { 449 if (this.navigateTimer_ !== undefined) {
450 clearTimeout(this.navigateTimer_); 450 clearTimeout(this.navigateTimer_);
451 this.navigateTimer_ = undefined; 451 this.navigateTimer_ = undefined;
452 } 452 }
453 if (domElement && isDirectory && opt_destinationPath) { 453 if (domElement && isDirectory && opt_destinationPath &&
454 this.canPasteOrDrop_(opt_dataTransfer, opt_destinationPath)) {
yoshiki 2013/03/08 08:10:38 ditto.
mtomasz 2013/03/11 03:17:50 Done.
454 this.navigateTimer_ = setTimeout(function() { 455 this.navigateTimer_ = setTimeout(function() {
455 this.directoryModel_.changeDirectory(opt_destinationPath); 456 this.directoryModel_.changeDirectory(opt_destinationPath);
456 }.bind(this), 2000); 457 }.bind(this), 2000);
457 } 458 }
458 }, 459 },
459 460
460 /** 461 /**
461 * @this {FileTransferController} 462 * @this {FileTransferController}
462 * @return {boolean} Returns false if {@code <input type="text">} element is 463 * @return {boolean} Returns false if {@code <input type="text">} element is
463 * currently active. Otherwise, returns true. 464 * currently active. Otherwise, returns true.
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 return; 567 return;
567 // queryCommandEnabled returns true if event.returnValue is false. 568 // queryCommandEnabled returns true if event.returnValue is false.
568 event.returnValue = !this.canPasteOrDrop_(event.clipboardData); 569 event.returnValue = !this.canPasteOrDrop_(event.clipboardData);
569 }, 570 },
570 571
571 /** 572 /**
572 * @this {FileTransferController} 573 * @this {FileTransferController}
573 * @return {boolean} Returns true if {@code opt_destinationPath} is 574 * @return {boolean} Returns true if {@code opt_destinationPath} is
574 * available to be pasted to. Otherwise, returns false. 575 * available to be pasted to. Otherwise, returns false.
575 */ 576 */
576 canPasteOrDrop_: function(dataTransfer, opt_destinationPath) { 577 canPasteOrDrop_: function(dataTransfer, opt_destinationPath) {
yoshiki 2013/03/08 08:10:38 Could you add @param annotations?
mtomasz 2013/03/11 03:17:50 Done.
577 var destinationPath = opt_destinationPath || 578 var destinationPath = opt_destinationPath ||
578 this.directoryModel_.getCurrentDirPath(); 579 this.directoryModel_.getCurrentDirPath();
579 if (this.directoryModel_.isPathReadOnly(destinationPath)) { 580 if (this.directoryModel_.isPathReadOnly(destinationPath)) {
580 return false; 581 return false;
581 } 582 }
582 if (this.directoryModel_.isSearching()) 583 if (this.directoryModel_.isSearching())
583 return false; 584 return false;
584 585
585 if (!dataTransfer.types || dataTransfer.types.indexOf('fs/tag') == -1) 586 if (!dataTransfer.types || dataTransfer.types.indexOf('fs/tag') == -1)
586 return false; // Unsupported type of content. 587 return false; // Unsupported type of content.
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 !event.ctrlKey) { 764 !event.ctrlKey) {
764 return 'move'; 765 return 'move';
765 } 766 }
766 if (event.dataTransfer.effectAllowed == 'copyMove' && 767 if (event.dataTransfer.effectAllowed == 'copyMove' &&
767 event.shiftKey) { 768 event.shiftKey) {
768 return 'move'; 769 return 'move';
769 } 770 }
770 return 'copy'; 771 return 'copy';
771 }, 772 },
772 }; 773 };
OLDNEW
« no previous file with comments | « chrome/browser/resources/file_manager/css/file_manager.css ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698