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 eef19f37bf44a60bd41ac3f3e88b106df83ab6a0..e311f3bbb489532c1027713f28f9eeb9e866fc34 100644 |
--- a/chrome/browser/resources/ntp4/new_tab.js |
+++ b/chrome/browser/resources/ntp4/new_tab.js |
@@ -117,6 +117,8 @@ cr.define('ntp', function() { |
if (templateData.showOtherSessionsMenu) { |
cr.ui.decorate($('other-sessions-menu-button'), |
ntp.OtherSessionsMenuButton); |
+ $('other-sessions-menu-button').initialize( |
+ templateData.isUserSignedIn, showSyncLoginUI); |
} |
var mostVisited = new ntp.MostVisitedPage(); |
@@ -157,7 +159,6 @@ cr.define('ntp', function() { |
var url = appendParam(webstoreLink, 'utm_source', 'chrome-ntp-plus-icon'); |
$('app-install-hint-template').href = url; |
} |
- |
if (localStrings.getString('login_status_message')) { |
loginBubble = new cr.ui.Bubble; |
loginBubble.anchorNode = $('login-container'); |
@@ -216,11 +217,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() { |
@@ -497,8 +494,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. |
Dan Beam
2012/03/26 17:08:34
nit: s/Boolean/boolean/ (as it's not a wrapper cla
Patrick Dubroy
2012/03/26 19:36:46
Done.
|
*/ |
- function updateLogin(loginHeader, loginSubHeader, iconURL) { |
+ function updateLogin(loginHeader, loginSubHeader, iconURL, isUserSignedIn) { |
if (loginHeader || loginSubHeader) { |
$('login-container').hidden = false; |
$('login-status-header').innerHTML = loginHeader; |
@@ -524,6 +522,17 @@ cr.define('ntp', function() { |
} else if (loginBubble) { |
loginBubble.reposition(); |
} |
+ $('other-sessions-menu-button').updateSignInState(isUserSignedIn); |
+ } |
+ |
+ /** |
+ * Show the sync login UI. |
+ * @param {Element} element The element that triggered the login. |
Dan Beam
2012/03/26 17:08:34
isn't this an {Event}, not element... you're calli
Patrick Dubroy
2012/03/26 19:36:46
Done.
|
+ */ |
+ function showSyncLoginUI(e) { |
+ var rect = e.currentTarget.getBoundingClientRect(); |
+ chrome.send('showSyncLoginUI', |
+ [rect.left, rect.top, rect.width, rect.height]); |
} |
/** |