Chromium Code Reviews| 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
|
| }, |
| /** |