Chromium Code Reviews

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

Issue 5750005: Default apps promo was getting expired early if NTP open. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « chrome/browser/extensions/default_apps_unittest.cc ('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 9c032fef03dfb2113aa8e71b009145790ab196bf..41a5ebf0d81cf18145c470d15d61b4fe6ae7fba0 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');
« no previous file with comments | « chrome/browser/extensions/default_apps_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine