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 PageListView implementation. | 6 * @fileoverview PageListView implementation. |
7 * PageListView manages page list, dot list, switcher buttons and handles apps | 7 * PageListView manages page list, dot list, switcher buttons and handles apps |
8 * pages callbacks from backend. | 8 * pages callbacks from backend. |
9 * | 9 * |
10 * Note that you need to have AppLauncherHandler in your WebUI to use this code. | 10 * Note that you need to have AppLauncherHandler in your WebUI to use this code. |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 function stringListIsEmpty(list) { | 288 function stringListIsEmpty(list) { |
289 for (var i = 0; i < list.length; i++) { | 289 for (var i = 0; i < list.length; i++) { |
290 if (list[i]) | 290 if (list[i]) |
291 return false; | 291 return false; |
292 } | 292 } |
293 return true; | 293 return true; |
294 } | 294 } |
295 | 295 |
296 // Sort by launch index | 296 // Sort by launch index |
297 apps.sort(function(a, b) { | 297 apps.sort(function(a, b) { |
298 return a.app_launch_index - b.app_launch_index; | 298 return a.app_launch_index > b.app_launch_index; |
299 }); | 299 }); |
300 | 300 |
301 // An app to animate (in case it was just installed). | 301 // An app to animate (in case it was just installed). |
302 var highlightApp; | 302 var highlightApp; |
303 | 303 |
304 // Add the apps, creating pages as necessary | 304 // Add the apps, creating pages as necessary |
305 for (var i = 0; i < apps.length; i++) { | 305 for (var i = 0; i < apps.length; i++) { |
306 var app = apps[i]; | 306 var app = apps[i]; |
307 var pageIndex = app.page_index || 0; | 307 var pageIndex = app.page_index || 0; |
308 while (pageIndex >= this.appsPages.length) { | 308 while (pageIndex >= this.appsPages.length) { |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 this.cardSlider.selectCard(cardIndex, true); | 613 this.cardSlider.selectCard(cardIndex, true); |
614 | 614 |
615 e.stopPropagation(); | 615 e.stopPropagation(); |
616 } | 616 } |
617 }; | 617 }; |
618 | 618 |
619 return { | 619 return { |
620 PageListView: PageListView | 620 PageListView: PageListView |
621 }; | 621 }; |
622 }); | 622 }); |
OLD | NEW |