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 /** | 5 /** |
6 * @fileoverview New tab page | 6 * @fileoverview New tab page |
7 * This is the main code for the new tab page. NewTabView manages page list, | 7 * This is the main code for the new tab page. NewTabView manages page list, |
8 * dot list and handles apps pages callbacks from backend. It also handles | 8 * dot list and handles apps pages callbacks from backend. It also handles |
9 * the layout of the Bottom Panel and the global UI states of the New Tab Page. | 9 * the layout of the Bottom Panel and the global UI states of the New Tab Page. |
10 */ | 10 */ |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 var startTime = Date.now(); | 407 var startTime = Date.now(); |
408 | 408 |
409 if (page) | 409 if (page) |
410 page.removeAllTiles(); | 410 page.removeAllTiles(); |
411 | 411 |
412 // Get the array of apps and add any special synthesized entries | 412 // Get the array of apps and add any special synthesized entries |
413 var apps = data.apps; | 413 var apps = data.apps; |
414 | 414 |
415 // Sort by launch ordinal | 415 // Sort by launch ordinal |
416 apps.sort(function(a, b) { | 416 apps.sort(function(a, b) { |
417 return a.app_launch_ordinal > b.app_launch_ordinal ? 1 : | 417 return a.title.toLocaleLowerCase() > b.title.toLocaleLowerCase() ? 1 : |
418 a.app_launch_ordinal < b.app_launch_ordinal ? -1 : 0; | 418 a.title.toLocaleLowerCase() < b.title.toLocaleLowerCase() ? -1 : 0; |
419 }); | 419 }); |
420 | 420 |
421 // An app to animate (in case it was just installed). | 421 // An app to animate (in case it was just installed). |
422 var highlightApp; | 422 var highlightApp; |
423 | 423 |
424 // Add the apps, creating pages as necessary | 424 // Add the apps, creating pages as necessary |
425 this.appendTilePage(new ntp.AppsPage(), | 425 this.appendTilePage(new ntp.AppsPage(), |
426 loadTimeData.getString('appDefaultPageName')); | 426 loadTimeData.getString('appDefaultPageName')); |
427 for (var i = 0; i < apps.length; i++) { | 427 for (var i = 0; i < apps.length; i++) { |
428 var app = apps[i]; | 428 var app = apps[i]; |
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1059 setMostVisitedPages: setMostVisitedPages, | 1059 setMostVisitedPages: setMostVisitedPages, |
1060 setRecentlyClosedTabs: setRecentlyClosedTabs, | 1060 setRecentlyClosedTabs: setRecentlyClosedTabs, |
1061 showNotification: showNotification, | 1061 showNotification: showNotification, |
1062 themeChanged: themeChanged, | 1062 themeChanged: themeChanged, |
1063 }; | 1063 }; |
1064 }); | 1064 }); |
1065 | 1065 |
1066 document.addEventListener('DOMContentLoaded', ntp.onLoad); | 1066 document.addEventListener('DOMContentLoaded', ntp.onLoad); |
1067 | 1067 |
1068 var toCssPx = cr.ui.toCssPx; | 1068 var toCssPx = cr.ui.toCssPx; |
OLD | NEW |