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

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

Issue 7677032: ntp4: make app-install-via-drag less janky (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more test fixes Created 9 years, 4 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
Index: chrome/browser/resources/ntp4/apps_page.js
diff --git a/chrome/browser/resources/ntp4/apps_page.js b/chrome/browser/resources/ntp4/apps_page.js
index cd4b0845aa7ae308d818af815ffc7801622fb640..5cd2b5d747e33592a34988c2ea7dab0a6c47abbc 100644
--- a/chrome/browser/resources/ntp4/apps_page.js
+++ b/chrome/browser/resources/ntp4/apps_page.js
@@ -403,6 +403,17 @@ cr.define('ntp4', function() {
this.appendTile(new App(appData), animate);
},
+ /** @inheritdoc */
+ doDragOver: function(e) {
+ var tile = ntp4.getCurrentlyDraggingTile();
+ if (!tile.querySelector('.app')) {
+ e.preventDefault();
+ e.dataTransfer.dropEffect = 'copy';
+ } else {
+ TilePage.prototype.doDragOver.call(this, e);
+ }
+ },
+
/** @inheritDoc */
shouldAcceptDrag: function(e) {
return ntp4.getCurrentlyDraggingTile() ||
@@ -419,7 +430,7 @@ cr.define('ntp4', function() {
currentlyDraggingTile,
this.tileElements_[index]);
this.tileMoved(currentlyDraggingTile);
- } else if (tileContents.classList.contains('most-visited')) {
+ } else if (currentlyDraggingTile.querySelector('.most-visited')) {
this.generateAppForLink(tileContents.data);
}
} else {
@@ -473,7 +484,8 @@ cr.define('ntp4', function() {
generateAppForLink: function(data) {
assert(data.url != undefined);
assert(data.title != undefined);
- chrome.send('generateAppForLink', [data.url, data.title]);
+ var pageIndex = ntp4.getAppsPageIndex(this);
+ chrome.send('generateAppForLink', [data.url, data.title, pageIndex]);
},
/** @inheritDoc */

Powered by Google App Engine
This is Rietveld 408576698