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

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: Address comments, and only enable menu when tab sync is enabled. 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
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() {

Powered by Google App Engine
This is Rietveld 408576698