summaryrefslogtreecommitdiff
path: root/chromium/chrome/browser/resources/ntp4/new_tab.js
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/chrome/browser/resources/ntp4/new_tab.js')
-rw-r--r--chromium/chrome/browser/resources/ntp4/new_tab.js72
1 files changed, 15 insertions, 57 deletions
diff --git a/chromium/chrome/browser/resources/ntp4/new_tab.js b/chromium/chrome/browser/resources/ntp4/new_tab.js
index e77f4e8a0e9..4c1ac76f31e 100644
--- a/chromium/chrome/browser/resources/ntp4/new_tab.js
+++ b/chromium/chrome/browser/resources/ntp4/new_tab.js
@@ -137,8 +137,6 @@ cr.define('ntp', function() {
function() { chrome.send('onLearnMore'); });
}
}
- if (loadTimeData.getBoolean('isDiscoveryInNTPEnabled'))
- sectionsToWaitFor++;
measureNavDots();
// Load the current theme colors.
@@ -150,14 +148,6 @@ cr.define('ntp', function() {
notificationContainer.addEventListener(
'webkitTransitionEnd', onNotificationTransitionEnd);
- if (loadTimeData.getBoolean('showRecentlyClosed')) {
- cr.ui.decorate(getRequiredElement('recently-closed-menu-button'),
- ntp.RecentMenuButton);
- chrome.send('getRecentlyClosedTabs');
- } else {
- $('recently-closed-menu-button').hidden = true;
- }
-
if (loadTimeData.getBoolean('showOtherSessionsMenu')) {
otherSessionsButton = /** @type {!ntp.OtherSessionsMenuButton} */(
getRequiredElement('other-sessions-menu-button'));
@@ -179,21 +169,6 @@ cr.define('ntp', function() {
chrome.send('getMostVisited');
}
- if (loadTimeData.getBoolean('isDiscoveryInNTPEnabled')) {
- var suggestionsScript = document.createElement('script');
- suggestionsScript.src = 'suggestions_page.js';
- suggestionsScript.onload = function() {
- newTabView.appendTilePage(new ntp.SuggestionsPage(),
- loadTimeData.getString('suggestions'),
- false,
- (newTabView.appsPages.length > 0) ?
- newTabView.appsPages[0] : null);
- chrome.send('getSuggestions');
- cr.dispatchSimpleEvent(document, 'sectionready', true, true);
- };
- document.querySelector('head').appendChild(suggestionsScript);
- }
-
if (!loadTimeData.getBoolean('showWebStoreIcon')) {
var webStoreIcon = $('chrome-web-store-link');
// Not all versions of the NTP have a footer, so this may not exist.
@@ -257,8 +232,7 @@ cr.define('ntp', function() {
chrome.send('bubblePromoViewed');
}
- var loginContainer = getRequiredElement('login-container');
- loginContainer.addEventListener('click', showSyncLoginUI);
+ $('login-container').addEventListener('click', showSyncLoginUI);
if (loadTimeData.getBoolean('shouldShowSyncLogin'))
chrome.send('initializeSyncLogin');
@@ -298,8 +272,6 @@ cr.define('ntp', function() {
startTime = Date.now();
});
-
- cr.ui.FocusManager.disableMouseFocusOnButtons();
}
/**
@@ -440,7 +412,7 @@ cr.define('ntp', function() {
* Shows the notification bubble.
* @param {string|Node} message The notification message or node to use as
* message.
- * @param {Array.<{text: string, action: function()}>} links An array of
+ * @param {Array<{text: string, action: function()}>} links An array of
* records describing the links in the notification. Each record should
* have a 'text' attribute (the display string) and an 'action' attribute
* (a function to run when the link is activated).
@@ -549,13 +521,8 @@ cr.define('ntp', function() {
notificationContainer.hidden = true;
}
- function setRecentlyClosedTabs(dataItems) {
- $('recently-closed-menu-button').dataItems = dataItems;
- layoutFooter();
- }
-
/**
- * @param {Array.<PageData>} data
+ * @param {Array<PageData>} data
* @param {boolean} hasBlacklistedUrls
*/
function setMostVisitedPages(data, hasBlacklistedUrls) {
@@ -563,10 +530,6 @@ cr.define('ntp', function() {
cr.dispatchSimpleEvent(document, 'sectionready', true, true);
}
- function setSuggestionsPages(data, hasBlacklistedUrls) {
- newTabView.suggestionsPage.data = data;
- }
-
/**
* Set the dominant color for a node. This will be called in response to
* getFaviconDominantColor. The node represented by |id| better have a setter
@@ -590,24 +553,21 @@ cr.define('ntp', function() {
* @param {boolean} isUserSignedIn Indicates if the user is signed in or not.
*/
function updateLogin(loginHeader, loginSubHeader, iconURL, isUserSignedIn) {
- if (loginHeader || loginSubHeader) {
- $('login-container').hidden = false;
+ /** @const */ var showLogin = loginHeader || loginSubHeader;
+
+ $('login-container').hidden = !showLogin;
+ $('card-slider-frame').classList.toggle('showing-login-area', !!showLogin);
+
+ if (showLogin) {
+ // TODO(dbeam): we should use .textContent instead to mitigate XSS.
$('login-status-header').innerHTML = loginHeader;
$('login-status-sub-header').innerHTML = loginSubHeader;
- $('card-slider-frame').classList.add('showing-login-area');
-
- if (iconURL) {
- $('login-status-header-container').style.backgroundImage = url(iconURL);
- $('login-status-header-container').classList.add('login-status-icon');
- } else {
- $('login-status-header-container').style.backgroundImage = 'none';
- $('login-status-header-container').classList.remove(
- 'login-status-icon');
- }
- } else {
- $('login-container').hidden = true;
- $('card-slider-frame').classList.remove('showing-login-area');
+
+ var headerContainer = $('login-status-header-container');
+ headerContainer.classList.toggle('login-status-icon', !!iconURL);
+ headerContainer.style.backgroundImage = iconURL ? url(iconURL) : 'none';
}
+
if (shouldShowLoginBubble) {
window.setTimeout(loginBubble.show.bind(loginBubble), 0);
chrome.send('loginMessageSeen');
@@ -778,8 +738,6 @@ cr.define('ntp', function() {
setBookmarkBarAttached: setBookmarkBarAttached,
setForeignSessions: setForeignSessions,
setMostVisitedPages: setMostVisitedPages,
- setSuggestionsPages: setSuggestionsPages,
- setRecentlyClosedTabs: setRecentlyClosedTabs,
setFaviconDominantColor: setFaviconDominantColor,
showNotification: showNotification,
themeChanged: themeChanged,