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

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

Issue 7969027: ntp4: drag from bookmark page to apps page (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: disallow folder drags 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 cr.define('ntp4', function() { 5 cr.define('ntp4', function() {
6 'use strict'; 6 'use strict';
7 7
8 var localStrings = new LocalStrings; 8 var localStrings = new LocalStrings;
9 9
10 var APP_LAUNCH = { 10 var APP_LAUNCH = {
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 if (tile && !tile.querySelector('.app')) { 621 if (tile && !tile.querySelector('.app')) {
622 e.preventDefault(); 622 e.preventDefault();
623 this.setDropEffect(e.dataTransfer); 623 this.setDropEffect(e.dataTransfer);
624 } else { 624 } else {
625 TilePage.prototype.doDragOver.call(this, e); 625 TilePage.prototype.doDragOver.call(this, e);
626 } 626 }
627 }, 627 },
628 628
629 /** @inheritDoc */ 629 /** @inheritDoc */
630 shouldAcceptDrag: function(e) { 630 shouldAcceptDrag: function(e) {
631 return ntp4.getCurrentlyDraggingTile() || 631 var tile = ntp4.getCurrentlyDraggingTile();
632 if (tile.querySelector('.bookmark'))
633 return !!tile.firstChild.data.url;
634
635 return tile ||
632 (e.dataTransfer && e.dataTransfer.types.indexOf('url') != -1); 636 (e.dataTransfer && e.dataTransfer.types.indexOf('url') != -1);
633 }, 637 },
634 638
635 /** @inheritDoc */ 639 /** @inheritDoc */
636 addDragData: function(dataTransfer, index) { 640 addDragData: function(dataTransfer, index) {
637 var currentlyDraggingTile = ntp4.getCurrentlyDraggingTile(); 641 var currentlyDraggingTile = ntp4.getCurrentlyDraggingTile();
638 if (currentlyDraggingTile) { 642 if (currentlyDraggingTile) {
639 var tileContents = currentlyDraggingTile.firstChild; 643 var tileContents = currentlyDraggingTile.firstChild;
640 if (tileContents.classList.contains('app')) { 644 if (tileContents.classList.contains('app')) {
641 this.tileGrid_.insertBefore( 645 this.tileGrid_.insertBefore(
642 currentlyDraggingTile, 646 currentlyDraggingTile,
643 this.tileElements_[index]); 647 this.tileElements_[index]);
644 this.tileMoved(currentlyDraggingTile); 648 this.tileMoved(currentlyDraggingTile);
645 } else if (currentlyDraggingTile.querySelector('.most-visited')) { 649 } else if (currentlyDraggingTile.querySelector(
650 '.most-visited, .bookmark')) {
646 this.generateAppForLink(tileContents.data); 651 this.generateAppForLink(tileContents.data);
647 } 652 }
648 } else { 653 } else {
649 this.addOutsideData_(dataTransfer, index); 654 this.addOutsideData_(dataTransfer, index);
650 } 655 }
651 }, 656 },
652 657
653 /** 658 /**
654 * Adds drag data that has been dropped from a source that is not a tile. 659 * Adds drag data that has been dropped from a source that is not a tile.
655 * @param {Object} dataTransfer The data transfer object that holds drop 660 * @param {Object} dataTransfer The data transfer object that holds drop
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 appNotificationChanged: appNotificationChanged, 754 appNotificationChanged: appNotificationChanged,
750 AppsPage: AppsPage, 755 AppsPage: AppsPage,
751 launchAppAfterEnable: launchAppAfterEnable, 756 launchAppAfterEnable: launchAppAfterEnable,
752 }; 757 };
753 }); 758 });
754 759
755 // TODO(estade): update the content handlers to use ntp namespace instead of 760 // TODO(estade): update the content handlers to use ntp namespace instead of
756 // making these global. 761 // making these global.
757 var appNotificationChanged = ntp4.appNotificationChanged; 762 var appNotificationChanged = ntp4.appNotificationChanged;
758 var launchAppAfterEnable = ntp4.launchAppAfterEnable; 763 var launchAppAfterEnable = ntp4.launchAppAfterEnable;
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698