From 0465236cf9932785a35d82ebc0374553ec852173 Mon Sep 17 00:00:00 2001 From: "estade@chromium.org" Date: Fri, 5 Aug 2011 18:45:07 +0000 Subject: ntp4: polish app trashing - don't allow un-uninstallable apps to be trashed - fade effect when dragging over trash BUG=90894 TEST=manual Review URL: http://codereview.chromium.org/7572041 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@95640 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/resources/ntp4/tile_page.css | 5 +++++ chrome/browser/resources/ntp4/trash.js | 14 +++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/chrome/browser/resources/ntp4/tile_page.css b/chrome/browser/resources/ntp4/tile_page.css index 37d9897..4b1c87f 100644 --- a/chrome/browser/resources/ntp4/tile_page.css +++ b/chrome/browser/resources/ntp4/tile_page.css @@ -73,6 +73,7 @@ pointer-events: none; position: fixed; z-index: 3; + -webkit-transition: opacity 0.2s; } .tile.drag-representation.placing > * { @@ -89,6 +90,10 @@ -webkit-transition: left 200ms, right 200ms, top 200ms; } +.hovering-on-trash { + opacity: 0.6; +} + .animating-tile-page .top-margin { -webkit-transition: margin-bottom 200ms; } diff --git a/chrome/browser/resources/ntp4/trash.js b/chrome/browser/resources/ntp4/trash.js index 2502601..e554e2e 100644 --- a/chrome/browser/resources/ntp4/trash.js +++ b/chrome/browser/resources/ntp4/trash.js @@ -29,7 +29,15 @@ cr.define('ntp4', function() { * @return {bool} */ shouldAcceptDrag: function(e) { - return !!ntp4.getCurrentlyDraggingTile().querySelector('.app'); + var tile = ntp4.getCurrentlyDraggingTile(); + if (!tile) + return false; + + var app = tile.querySelector('.app'); + if (!app) + return false; + + return app.appData.can_uninstall; }, /** @@ -37,6 +45,8 @@ cr.define('ntp4', function() { * @param {Event} e The drag event. */ doDragOver: function(e) { + ntp4.getCurrentlyDraggingTile().dragClone.classList.add( + 'hovering-on-trash'); e.preventDefault(); e.dataTransfer.dropEffect = 'move'; }, @@ -73,6 +83,8 @@ cr.define('ntp4', function() { * @param {Event} e The drag event. */ doDragLeave: function(e) { + ntp4.getCurrentlyDraggingTile().dragClone.classList.remove( + 'hovering-on-trash'); }, }; -- cgit v1.1