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

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

Issue 9358031: Added new adaptive "Suggest" tab on the New Tab Page, behing the flag, for the experiments. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adressed the comments. Created 8 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 1d56e50e0b4068beb4695eef49adabc31b1d0f2a..b1d193687c561d902201c7be0aa63d79f62d5398 100644
--- a/chrome/browser/resources/ntp4/page_list_view.js
+++ b/chrome/browser/resources/ntp4/page_list_view.js
@@ -59,6 +59,12 @@ cr.define('ntp4', function() {
appsPages: undefined,
/**
+ * The Suggestions page.
+ * @type {!Element|undefined}
+ */
+ suggestionsPage: undefined,
+
+ /**
* The Most Visited page.
* @type {!Element|undefined}
*/
@@ -212,6 +218,11 @@ cr.define('ntp4', function() {
this.mostVisitedPage = page;
}
+ if (typeof ntp4.SuggestionsPage != 'undefined' &&
+ page instanceof ntp4.SuggestionsPage) {
+ this.suggestionsPage = page;
+ }
+
// If we're appending an AppsPage and it's a temporary page, animate it.
var animate = page instanceof ntp4.AppsPage &&
page.classList.contains('temporary');
@@ -416,6 +427,10 @@ cr.define('ntp4', function() {
if (this.mostVisitedPage)
this.cardSlider.selectCardByValue(this.mostVisitedPage);
break;
+ case templateData['suggested_page_id']:
+ if (this.suggestionsPage)
+ this.cardSlider.selectCardByValue(this.suggestionsPage);
+ break;
}
},
@@ -530,6 +545,9 @@ cr.define('ntp4', function() {
} else if (page.classList.contains('most-visited-page')) {
this.shownPage = templateData.most_visited_page_id;
this.shownPageIndex = 0;
+ } else if (page.classList.contains('suggested-page')) {
+ this.shownPage = templateData.suggested_page_id;
+ this.shownPageIndex = 0;
} else {
console.error('unknown page selected');
}

Powered by Google App Engine
This is Rietveld 408576698