| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 957 if (node) | 957 if (node) |
| 958 node.stripeColor = color; | 958 node.stripeColor = color; |
| 959 } | 959 } |
| 960 | 960 |
| 961 /** | 961 /** |
| 962 * Updates the text displayed in the login container. If there is no text then | 962 * Updates the text displayed in the login container. If there is no text then |
| 963 * the login container is hidden. | 963 * the login container is hidden. |
| 964 * @param {string} loginHeader The first line of text. | 964 * @param {string} loginHeader The first line of text. |
| 965 * @param {string} loginSubHeader The second line of text. | 965 * @param {string} loginSubHeader The second line of text. |
| 966 */ | 966 */ |
| 967 function updateLogin(loginHeader, loginSubHeader) { | 967 function updateLogin(loginHeader, loginSubHeader, icon_url) { |
| 968 if (loginHeader || loginSubHeader) { | 968 if (loginHeader || loginSubHeader) { |
| 969 $('login-container').hidden = false; | 969 $('login-container').hidden = false; |
| 970 $('login-status-header').innerHTML = loginHeader; | 970 $('login-status-header').innerHTML = loginHeader; |
| 971 $('login-status-sub-header').innerHTML = loginSubHeader; | 971 $('login-status-sub-header').innerHTML = loginSubHeader; |
| 972 $('card-slider-frame').classList.add('showing-login-area'); | 972 $('card-slider-frame').classList.add('showing-login-area'); |
| 973 |
| 974 if (icon_url) { |
| 975 $('login-status-icon').hidden = false; |
| 976 $('login-status-icon').src = icon_url; |
| 977 } else { |
| 978 $('login-status-icon').hidden = true; |
| 979 } |
| 973 } else { | 980 } else { |
| 974 $('login-container').hidden = true; | 981 $('login-container').hidden = true; |
| 975 $('card-slider-frame').classList.remove('showing-login-area'); | 982 $('card-slider-frame').classList.remove('showing-login-area'); |
| 976 } | 983 } |
| 977 if (shouldShowLoginBubble) { | 984 if (shouldShowLoginBubble) { |
| 978 window.setTimeout(loginBubble.show.bind(loginBubble), 0); | 985 window.setTimeout(loginBubble.show.bind(loginBubble), 0); |
| 979 chrome.send('loginMessageSeen'); | 986 chrome.send('loginMessageSeen'); |
| 980 shouldShowLoginBubble = false; | 987 shouldShowLoginBubble = false; |
| 988 } else if (loginBubble) { |
| 989 loginBubble.reposition(); |
| 981 } | 990 } |
| 982 } | 991 } |
| 983 | 992 |
| 984 // Return an object with all the exports | 993 // Return an object with all the exports |
| 985 return { | 994 return { |
| 986 appAdded: appAdded, | 995 appAdded: appAdded, |
| 987 appRemoved: appRemoved, | 996 appRemoved: appRemoved, |
| 988 appsPrefChangeCallback: appsPrefChangeCallback, | 997 appsPrefChangeCallback: appsPrefChangeCallback, |
| 989 assert: assert, | 998 assert: assert, |
| 990 bookmarkImportBegan: bookmarkImportBegan, | 999 bookmarkImportBegan: bookmarkImportBegan, |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1021 var getAppsCallback = ntp4.getAppsCallback; | 1030 var getAppsCallback = ntp4.getAppsCallback; |
| 1022 var appsPrefChangeCallback = ntp4.appsPrefChangeCallback; | 1031 var appsPrefChangeCallback = ntp4.appsPrefChangeCallback; |
| 1023 var themeChanged = ntp4.themeChanged; | 1032 var themeChanged = ntp4.themeChanged; |
| 1024 var recentlyClosedTabs = ntp4.setRecentlyClosedTabs; | 1033 var recentlyClosedTabs = ntp4.setRecentlyClosedTabs; |
| 1025 var setMostVisitedPages = ntp4.setMostVisitedPages; | 1034 var setMostVisitedPages = ntp4.setMostVisitedPages; |
| 1026 var updateLogin = ntp4.updateLogin; | 1035 var updateLogin = ntp4.updateLogin; |
| 1027 | 1036 |
| 1028 document.addEventListener('DOMContentLoaded', ntp4.initialize); | 1037 document.addEventListener('DOMContentLoaded', ntp4.initialize); |
| 1029 window.addEventListener('online', ntp4.updateOfflineEnabledApps); | 1038 window.addEventListener('online', ntp4.updateOfflineEnabledApps); |
| 1030 window.addEventListener('offline', ntp4.updateOfflineEnabledApps); | 1039 window.addEventListener('offline', ntp4.updateOfflineEnabledApps); |
| OLD | NEW |