Chromium Code Reviews| 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..ff789fc903c249739693c9c16ae42b092152f9eb 100644 |
| --- a/chrome/browser/resources/ntp4/new_tab.js |
| +++ b/chrome/browser/resources/ntp4/new_tab.js |
| @@ -117,6 +117,7 @@ cr.define('ntp', function() { |
| if (templateData.showOtherSessionsMenu) { |
| cr.ui.decorate($('other-sessions-menu-button'), |
| ntp.OtherSessionsMenuButton); |
| + $('other-sessions-menu-button').initialize(templateData.isUserSignedIn); |
|
Dan Beam
2012/03/26 23:18:54
any reason you're not assigning this getElementByI
Patrick Dubroy
2012/03/26 23:46:07
Done.
|
| } |
| var mostVisited = new ntp.MostVisitedPage(); |
| @@ -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. |
| */ |
| - 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 {Event} e The click event. |
| + */ |
| + function showSyncLoginUI(e) { |
| + var rect = e.currentTarget.getBoundingClientRect(); |
| + chrome.send('showSyncLoginUI', |
| + [rect.left, rect.top, rect.width, rect.height]); |
| } |
| /** |
| @@ -553,8 +562,9 @@ cr.define('ntp', function() { |
| return newTabView.enterRearrangeMode.apply(newTabView, arguments); |
| } |
| - function foreignSessions(sessionList) { |
| - $('other-sessions-menu-button').sessions = sessionList; |
| + function foreignSessions(sessionList, isTabSyncEnabled) { |
|
Dan Beam
2012/03/26 23:18:54
nit: this should probably be named getForeignSessi
Patrick Dubroy
2012/03/27 00:36:51
Done.
|
| + $('other-sessions-menu-button').setForeignSessions(sessionList, |
| + isTabSyncEnabled); |
| } |
| function getAppsCallback() { |