| 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 'use strict'; | 5 'use strict'; |
| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 */ | 92 */ |
| 93 attachTreeDropTarget: function(tree) { | 93 attachTreeDropTarget: function(tree) { |
| 94 tree.addEventListener('dragover', this.onDragOver_.bind(this, true, tree)); | 94 tree.addEventListener('dragover', this.onDragOver_.bind(this, true, tree)); |
| 95 tree.addEventListener('dragenter', this.onDragEnterTree_.bind(this, tree)); | 95 tree.addEventListener('dragenter', this.onDragEnterTree_.bind(this, tree)); |
| 96 tree.addEventListener('dragleave', this.onDragLeave_.bind(this, tree)); | 96 tree.addEventListener('dragleave', this.onDragLeave_.bind(this, tree)); |
| 97 tree.addEventListener('drop', this.onDrop_.bind(this, true)); | 97 tree.addEventListener('drop', this.onDrop_.bind(this, true)); |
| 98 }, | 98 }, |
| 99 | 99 |
| 100 /** | 100 /** |
| 101 * @this {FileTransferController} | 101 * @this {FileTransferController} |
| 102 * @param {VolumeList} tree Its sub items will could be drop target. | 102 * @param {NavigationList} tree Its sub items will could be drop target. |
| 103 */ | 103 */ |
| 104 attachVolumesDropTarget: function(list) { | 104 attachNavigationListDropTarget: function(list) { |
| 105 list.addEventListener('dragover', | 105 list.addEventListener('dragover', |
| 106 this.onDragOver_.bind(this, true /* onlyIntoDirectories */, list)); | 106 this.onDragOver_.bind(this, true /* onlyIntoDirectories */, list)); |
| 107 list.addEventListener('dragenter', | 107 list.addEventListener('dragenter', |
| 108 this.onDragEnterVolumesList_.bind(this, list)); | 108 this.onDragEnterVolumesList_.bind(this, list)); |
| 109 list.addEventListener('dragleave', this.onDragLeave_.bind(this, list)); | 109 list.addEventListener('dragleave', this.onDragLeave_.bind(this, list)); |
| 110 list.addEventListener('drop', | 110 list.addEventListener('drop', |
| 111 this.onDrop_.bind(this, true /* onlyIntoDirectories */)); | 111 this.onDrop_.bind(this, true /* onlyIntoDirectories */)); |
| 112 }, | 112 }, |
| 113 | 113 |
| 114 /** | 114 /** |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 if (entry) { | 402 if (entry) { |
| 403 this.setDropTarget_(item, entry.isDirectory, event.dataTransfer, | 403 this.setDropTarget_(item, entry.isDirectory, event.dataTransfer, |
| 404 entry.fullPath); | 404 entry.fullPath); |
| 405 } else { | 405 } else { |
| 406 this.clearDropTarget_(); | 406 this.clearDropTarget_(); |
| 407 } | 407 } |
| 408 }, | 408 }, |
| 409 | 409 |
| 410 /** | 410 /** |
| 411 * @this {FileTransferController} | 411 * @this {FileTransferController} |
| 412 * @param {VolumeList} list Drop target list. | 412 * @param {NavigationList} list Drop target list. |
| 413 * @param {Event} event A dragenter event of DOM. | 413 * @param {Event} event A dragenter event of DOM. |
| 414 */ | 414 */ |
| 415 onDragEnterVolumesList_: function(list, event) { | 415 onDragEnterVolumesList_: function(list, event) { |
| 416 event.preventDefault(); // Required to prevent the cursor flicker. | 416 event.preventDefault(); // Required to prevent the cursor flicker. |
| 417 this.lastEnteredTarget_ = event.target; | 417 this.lastEnteredTarget_ = event.target; |
| 418 var item = list.getListItemAncestor(event.target); | 418 var item = list.getListItemAncestor(event.target); |
| 419 item = item && list.isItem(item) ? item : null; | 419 item = item && list.isItem(item) ? item : null; |
| 420 if (item == this.dropTarget_) | 420 if (item == this.dropTarget_) |
| 421 return; | 421 return; |
| 422 | 422 |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 830 !event.ctrlKey) { | 830 !event.ctrlKey) { |
| 831 return 'move'; | 831 return 'move'; |
| 832 } | 832 } |
| 833 if (event.dataTransfer.effectAllowed == 'copyMove' && | 833 if (event.dataTransfer.effectAllowed == 'copyMove' && |
| 834 event.shiftKey) { | 834 event.shiftKey) { |
| 835 return 'move'; | 835 return 'move'; |
| 836 } | 836 } |
| 837 return 'copy'; | 837 return 'copy'; |
| 838 }, | 838 }, |
| 839 }; | 839 }; |
| OLD | NEW |