| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @fileoverview New tab page | 6 * @fileoverview New tab page |
| 7 * This is the main code for the new tab page used by touch-enabled Chrome | 7 * This is the main code for the new tab page used by touch-enabled Chrome |
| 8 * browsers. For now this is still a prototype. | 8 * browsers. For now this is still a prototype. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 * @param {string} loginHeader The first line of text. | 534 * @param {string} loginHeader The first line of text. |
| 535 * @param {string} loginSubHeader The second line of text. | 535 * @param {string} loginSubHeader The second line of text. |
| 536 * @param {string} iconURL The url for the login status icon. If this is null | 536 * @param {string} iconURL The url for the login status icon. If this is null |
| 537 then the login status icon is hidden. | 537 then the login status icon is hidden. |
| 538 * @param {boolean} isUserSignedIn Indicates if the user is signed in or not. | 538 * @param {boolean} isUserSignedIn Indicates if the user is signed in or not. |
| 539 */ | 539 */ |
| 540 function updateLogin(loginHeader, loginSubHeader, iconURL, isUserSignedIn) { | 540 function updateLogin(loginHeader, loginSubHeader, iconURL, isUserSignedIn) { |
| 541 /** @const */ var showLogin = loginHeader || loginSubHeader; | 541 /** @const */ var showLogin = loginHeader || loginSubHeader; |
| 542 | 542 |
| 543 $('login-container').hidden = !showLogin; | 543 $('login-container').hidden = !showLogin; |
| 544 $('login-container').classList.toggle('signed-in', isUserSignedIn); |
| 544 $('card-slider-frame').classList.toggle('showing-login-area', !!showLogin); | 545 $('card-slider-frame').classList.toggle('showing-login-area', !!showLogin); |
| 545 | 546 |
| 546 if (showLogin) { | 547 if (showLogin) { |
| 547 // TODO(dbeam): we should use .textContent instead to mitigate XSS. | 548 // TODO(dbeam): we should use .textContent instead to mitigate XSS. |
| 548 $('login-status-header').innerHTML = loginHeader; | 549 $('login-status-header').innerHTML = loginHeader; |
| 549 $('login-status-sub-header').innerHTML = loginSubHeader; | 550 $('login-status-sub-header').innerHTML = loginSubHeader; |
| 550 | 551 |
| 551 var headerContainer = $('login-status-header-container'); | 552 var headerContainer = $('login-status-header-container'); |
| 552 headerContainer.classList.toggle('login-status-icon', !!iconURL); | 553 headerContainer.classList.toggle('login-status-icon', !!iconURL); |
| 553 headerContainer.style.backgroundImage = iconURL ? url(iconURL) : 'none'; | 554 headerContainer.style.backgroundImage = iconURL ? url(iconURL) : 'none'; |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 setFaviconDominantColor: setFaviconDominantColor, | 715 setFaviconDominantColor: setFaviconDominantColor, |
| 715 showNotification: showNotification, | 716 showNotification: showNotification, |
| 716 themeChanged: themeChanged, | 717 themeChanged: themeChanged, |
| 717 updateLogin: updateLogin | 718 updateLogin: updateLogin |
| 718 }; | 719 }; |
| 719 }); | 720 }); |
| 720 | 721 |
| 721 document.addEventListener('DOMContentLoaded', ntp.onLoad); | 722 document.addEventListener('DOMContentLoaded', ntp.onLoad); |
| 722 | 723 |
| 723 var toCssPx = cr.ui.toCssPx; | 724 var toCssPx = cr.ui.toCssPx; |
| OLD | NEW |