| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 function getAppsCallback(data) { | 5 function getAppsCallback(data) { |
| 6 logEvent('received apps'); | 6 logEvent('received apps'); |
| 7 var appsSection = $('apps'); | 7 var appsSection = $('apps'); |
| 8 var appsSectionContent = $('apps-maxiview'); | 8 var appsSectionContent = $('apps-maxiview'); |
| 9 var appsMiniview = appsSection.getElementsByClassName('miniview')[0]; | 9 var appsMiniview = appsSection.getElementsByClassName('miniview')[0]; |
| 10 var appsPromo = $('apps-promo'); | 10 var appsPromo = $('apps-promo'); |
| 11 | 11 |
| 12 appsMiniview.textContent = ''; | 12 appsMiniview.textContent = ''; |
| 13 while (appsSectionContent.lastChild != appsPromo) { | 13 while (appsSectionContent.lastChild != appsPromo) { |
| 14 appsSectionContent.removeChild(appsSectionContent.lastChild); | 14 appsSectionContent.removeChild(appsSectionContent.lastChild); |
| 15 } | 15 } |
| 16 | 16 |
| 17 data.apps.sort(function(a,b) { | 17 data.apps.sort(function(a,b) { |
| 18 return a.app_launch_index - b.app_launch_index | 18 return a.app_launch_index - b.app_launch_index |
| 19 }); | 19 }); |
| 20 | 20 |
| 21 clearClosedMenu(apps.menu); | 21 clearClosedMenu(apps.menu); |
| 22 if (data.apps.length == 0) { | 22 if (data.apps.length == 0 && !data.showLauncher) { |
| 23 appsSection.classList.add('disabled'); | 23 appsSection.classList.add('disabled'); |
| 24 layoutSections(); | 24 layoutSections(); |
| 25 } else { | 25 } else { |
| 26 data.apps.forEach(function(app) { | 26 data.apps.forEach(function(app) { |
| 27 appsSectionContent.appendChild(apps.createElement(app)); | 27 appsSectionContent.appendChild(apps.createElement(app)); |
| 28 }); | 28 }); |
| 29 | 29 |
| 30 appsSectionContent.appendChild(apps.createWebStoreElement()); | 30 appsSectionContent.appendChild(apps.createWebStoreElement()); |
| 31 | 31 |
| 32 data.apps.slice(0, MAX_MINIVIEW_ITEMS).forEach(function(app) { | 32 data.apps.slice(0, MAX_MINIVIEW_ITEMS).forEach(function(app) { |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 var elm = createElement({ | 290 var elm = createElement({ |
| 291 'id': 'web-store-entry', | 291 'id': 'web-store-entry', |
| 292 'name': localStrings.getString('web_store_title'), | 292 'name': localStrings.getString('web_store_title'), |
| 293 'launch_url': localStrings.getString('web_store_url') | 293 'launch_url': localStrings.getString('web_store_url') |
| 294 }); | 294 }); |
| 295 elm.setAttribute('app-id', 'web-store-entry'); | 295 elm.setAttribute('app-id', 'web-store-entry'); |
| 296 return elm; | 296 return elm; |
| 297 } | 297 } |
| 298 }; | 298 }; |
| 299 })(); | 299 })(); |
| OLD | NEW |