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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 var pageNames = data.appPageNames; | 272 var pageNames = data.appPageNames; |
273 | 273 |
274 function stringListIsEmpty(list) { | 274 function stringListIsEmpty(list) { |
275 for (var i = 0; i < list.length; i++) { | 275 for (var i = 0; i < list.length; i++) { |
276 if (list[i]) | 276 if (list[i]) |
277 return false; | 277 return false; |
278 } | 278 } |
279 return true; | 279 return true; |
280 } | 280 } |
281 | 281 |
282 // Sort by launch ordinal | 282 // Sort by launch index |
283 apps.sort(function(a, b) { | 283 apps.sort(function(a, b) { |
284 return a.app_launch_ordinal > b.app_launch_ordinal; | 284 return a.app_launch_index - b.app_launch_index; |
285 }); | 285 }); |
286 | 286 |
287 // An app to animate (in case it was just installed). | 287 // An app to animate (in case it was just installed). |
288 var highlightApp; | 288 var highlightApp; |
289 | 289 |
290 // Add the apps, creating pages as necessary | 290 // Add the apps, creating pages as necessary |
291 for (var i = 0; i < apps.length; i++) { | 291 for (var i = 0; i < apps.length; i++) { |
292 var app = apps[i]; | 292 var app = apps[i]; |
293 var pageIndex = app.page_index || 0; | 293 var pageIndex = app.page_index || 0; |
294 while (pageIndex >= this.appsPages.length) { | 294 while (pageIndex >= this.appsPages.length) { |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 this.cardSlider.selectCard(cardIndex, true); | 587 this.cardSlider.selectCard(cardIndex, true); |
588 | 588 |
589 e.stopPropagation(); | 589 e.stopPropagation(); |
590 } | 590 } |
591 }; | 591 }; |
592 | 592 |
593 return { | 593 return { |
594 PageListView: PageListView | 594 PageListView: PageListView |
595 }; | 595 }; |
596 }); | 596 }); |
OLD | NEW |