| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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; |
| OLD | NEW |