| 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 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 | 410 |
| 411 page.resetTileRepositioningState(); | 411 page.resetTileRepositioningState(); |
| 412 return; | 412 return; |
| 413 } | 413 } |
| 414 | 414 |
| 415 var startTime = Date.now(); | 415 var startTime = Date.now(); |
| 416 | 416 |
| 417 if (page) | 417 if (page) |
| 418 page.removeAllTiles(); | 418 page.removeAllTiles(); |
| 419 | 419 |
| 420 // Get the array of apps and add any special synthesized entries | 420 // Get the array of apps and add any special synthesized entries. |
| 421 var apps = data.apps; | 421 var apps = data.apps; |
| 422 | 422 |
| 423 // Sort by launch ordinal | 423 // Sort alphabetically. |
| 424 apps.sort(function(a, b) { | 424 apps.sort(function(a, b) { |
| 425 return a.app_launch_ordinal > b.app_launch_ordinal ? 1 : | 425 return a.title.toLocaleLowerCase() > b.title.toLocaleLowerCase() ? 1 : |
| 426 a.app_launch_ordinal < b.app_launch_ordinal ? -1 : 0; | 426 a.title.toLocaleLowerCase() < b.title.toLocaleLowerCase() ? -1 : 0; |
| 427 }); | 427 }); |
| 428 | 428 |
| 429 // An app to animate (in case it was just installed). | 429 // An app to animate (in case it was just installed). |
| 430 var highlightApp; | 430 var highlightApp; |
| 431 | 431 |
| 432 // Add the apps, creating pages as necessary | 432 // Add the apps, creating pages as necessary. |
| 433 this.appendTilePage(new ntp.AppsPage(), | 433 this.appendTilePage(new ntp.AppsPage(), |
| 434 loadTimeData.getString('appDefaultPageName')); | 434 loadTimeData.getString('appDefaultPageName')); |
| 435 for (var i = 0; i < apps.length; i++) { | 435 for (var i = 0; i < apps.length; i++) { |
| 436 var app = apps[i]; | 436 var app = apps[i]; |
| 437 if (app.id == this.highlightAppId) | 437 if (app.id == this.highlightAppId) |
| 438 highlightApp = app; | 438 highlightApp = app; |
| 439 else | 439 else |
| 440 this.appsPage.insertApp(app, false); | 440 this.appsPage.insertApp(app, false); |
| 441 } | 441 } |
| 442 | 442 |
| (...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1100 setMostVisitedPages: setMostVisitedPages, | 1100 setMostVisitedPages: setMostVisitedPages, |
| 1101 setRecentlyClosedTabs: setRecentlyClosedTabs, | 1101 setRecentlyClosedTabs: setRecentlyClosedTabs, |
| 1102 showNotification: showNotification, | 1102 showNotification: showNotification, |
| 1103 themeChanged: themeChanged, | 1103 themeChanged: themeChanged, |
| 1104 }; | 1104 }; |
| 1105 }); | 1105 }); |
| 1106 | 1106 |
| 1107 document.addEventListener('DOMContentLoaded', ntp.onLoad); | 1107 document.addEventListener('DOMContentLoaded', ntp.onLoad); |
| 1108 | 1108 |
| 1109 var toCssPx = cr.ui.toCssPx; | 1109 var toCssPx = cr.ui.toCssPx; |
| OLD | NEW |