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

Side by Side Diff: chrome/browser/resources/ntp4/trash.js

Issue 7572041: ntp4: polish app trashing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/resources/ntp4/tile_page.css ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 11 matching lines...) Expand all
22 initialize: function(element) { 22 initialize: function(element) {
23 this.dragWrapper_ = new DragWrapper(this, this); 23 this.dragWrapper_ = new DragWrapper(this, this);
24 }, 24 },
25 25
26 /** 26 /**
27 * Determines whether we are interested in the drag data for |e|. 27 * Determines whether we are interested in the drag data for |e|.
28 * @param {Event} e The event from drag enter. 28 * @param {Event} e The event from drag enter.
29 * @return {bool} 29 * @return {bool}
30 */ 30 */
31 shouldAcceptDrag: function(e) { 31 shouldAcceptDrag: function(e) {
32 return !!ntp4.getCurrentlyDraggingTile().querySelector('.app'); 32 var tile = ntp4.getCurrentlyDraggingTile();
33 if (!tile)
34 return false;
35
36 var app = tile.querySelector('.app');
37 if (!app)
38 return false;
39
40 return app.appData.can_uninstall;
33 }, 41 },
34 42
35 /** 43 /**
36 * Drag over handler. 44 * Drag over handler.
37 * @param {Event} e The drag event. 45 * @param {Event} e The drag event.
38 */ 46 */
39 doDragOver: function(e) { 47 doDragOver: function(e) {
48 ntp4.getCurrentlyDraggingTile().dragClone.classList.add(
49 'hovering-on-trash');
40 e.preventDefault(); 50 e.preventDefault();
41 e.dataTransfer.dropEffect = 'move'; 51 e.dataTransfer.dropEffect = 'move';
42 }, 52 },
43 53
44 /** 54 /**
45 * Drag enter handler. 55 * Drag enter handler.
46 * @param {Event} e The drag event. 56 * @param {Event} e The drag event.
47 */ 57 */
48 doDragEnter: function(e) { 58 doDragEnter: function(e) {
49 this.doDragOver(e); 59 this.doDragOver(e);
(...skipping 16 matching lines...) Expand all
66 var page = tile.tilePage; 76 var page = tile.tilePage;
67 tile.parentNode.removeChild(tile); 77 tile.parentNode.removeChild(tile);
68 page.cleanupDrag(); 78 page.cleanupDrag();
69 }, 79 },
70 80
71 /** 81 /**
72 * Drag leave handler. 82 * Drag leave handler.
73 * @param {Event} e The drag event. 83 * @param {Event} e The drag event.
74 */ 84 */
75 doDragLeave: function(e) { 85 doDragLeave: function(e) {
86 ntp4.getCurrentlyDraggingTile().dragClone.classList.remove(
87 'hovering-on-trash');
76 }, 88 },
77 }; 89 };
78 90
79 return { 91 return {
80 Trash: Trash, 92 Trash: Trash,
81 }; 93 };
82 }); 94 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/ntp4/tile_page.css ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698