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 4 | 6 * @fileoverview New tab page 4 |
7 * This is the main code for a previous version of the Chrome NTP ("NTP4"). | 7 * This is the main code for a previous version of the Chrome NTP ("NTP4"). |
8 * Some parts of this are still used for the chrome://apps page. | 8 * Some parts of this are still used for the chrome://apps page. |
9 */ | 9 */ |
10 | 10 |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 */ | 258 */ |
259 function themeChanged(opt_themeData) { | 259 function themeChanged(opt_themeData) { |
260 $('themecss').href = 'chrome://theme/css/new_tab_theme.css?' + Date.now(); | 260 $('themecss').href = 'chrome://theme/css/new_tab_theme.css?' + Date.now(); |
261 } | 261 } |
262 | 262 |
263 function setBookmarkBarAttached(attached) { | 263 function setBookmarkBarAttached(attached) { |
264 document.documentElement.setAttribute('bookmarkbarattached', attached); | 264 document.documentElement.setAttribute('bookmarkbarattached', attached); |
265 } | 265 } |
266 | 266 |
267 /** | 267 /** |
268 * Set the dominant color for a node. This will be called in response to | |
269 * getFaviconDominantColor. The node represented by |id| better have a setter | |
270 * for stripeColor. | |
271 * @param {string} id The ID of a node. | |
272 * @param {string} color The color represented as a CSS string. | |
273 */ | |
274 function setFaviconDominantColor(id, color) { | |
275 var node = $(id); | |
276 if (node) | |
277 node.stripeColor = color; | |
278 } | |
279 | |
280 /** | |
281 * Updates the text displayed in the login container. If there is no text then | 268 * Updates the text displayed in the login container. If there is no text then |
282 * the login container is hidden. | 269 * the login container is hidden. |
283 * @param {string} loginHeader The first line of text. | 270 * @param {string} loginHeader The first line of text. |
284 * @param {string} loginSubHeader The second line of text. | 271 * @param {string} loginSubHeader The second line of text. |
285 * @param {string} iconURL The url for the login status icon. If this is null | 272 * @param {string} iconURL The url for the login status icon. If this is null |
286 then the login status icon is hidden. | 273 then the login status icon is hidden. |
287 * @param {boolean} isUserSignedIn Indicates if the user is signed in or not. | 274 * @param {boolean} isUserSignedIn Indicates if the user is signed in or not. |
288 */ | 275 */ |
289 function updateLogin(loginHeader, loginSubHeader, iconURL, isUserSignedIn) { | 276 function updateLogin(loginHeader, loginSubHeader, iconURL, isUserSignedIn) { |
290 /** @const */ var showLogin = loginHeader || loginSubHeader; | 277 /** @const */ var showLogin = loginHeader || loginSubHeader; |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 setBookmarkBarAttached: setBookmarkBarAttached, | 437 setBookmarkBarAttached: setBookmarkBarAttached, |
451 setFaviconDominantColor: setFaviconDominantColor, | 438 setFaviconDominantColor: setFaviconDominantColor, |
452 themeChanged: themeChanged, | 439 themeChanged: themeChanged, |
453 updateLogin: updateLogin | 440 updateLogin: updateLogin |
454 }; | 441 }; |
455 }); | 442 }); |
456 | 443 |
457 document.addEventListener('DOMContentLoaded', ntp.onLoad); | 444 document.addEventListener('DOMContentLoaded', ntp.onLoad); |
458 | 445 |
459 var toCssPx = cr.ui.toCssPx; | 446 var toCssPx = cr.ui.toCssPx; |
OLD | NEW |