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

Unified Diff: chrome/browser/resources/ntp4/page_list_view.js

Issue 12985002: Add a new App launcher promo to the apps page / NTP. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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
Index: chrome/browser/resources/ntp4/page_list_view.js
diff --git a/chrome/browser/resources/ntp4/page_list_view.js b/chrome/browser/resources/ntp4/page_list_view.js
index 8fd59409b26dc5240ede0e66b27fc3daaff9f487..5c8a7bade0ee0c3de01f88535771bb873f5b7ce5 100644
--- a/chrome/browser/resources/ntp4/page_list_view.js
+++ b/chrome/browser/resources/ntp4/page_list_view.js
@@ -412,6 +412,9 @@ cr.define('ntp', function() {
this.appsLoaded_ = true;
cr.dispatchSimpleEvent(document, 'sectionready', true, true);
}
+ $('app-launcher-promo').hidden =
+ !loadTimeData.getBoolean('showAppLauncherPromo') ||
+ this.shownPage != loadTimeData.getInteger('apps_page_id');
},
/**
@@ -475,6 +478,15 @@ cr.define('ntp', function() {
},
/**
+ * Callback invoked by chrome whenever the app launcher promo pref changes.
+ * @param {bool} show Identifies if we should show or hide the promo.
Dan Beam 2013/03/21 15:45:14 {boolean}
MAD 2013/03/21 16:47:47 Done.
+ */
+ appLauncherPromoPrefChangeCallback: function(show) {
+ $('app-launcher-promo').hidden = !show;
+ loadTimeData.overrideValues({'showAppLauncherPromo': show});
Dan Beam 2013/03/21 15:45:14 nit: loadTimeData.overrideValues({showAppLauncherP
MAD 2013/03/21 16:47:47 Done.
+ },
+
+ /**
* Invoked whenever the pages in apps-page-list have changed so that
* the Slider knows about the new elements.
*/
@@ -490,12 +502,22 @@ cr.define('ntp', function() {
this.appsPages.length - 1)]);
break;
case loadTimeData.getInteger('most_visited_page_id'):
- if (this.mostVisitedPage)
+ if (this.mostVisitedPage) {
this.cardSlider.selectCardByValue(this.mostVisitedPage);
+ } else if (loadTimeData.getBoolean('showApps')) {
+ // If we don't have a most visited page, we are likely on the
+ // chrome://apps page, so set it appropriately so that we can
+ // display the app launcher promo.
+ this.shownPage = loadTimeData.getInteger('apps_page_id');
Dan Beam 2013/03/21 15:45:14 ^ er, shouldn't you be selectCardByValue()'ing her
MAD 2013/03/21 16:47:47 Yeah, I wasn't sure... Things seems to work anyway
+ }
break;
case loadTimeData.getInteger('suggestions_page_id'):
if (this.suggestionsPage)
this.cardSlider.selectCardByValue(this.suggestionsPage);
+ else if (this.mostVisitedPage)
+ this.shownPage = loadTimeData.getInteger('most_visited_page_id');
+ else if (loadTimeData.getBoolean('showApps'))
+ this.shownPage = loadTimeData.getInteger('apps_page_id');
break;
}
},
@@ -651,6 +673,9 @@ cr.define('ntp', function() {
this.shownPage = shownPage;
this.shownPageIndex = shownPageIndex;
chrome.send('pageSelected', [this.shownPage, this.shownPageIndex]);
+ $('app-launcher-promo').hidden =
+ !loadTimeData.getBoolean('showAppLauncherPromo') ||
+ this.shownPage != loadTimeData.getInteger('apps_page_id');
Dan Beam 2013/03/21 15:45:14 please combine this and the same code above into a
MAD 2013/03/21 16:47:47 Done. And it made me realize that if we would chan
},
/**

Powered by Google App Engine
This is Rietveld 408576698