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

Unified Diff: chrome/browser/resources/ntp4/tile_page.js

Issue 7951011: Moving where I'm doing dropEffect normalization. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: small whitespace changes Created 9 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/ntp4/nav_dot.js ('k') | chrome/browser/resources/ntp4/trash.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..72f2a6622410f09a7867ab40a050c3dcef25524c 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
+ * 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,
};
});
« no previous file with comments | « chrome/browser/resources/ntp4/nav_dot.js ('k') | chrome/browser/resources/ntp4/trash.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698