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 appsSectionContent.textContent = ''; | 10 appsSectionContent.textContent = ''; |
11 appsMiniview.textContent = ''; | 11 appsMiniview.textContent = ''; |
12 | 12 |
13 if (data.apps.length == 0) { | 13 if (data.apps.length == 0) { |
14 appsSection.classList.add('disabled'); | 14 appsSection.classList.add('disabled'); |
15 setShownSections(Section.THUMB); | 15 layoutSections(); |
16 } else { | 16 } else { |
17 data.apps.forEach(function(app) { | 17 data.apps.forEach(function(app) { |
18 appsSectionContent.appendChild(apps.createElement(app)); | 18 appsSectionContent.appendChild(apps.createElement(app)); |
19 }); | 19 }); |
20 | 20 |
21 appsSectionContent.appendChild(apps.createWebStoreElement()); | 21 appsSectionContent.appendChild(apps.createWebStoreElement()); |
22 | 22 |
23 data.apps.slice(0, MAX_MINIVIEW_ITEMS).forEach(function(app) { | 23 data.apps.slice(0, MAX_MINIVIEW_ITEMS).forEach(function(app) { |
24 appsMiniview.appendChild(apps.createMiniviewElement(app)); | 24 appsMiniview.appendChild(apps.createMiniviewElement(app)); |
25 }); | 25 }); |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 | 253 |
254 createWebStoreElement: function() { | 254 createWebStoreElement: function() { |
255 return createElement({ | 255 return createElement({ |
256 'id': 'web-store-entry', | 256 'id': 'web-store-entry', |
257 'name': localStrings.getString('web_store_title'), | 257 'name': localStrings.getString('web_store_title'), |
258 'launch_url': localStrings.getString('web_store_url') | 258 'launch_url': localStrings.getString('web_store_url') |
259 }); | 259 }); |
260 } | 260 } |
261 }; | 261 }; |
262 })(); | 262 })(); |
OLD | NEW |