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

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

Issue 1151563005: Revert of NTP Zombie Code Slayer Part IV: Most Visited (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
OLDNEW
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 APP_LAUNCH = { 8 var APP_LAUNCH = {
9 // The histogram buckets (keep in sync with extension_constants.h). 9 // The histogram buckets (keep in sync with extension_constants.h).
10 NTP_APPS_MAXIMIZED: 0, 10 NTP_APPS_MAXIMIZED: 0,
11 NTP_APPS_COLLAPSED: 1, 11 NTP_APPS_COLLAPSED: 1,
12 NTP_APPS_MENU: 2, 12 NTP_APPS_MENU: 2,
13 NTP_MOST_VISITED: 3, 13 NTP_MOST_VISITED: 3,
14 NTP_APP_RE_ENABLE: 16, 14 NTP_APP_RE_ENABLE: 16,
15 NTP_WEBSTORE_FOOTER: 18, 15 NTP_WEBSTORE_FOOTER: 18,
16 NTP_WEBSTORE_PLUS_ICON: 19, 16 NTP_WEBSTORE_PLUS_ICON: 19,
17 }; 17 };
18 18
19 // Histogram buckets for UMA tracking of where a DnD drop came from. 19 // Histogram buckets for UMA tracking of where a DnD drop came from.
20 var DRAG_SOURCE = { 20 var DRAG_SOURCE = {
21 SAME_APPS_PANE: 0, 21 SAME_APPS_PANE: 0,
22 OTHER_APPS_PANE: 1, 22 OTHER_APPS_PANE: 1,
23 MOST_VISITED_PANE: 2, // Deprecated. 23 MOST_VISITED_PANE: 2,
24 BOOKMARKS_PANE: 3, // Deprecated. 24 BOOKMARKS_PANE: 3,
25 OUTSIDE_NTP: 4 25 OUTSIDE_NTP: 4
26 }; 26 };
27 var DRAG_SOURCE_LIMIT = DRAG_SOURCE.OUTSIDE_NTP + 1; 27 var DRAG_SOURCE_LIMIT = DRAG_SOURCE.OUTSIDE_NTP + 1;
28 28
29 /** 29 /**
30 * App context menu. The class is designed to be used as a singleton with 30 * App context menu. The class is designed to be used as a singleton with
31 * the app that is currently showing a context menu stored in this.app_. 31 * the app that is currently showing a context menu stored in this.app_.
32 * @constructor 32 * @constructor
33 */ 33 */
34 function AppContextMenu() { 34 function AppContextMenu() {
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 var samePageDrag = originalPage == this; 676 var samePageDrag = originalPage == this;
677 sourceId = samePageDrag ? DRAG_SOURCE.SAME_APPS_PANE : 677 sourceId = samePageDrag ? DRAG_SOURCE.SAME_APPS_PANE :
678 DRAG_SOURCE.OTHER_APPS_PANE; 678 DRAG_SOURCE.OTHER_APPS_PANE;
679 this.tileGrid_.insertBefore(currentlyDraggingTile, 679 this.tileGrid_.insertBefore(currentlyDraggingTile,
680 this.tileElements_[index]); 680 this.tileElements_[index]);
681 this.tileMoved(currentlyDraggingTile); 681 this.tileMoved(currentlyDraggingTile);
682 if (!samePageDrag) { 682 if (!samePageDrag) {
683 originalPage.fireRemovedEvent(currentlyDraggingTile, index, true); 683 originalPage.fireRemovedEvent(currentlyDraggingTile, index, true);
684 this.fireAddedEvent(currentlyDraggingTile, index, true); 684 this.fireAddedEvent(currentlyDraggingTile, index, true);
685 } 685 }
686 } else if (currentlyDraggingTile.querySelector('.most-visited')) {
687 this.generateAppForLink(tileContents.data);
688 sourceId = DRAG_SOURCE.MOST_VISITED_PANE;
686 } 689 }
687 } else { 690 } else {
688 this.addOutsideData_(dataTransfer); 691 this.addOutsideData_(dataTransfer);
689 sourceId = DRAG_SOURCE.OUTSIDE_NTP; 692 sourceId = DRAG_SOURCE.OUTSIDE_NTP;
690 } 693 }
691 694
692 assert(sourceId != -1); 695 assert(sourceId != -1);
693 chrome.send('metricsHandler:recordInHistogram', 696 chrome.send('metricsHandler:recordInHistogram',
694 ['NewTabPage.AppsPageDragSource', sourceId, DRAG_SOURCE_LIMIT]); 697 ['NewTabPage.AppsPageDragSource', sourceId, DRAG_SOURCE_LIMIT]);
695 }, 698 },
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 function launchAppAfterEnable(appId) { 778 function launchAppAfterEnable(appId) {
776 chrome.send('launchApp', [appId, APP_LAUNCH.NTP_APP_RE_ENABLE]); 779 chrome.send('launchApp', [appId, APP_LAUNCH.NTP_APP_RE_ENABLE]);
777 } 780 }
778 781
779 return { 782 return {
780 APP_LAUNCH: APP_LAUNCH, 783 APP_LAUNCH: APP_LAUNCH,
781 AppsPage: AppsPage, 784 AppsPage: AppsPage,
782 launchAppAfterEnable: launchAppAfterEnable, 785 launchAppAfterEnable: launchAppAfterEnable,
783 }; 786 };
784 }); 787 });
OLDNEW
« no previous file with comments | « chrome/browser/history/top_sites_factory.cc ('k') | chrome/browser/resources/ntp4/compiled_resources.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698