Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Unified Diff: chrome/browser/resources/ntp/apps.js

Issue 3474006: NTP: Don't show any sections or layout until we receive mv and apps. (Closed) Base URL: git://codf21.jail/chromium.git
Patch Set: Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/new_new_tab.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « chrome/browser/resources/new_new_tab.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698