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

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

Issue 9838064: Add a sign-in promo message to the Other Devices menu. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix copyright header. Created 8 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
« no previous file with comments | « chrome/browser/resources/ntp4/new_tab.html ('k') | chrome/browser/resources/ntp4/other_sessions.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/ntp4/new_tab.js
diff --git a/chrome/browser/resources/ntp4/new_tab.js b/chrome/browser/resources/ntp4/new_tab.js
index 6d938b01875a2f41dee8968175ce81bfd708d9ec..c43484431c31cbf94abc6a0c36e2f0fd249dd901 100644
--- a/chrome/browser/resources/ntp4/new_tab.js
+++ b/chrome/browser/resources/ntp4/new_tab.js
@@ -53,6 +53,12 @@ cr.define('ntp', function() {
var shouldShowLoginBubble = false;
/**
+ * The 'other-sessions-menu-button' element.
+ * @type {!Element|undefined}
+ */
+ var otherSessionsButton;
+
+ /**
* The time in milliseconds for most transitions. This should match what's
* in new_tab.css. Unfortunately there's no better way to try to time
* something to occur until after a transition has completed.
@@ -113,8 +119,9 @@ cr.define('ntp', function() {
chrome.send('getRecentlyClosedTabs');
if (templateData.showOtherSessionsMenu) {
- cr.ui.decorate($('other-sessions-menu-button'),
- ntp.OtherSessionsMenuButton);
+ otherSessionsButton = getRequiredElement('other-sessions-menu-button');
+ cr.ui.decorate(otherSessionsButton, ntp.OtherSessionsMenuButton);
+ otherSessionsButton.initialize(templateData.isUserSignedIn);
}
var mostVisited = new ntp.MostVisitedPage();
@@ -199,11 +206,7 @@ cr.define('ntp', function() {
}
var loginContainer = getRequiredElement('login-container');
- loginContainer.addEventListener('click', function() {
- var rect = loginContainer.getBoundingClientRect();
- chrome.send('showSyncLoginUI',
- [rect.left, rect.top, rect.width, rect.height]);
- });
+ loginContainer.addEventListener('click', showSyncLoginUI);
chrome.send('initializeSyncLogin');
doWhenAllSectionsReady(function() {
@@ -495,8 +498,9 @@ cr.define('ntp', function() {
* @param {string} loginSubHeader The second line of text.
* @param {string} iconURL The url for the login status icon. If this is null
then the login status icon is hidden.
+ * @param {boolean} isUserSignedIn Indicates if the user is signed in or not.
*/
- function updateLogin(loginHeader, loginSubHeader, iconURL) {
+ function updateLogin(loginHeader, loginSubHeader, iconURL, isUserSignedIn) {
if (loginHeader || loginSubHeader) {
$('login-container').hidden = false;
$('login-status-header').innerHTML = loginHeader;
@@ -522,6 +526,18 @@ cr.define('ntp', function() {
} else if (loginBubble) {
loginBubble.reposition();
}
+ if (otherSessionsButton)
+ otherSessionsButton.updateSignInState(isUserSignedIn);
+ }
+
+ /**
+ * Show the sync login UI.
+ * @param {Event} e The click event.
+ */
+ function showSyncLoginUI(e) {
+ var rect = e.currentTarget.getBoundingClientRect();
+ chrome.send('showSyncLoginUI',
+ [rect.left, rect.top, rect.width, rect.height]);
}
/**
@@ -551,8 +567,9 @@ cr.define('ntp', function() {
return newTabView.enterRearrangeMode.apply(newTabView, arguments);
}
- function foreignSessions(sessionList) {
- $('other-sessions-menu-button').sessions = sessionList;
+ function setForeignSessions(sessionList, isTabSyncEnabled) {
+ if (otherSessionsButton)
+ otherSessionsButton.setForeignSessions(sessionList, isTabSyncEnabled);
}
function getAppsCallback() {
@@ -586,7 +603,6 @@ cr.define('ntp', function() {
appRemoved: appRemoved,
appsPrefChangeCallback: appsPrefChangeCallback,
enterRearrangeMode: enterRearrangeMode,
- foreignSessions: foreignSessions,
getAppsCallback: getAppsCallback,
getAppsPageIndex: getAppsPageIndex,
getCardSlider: getCardSlider,
@@ -595,6 +611,7 @@ cr.define('ntp', function() {
saveAppPageName: saveAppPageName,
setAppToBeHighlighted: setAppToBeHighlighted,
setBookmarkBarAttached: setBookmarkBarAttached,
+ setForeignSessions: setForeignSessions,
setMostVisitedPages: setMostVisitedPages,
setSuggestionsPages: setSuggestionsPages,
setRecentlyClosedTabs: setRecentlyClosedTabs,
« no previous file with comments | « chrome/browser/resources/ntp4/new_tab.html ('k') | chrome/browser/resources/ntp4/other_sessions.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698