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

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

Issue 1757673002: NTP4/apps page: fix page stickiness (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove-promo-cpp
Patch Set: Created 4 years, 10 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 69027b966ae8823173ef19802ce4de8d87f52f37..8b6769fb24966c0aa97e70ee2756e75d0fd93f48 100644
--- a/chrome/browser/resources/ntp4/page_list_view.js
+++ b/chrome/browser/resources/ntp4/page_list_view.js
@@ -108,14 +108,8 @@ cr.define('ntp', function() {
trash: undefined,
/**
- * The type of page that is currently shown. The value is a numerical ID.
- * @type {number}
- */
- shownPage: 0,
-
- /**
- * The index of the page that is currently shown, within the page type.
- * For example if the third Apps page is showing, this will be 2.
+ * The index of the page that is currently shown. For example if the third
+ * page is showing, this will be 2.
* @type {number}
*/
shownPageIndex: 0,
@@ -166,7 +160,6 @@ cr.define('ntp', function() {
if (this.pageSwitcherEnd)
ntp.initializePageSwitcher(this.pageSwitcherEnd);
- this.shownPage = loadTimeData.getInteger('shown_page_type');
this.shownPageIndex = loadTimeData.getInteger('shown_page_index');
// TODO(dbeam): remove showApps and everything that says if (apps).
Dan Beam 2016/03/03 21:09:41 ^
@@ -450,8 +443,7 @@ cr.define('ntp', function() {
app.replaceAppData(appData);
} else if (opt_highlight) {
page.insertAndHighlightApp(appData);
- this.setShownPage_(loadTimeData.getInteger('apps_page_id'),
- appData.page_index);
+ this.setShownPage_(appData.page_index);
} else {
page.insertApp(appData, false);
}
@@ -488,11 +480,11 @@ cr.define('ntp', function() {
/**
* Updates the hidden state of the app launcher promo based on the page
* shown and load data content.
+ * @private
*/
updateAppLauncherPromoHiddenState_: function() {
$('app-launcher-promo').hidden =
- !loadTimeData.getBoolean('showAppLauncherPromo') ||
- this.shownPage != loadTimeData.getInteger('apps_page_id');
+ !loadTimeData.getBoolean('showAppLauncherPromo');
},
/**
@@ -504,8 +496,7 @@ cr.define('ntp', function() {
this.tilePages.length - 1));
this.cardSlider.setCards(Array.prototype.slice.call(this.tilePages),
pageNo);
- if (this.shownPage == loadTimeData.getInteger('apps_page_id') &&
- loadTimeData.getBoolean('showApps')) {
+ if (loadTimeData.getBoolean('showApps')) {
Dan Beam 2016/03/02 00:02:53 yeah, I know, this is probably never false...
Evan Stade 2016/03/03 19:59:53 todo?
Dan Beam 2016/03/03 21:09:41 Done. (previously)
this.cardSlider.selectCardByValue(
this.appsPages[Math.min(this.shownPageIndex,
this.appsPages.length - 1)]);
@@ -632,12 +623,10 @@ cr.define('ntp', function() {
// Don't change shownPage until startup is done (and page changes actually
// reflect user actions).
if (!this.isStartingUp_()) {
- if (page.classList.contains('apps-page')) {
- this.setShownPage_(loadTimeData.getInteger('apps_page_id'),
- this.getAppsPageIndex(page));
- } else {
+ if (page.classList.contains('apps-page'))
Dan Beam 2016/03/02 00:02:53 and this is probably never false either...
Evan Stade 2016/03/03 19:59:53 todo
Dan Beam 2016/03/03 21:09:41 Done.
+ this.setShownPage_(this.getAppsPageIndex(page));
+ else
console.error('unknown page selected');
- }
}
// Update the active dot
@@ -650,15 +639,13 @@ cr.define('ntp', function() {
/**
* Saves/updates the newly selected page to open when first loading the NTP.
- * @param {number} shownPage The new shown page type.
* @param {number} shownPageIndex The new shown page index.
* @private
*/
- setShownPage_: function(shownPage, shownPageIndex) {
+ setShownPage_: function(shownPageIndex) {
assert(shownPageIndex >= 0);
- this.shownPage = shownPage;
this.shownPageIndex = shownPageIndex;
- chrome.send('pageSelected', [this.shownPage, this.shownPageIndex]);
+ chrome.send('pageSelected', [this.shownPageIndex]);
this.updateAppLauncherPromoHiddenState_();
},
« no previous file with comments | « no previous file | chrome/browser/ui/webui/ntp/app_launcher_handler.h » ('j') | chrome/browser/ui/webui/ntp/app_launcher_handler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698