Chromium Code Reviews| 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 /** | 5 /** |
| 6 * @fileoverview New tab page | 6 * @fileoverview New tab page |
| 7 * This is the main code for the new tab page used by touch-enabled Chrome | 7 * This is the main code for the new tab page used by touch-enabled Chrome |
| 8 * browsers. For now this is still a prototype. | 8 * browsers. For now this is still a prototype. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 347 function stringListIsEmpty(list) { | 347 function stringListIsEmpty(list) { |
| 348 for (var i = 0; i < list.length; i++) { | 348 for (var i = 0; i < list.length; i++) { |
| 349 if (list[i]) | 349 if (list[i]) |
| 350 return false; | 350 return false; |
| 351 } | 351 } |
| 352 return true; | 352 return true; |
| 353 } | 353 } |
| 354 | 354 |
| 355 // Sort by launch index | 355 // Sort by launch index |
| 356 apps.sort(function(a, b) { | 356 apps.sort(function(a, b) { |
| 357 return a.app_launch_index - b.app_launch_index; | 357 return a.app_launch_index > b.app_launch_index; |
|
Dan Beam
2011/11/12 02:28:30
Hmmm, would it be better to
return +a.app_launc
csharp
2011/11/14 16:22:28
We don't want to do this because the app_launch_in
| |
| 358 }); | 358 }); |
| 359 | 359 |
| 360 // An app to animate (in case it was just installed). | 360 // An app to animate (in case it was just installed). |
| 361 var highlightApp; | 361 var highlightApp; |
| 362 | 362 |
| 363 // Add the apps, creating pages as necessary | 363 // Add the apps, creating pages as necessary |
| 364 for (var i = 0; i < apps.length; i++) { | 364 for (var i = 0; i < apps.length; i++) { |
| 365 var app = apps[i]; | 365 var app = apps[i]; |
| 366 var pageIndex = (app.page_index || 0); | 366 var pageIndex = (app.page_index || 0); |
| 367 while (pageIndex >= appsPages.length) { | 367 while (pageIndex >= appsPages.length) { |
| (...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1017 var getAppsCallback = ntp4.getAppsCallback; | 1017 var getAppsCallback = ntp4.getAppsCallback; |
| 1018 var appsPrefChangeCallback = ntp4.appsPrefChangeCallback; | 1018 var appsPrefChangeCallback = ntp4.appsPrefChangeCallback; |
| 1019 var themeChanged = ntp4.themeChanged; | 1019 var themeChanged = ntp4.themeChanged; |
| 1020 var recentlyClosedTabs = ntp4.setRecentlyClosedTabs; | 1020 var recentlyClosedTabs = ntp4.setRecentlyClosedTabs; |
| 1021 var setMostVisitedPages = ntp4.setMostVisitedPages; | 1021 var setMostVisitedPages = ntp4.setMostVisitedPages; |
| 1022 var updateLogin = ntp4.updateLogin; | 1022 var updateLogin = ntp4.updateLogin; |
| 1023 | 1023 |
| 1024 document.addEventListener('DOMContentLoaded', ntp4.initialize); | 1024 document.addEventListener('DOMContentLoaded', ntp4.initialize); |
| 1025 window.addEventListener('online', ntp4.updateOfflineEnabledApps); | 1025 window.addEventListener('online', ntp4.updateOfflineEnabledApps); |
| 1026 window.addEventListener('offline', ntp4.updateOfflineEnabledApps); | 1026 window.addEventListener('offline', ntp4.updateOfflineEnabledApps); |
| OLD | NEW |