diff options
author | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-23 17:48:02 +0000 |
---|---|---|
committer | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-23 17:48:02 +0000 |
commit | 996d12814644592c9ab8cba13ab3611d9dabd655 (patch) | |
tree | 85b2bde6faf1b93eb70a0196cffd7d6439f5707b /chrome/browser/resources/ntp/apps.js | |
parent | 025e6129cefaa66ebc05c3a6b18834b1735b6816 (diff) | |
download | chromium_src-996d12814644592c9ab8cba13ab3611d9dabd655.zip chromium_src-996d12814644592c9ab8cba13ab3611d9dabd655.tar.gz chromium_src-996d12814644592c9ab8cba13ab3611d9dabd655.tar.bz2 |
NTP: Don't show any sections or layout until we receive mv
and apps data. This improves performance and avoids
flickeryness.
BUG=56278
TEST=Install some apps and refresh the ntp over and over.
Should not see flickering as mv section, then apps load.
Review URL: http://codereview.chromium.org/3474006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60306 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/resources/ntp/apps.js')
-rw-r--r-- | chrome/browser/resources/ntp/apps.js | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/chrome/browser/resources/ntp/apps.js b/chrome/browser/resources/ntp/apps.js index 7d30f9e..057ca6a 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; |