diff options
author | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-14 20:14:12 +0000 |
---|---|---|
committer | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-14 20:14:12 +0000 |
commit | cefe5c46afeb6e48e15a396435ca13274406004d (patch) | |
tree | d851d2b162561286fb86308415648ee6eee44984 /chrome/browser/resources/ntp/apps.js | |
parent | 9ef20a191ca73d574ac9f9d5208e8de814622aa7 (diff) | |
download | chromium_src-cefe5c46afeb6e48e15a396435ca13274406004d.zip chromium_src-cefe5c46afeb6e48e15a396435ca13274406004d.tar.gz chromium_src-cefe5c46afeb6e48e15a396435ca13274406004d.tar.bz2 |
Default apps promo was getting expired early if NTP open.
This was a timing issue: we had a pref change observer that was
triggering refresh of NTP. Inside this refresh, we checked the
promo status. But setting up the pref tree of an extension
during installation was also triggering this listener.
BUG=64736
TEST=See bug
Review URL: http://codereview.chromium.org/5750005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69164 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/resources/ntp/apps.js')
-rw-r--r-- | chrome/browser/resources/ntp/apps.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/chrome/browser/resources/ntp/apps.js b/chrome/browser/resources/ntp/apps.js index 9c032fe..41a5ebf 100644 --- a/chrome/browser/resources/ntp/apps.js +++ b/chrome/browser/resources/ntp/apps.js @@ -14,11 +14,17 @@ var PING_WEBSTORE_LAUNCH_PREFIX = 'record-webstore-launch'; function getAppsCallback(data) { logEvent('received apps'); + + // In the case of prefchange-triggered updates, we don't receive this flag. + // Just leave it set as it was before in that case. + if ('showPromo' in data) + apps.showPromo = data.showPromo; + var appsSection = $('apps'); var appsSectionContent = $('apps-content'); var appsMiniview = appsSection.getElementsByClassName('miniview')[0]; var appsPromo = $('apps-promo'); - var appsPromoPing = PING_WEBSTORE_LAUNCH_PREFIX + '+' + data.showPromo; + var appsPromoPing = PING_WEBSTORE_LAUNCH_PREFIX + '+' + apps.showPromo; var webStoreEntry; // Hide menu options that are not supported on the OS or windowing system. @@ -34,8 +40,6 @@ function getAppsCallback(data) { appsMiniview.textContent = ''; appsSectionContent.textContent = ''; - apps.showPromo = data.showPromo; - data.apps.sort(function(a,b) { return a.app_launch_index - b.app_launch_index; }); @@ -65,7 +69,7 @@ function getAppsCallback(data) { addClosedMenuFooter(apps.menu, 'apps', MINIMIZED_APPS, Section.APPS); apps.loaded = true; - if (data.showPromo) + if (apps.showPromo) document.documentElement.classList.add('apps-promo-visible'); else document.documentElement.classList.remove('apps-promo-visible'); @@ -73,7 +77,7 @@ function getAppsCallback(data) { maybeDoneLoading(); if (data.apps.length > 0 && isDoneLoading()) { - if (!data.showPromo && data.apps.length >= MAX_APPS_PER_ROW[layoutMode]) + if (!apps.showPromo && data.apps.length >= MAX_APPS_PER_ROW[layoutMode]) webStoreEntry.classList.add('loner'); else webStoreEntry.classList.remove('loner'); |