| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 * @fileoverview Trash | 6 * @fileoverview Trash |
| 7 * This is the class for the trash can that appears when dragging an app. | 7 * This is the class for the trash can that appears when dragging an app. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 cr.define('ntp4', function() { | 10 cr.define('ntp4', function() { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 return tile.firstChild.canBeRemoved(); | 36 return tile.firstChild.canBeRemoved(); |
| 37 }, | 37 }, |
| 38 | 38 |
| 39 /** | 39 /** |
| 40 * Drag over handler. | 40 * Drag over handler. |
| 41 * @param {Event} e The drag event. | 41 * @param {Event} e The drag event. |
| 42 */ | 42 */ |
| 43 doDragOver: function(e) { | 43 doDragOver: function(e) { |
| 44 ntp4.getCurrentlyDraggingTile().dragClone.classList.add( | 44 ntp4.getCurrentlyDraggingTile().dragClone.classList.add( |
| 45 'hovering-on-trash'); | 45 'hovering-on-trash'); |
| 46 this.classList.add('could-drop'); |
| 46 ntp4.setCurrentDropEffect(e.dataTransfer, 'move'); | 47 ntp4.setCurrentDropEffect(e.dataTransfer, 'move'); |
| 47 e.preventDefault(); | 48 e.preventDefault(); |
| 48 }, | 49 }, |
| 49 | 50 |
| 50 /** | 51 /** |
| 51 * Drag enter handler. | 52 * Drag enter handler. |
| 52 * @param {Event} e The drag event. | 53 * @param {Event} e The drag event. |
| 53 */ | 54 */ |
| 54 doDragEnter: function(e) { | 55 doDragEnter: function(e) { |
| 55 this.doDragOver(e); | 56 this.doDragOver(e); |
| 56 }, | 57 }, |
| 57 | 58 |
| 58 /** | 59 /** |
| 59 * Drop handler. | 60 * Drop handler. |
| 60 * @param {Event} e The drag event. | 61 * @param {Event} e The drag event. |
| 61 */ | 62 */ |
| 62 doDrop: function(e) { | 63 doDrop: function(e) { |
| 63 e.preventDefault(); | 64 e.preventDefault(); |
| 64 | 65 |
| 65 var tile = ntp4.getCurrentlyDraggingTile(); | 66 var tile = ntp4.getCurrentlyDraggingTile(); |
| 66 tile.firstChild.removeFromChrome(); | 67 tile.firstChild.removeFromChrome(); |
| 67 tile.landedOnTrash = true; | 68 tile.landedOnTrash = true; |
| 69 this.classList.remove('could-drop'); |
| 68 }, | 70 }, |
| 69 | 71 |
| 70 /** | 72 /** |
| 71 * Drag leave handler. | 73 * Drag leave handler. |
| 72 * @param {Event} e The drag event. | 74 * @param {Event} e The drag event. |
| 73 */ | 75 */ |
| 74 doDragLeave: function(e) { | 76 doDragLeave: function(e) { |
| 75 ntp4.getCurrentlyDraggingTile().dragClone.classList.remove( | 77 ntp4.getCurrentlyDraggingTile().dragClone.classList.remove( |
| 76 'hovering-on-trash'); | 78 'hovering-on-trash'); |
| 79 this.classList.remove('could-drop'); |
| 77 }, | 80 }, |
| 78 }; | 81 }; |
| 79 | 82 |
| 80 return { | 83 return { |
| 81 Trash: Trash, | 84 Trash: Trash, |
| 82 }; | 85 }; |
| 83 }); | 86 }); |
| OLD | NEW |