Index: chrome/browser/resources/ntp/apps.js |
diff --git a/chrome/browser/resources/ntp/apps.js b/chrome/browser/resources/ntp/apps.js |
index 7d30f9ec781d7ba2726ce15737f8cba5efbc6ab0..057ca6ac07a404ab3c8650505058ddda96e21b22 100644 |
--- a/chrome/browser/resources/ntp/apps.js |
+++ b/chrome/browser/resources/ntp/apps.js |
@@ -13,22 +13,27 @@ function getAppsCallback(data) { |
if (data.apps.length == 0) { |
appsSection.classList.add('disabled'); |
setShownSections(Section.THUMB); |
- return; |
- } |
+ } else { |
+ data.apps.forEach(function(app) { |
+ appsSectionContent.appendChild(apps.createElement(app)); |
+ }); |
- data.apps.forEach(function(app) { |
- appsSectionContent.appendChild(apps.createElement(app)); |
- }); |
+ appsSectionContent.appendChild(apps.createWebStoreElement()); |
- appsSectionContent.appendChild(apps.createWebStoreElement()); |
+ data.apps.slice(0, MAX_MINIVIEW_ITEMS).forEach(function(app) { |
+ appsMiniview.appendChild(apps.createMiniviewElement(app)); |
+ }); |
- data.apps.slice(0, MAX_MINIVIEW_ITEMS).forEach(function(app) { |
- appsMiniview.appendChild(apps.createMiniviewElement(app)); |
- }); |
+ appsSection.classList.remove('disabled'); |
+ } |
+ |
+ apps.loaded = true; |
+ maybeDoneLoading(); |
- appsSection.classList.remove('disabled'); |
- updateMiniviewClipping(appsMiniview); |
- layoutSections(); |
+ if (data.apps.length > 0 && isDoneLoading()) { |
+ updateMiniviewClipping(appsMiniview); |
+ layoutSections(); |
+ } |
} |
var apps = (function() { |
@@ -143,6 +148,8 @@ var apps = (function() { |
}); |
return { |
+ loaded: false, |
+ |
createElement: function(app) { |
var div = createElement(app); |
var a = div.firstChild; |