Chromium Code Reviews| Index: chrome/browser/resources/ntp4/tile_page.js |
| diff --git a/chrome/browser/resources/ntp4/tile_page.js b/chrome/browser/resources/ntp4/tile_page.js |
| index b5ed39d6c18e17969c7e5bb833022ddcd671d2c8..bd85b78b4ea1aef1c7cda24a9cc7121b1f9cbc44 100644 |
| --- a/chrome/browser/resources/ntp4/tile_page.js |
| +++ b/chrome/browser/resources/ntp4/tile_page.js |
| @@ -20,6 +20,19 @@ cr.define('ntp4', function() { |
| } |
| /** |
| + * Changes the current dropEffect of a drag. This modifies the native cursor |
|
Evan Stade
2011/09/21 21:58:29
one space after .
Dan Beam
2011/09/21 23:28:38
Done. (damn my English teachers)
|
| + * and serves as an indicator of what we should do at the end of the drag as |
| + * well as give indication to the user if a drop would succeed if they let go. |
| + * @param {DataTransfer} dataTransfer A dataTransfer object from a drag event. |
| + * @param {string} effect A drop effect to change to (i.e. copy, move, none). |
| + */ |
| + function setCurrentDropEffect(dataTransfer, effect) { |
| + dataTransfer.dropEffect = effect; |
| + if (currentlyDraggingTile) |
| + currentlyDraggingTile.lastDropEffect = dataTransfer.dropEffect; |
| + } |
| + |
| + /** |
| * Creates a new Tile object. Tiles wrap content on a TilePage, providing |
| * some styling and drag functionality. |
| * @constructor |
| @@ -161,8 +174,8 @@ cr.define('ntp4', function() { |
| } else if (tilePage) { |
| // TODO(dbeam): Until we fix dropEffect to the correct behavior it will |
| // differ on windows - crbug.com/39399. That's why we use the custom |
| - // tilePage.lastDropEffect_ instead of e.dataTransfer.dropEffect. |
| - if (tilePage.selected && tilePage.lastDropEffect_ != 'copy') { |
| + // this.lastDropEffect instead of e.dataTransfer.dropEffect. |
| + if (tilePage.selected && this.lastDropEffect != 'copy') { |
| // The drag clone can still be hidden from the last drag move event. |
| this.dragClone.hidden = false; |
| // The tile's contents may have moved following the respositioning; |
| @@ -183,6 +196,7 @@ cr.define('ntp4', function() { |
| } |
| } |
| + delete this.lastDropEffect; |
| this.landedOnTrash = false; |
| }, |
| @@ -934,8 +948,6 @@ cr.define('ntp4', function() { |
| if (newDragIndex < 0 || newDragIndex >= this.tileElements_.length) |
| newDragIndex = this.dragItemIndex_; |
| this.updateDropIndicator_(newDragIndex); |
| - |
| - this.lastDropEffect_ = e.dataTransfer.dropEffect; |
| }, |
| /** |
| @@ -1074,6 +1086,7 @@ cr.define('ntp4', function() { |
| return { |
| getCurrentlyDraggingTile: getCurrentlyDraggingTile, |
| + setCurrentDropEffect: setCurrentDropEffect, |
| TilePage: TilePage, |
| }; |
| }); |