OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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('ntp', function() { | 5 cr.define('ntp', 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 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
783 if (tile && !tile.querySelector('.app')) { | 783 if (tile && !tile.querySelector('.app')) { |
784 e.preventDefault(); | 784 e.preventDefault(); |
785 this.setDropEffect(e.dataTransfer); | 785 this.setDropEffect(e.dataTransfer); |
786 } else { | 786 } else { |
787 TilePage.prototype.doDragOver.call(this, e); | 787 TilePage.prototype.doDragOver.call(this, e); |
788 } | 788 } |
789 }, | 789 }, |
790 | 790 |
791 /** @inheritDoc */ | 791 /** @inheritDoc */ |
792 shouldAcceptDrag: function(e) { | 792 shouldAcceptDrag: function(e) { |
793 return !!ntp.getCurrentlyDraggingTile() || | 793 if (ntp.getCurrentlyDraggingTile()) |
794 (e.dataTransfer && e.dataTransfer.types.contains('text/uri-list')); | 794 return true; |
| 795 if (!e.dataTransfer || !e.dataTransfer.types) |
| 796 return false; |
| 797 return Array.prototype.indexOf.call(e.dataTransfer.types, |
| 798 'text/uri-list') != -1; |
795 }, | 799 }, |
796 | 800 |
797 /** @inheritDoc */ | 801 /** @inheritDoc */ |
798 addDragData: function(dataTransfer, index) { | 802 addDragData: function(dataTransfer, index) { |
799 var sourceId = -1; | 803 var sourceId = -1; |
800 var currentlyDraggingTile = ntp.getCurrentlyDraggingTile(); | 804 var currentlyDraggingTile = ntp.getCurrentlyDraggingTile(); |
801 if (currentlyDraggingTile) { | 805 if (currentlyDraggingTile) { |
802 var tileContents = currentlyDraggingTile.firstChild; | 806 var tileContents = currentlyDraggingTile.firstChild; |
803 if (tileContents.classList.contains('app')) { | 807 if (tileContents.classList.contains('app')) { |
804 var originalPage = currentlyDraggingTile.tilePage; | 808 var originalPage = currentlyDraggingTile.tilePage; |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
956 app.setupNotification_(notification); | 960 app.setupNotification_(notification); |
957 } | 961 } |
958 | 962 |
959 return { | 963 return { |
960 APP_LAUNCH: APP_LAUNCH, | 964 APP_LAUNCH: APP_LAUNCH, |
961 appNotificationChanged: appNotificationChanged, | 965 appNotificationChanged: appNotificationChanged, |
962 AppsPage: AppsPage, | 966 AppsPage: AppsPage, |
963 launchAppAfterEnable: launchAppAfterEnable, | 967 launchAppAfterEnable: launchAppAfterEnable, |
964 }; | 968 }; |
965 }); | 969 }); |
OLD | NEW |