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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
351 var node = $(id); | 351 var node = $(id); |
352 if (node) | 352 if (node) |
353 node.stripeColor = color; | 353 node.stripeColor = color; |
354 } | 354 } |
355 | 355 |
356 /** | 356 /** |
357 * Updates the text displayed in the login container. If there is no text then | 357 * Updates the text displayed in the login container. If there is no text then |
358 * the login container is hidden. | 358 * the login container is hidden. |
359 * @param {string} loginHeader The first line of text. | 359 * @param {string} loginHeader The first line of text. |
360 * @param {string} loginSubHeader The second line of text. | 360 * @param {string} loginSubHeader The second line of text. |
361 * @param {string} iconURL The url for the login status icon. If this is null | |
362 then the login status icon is hidden. | |
361 */ | 363 */ |
362 function updateLogin(loginHeader, loginSubHeader) { | 364 function updateLogin(loginHeader, loginSubHeader, iconURL) { |
363 if (loginHeader || loginSubHeader) { | 365 if (loginHeader || loginSubHeader) { |
364 $('login-container').hidden = false; | 366 $('login-container').hidden = false; |
365 $('login-status-header').innerHTML = loginHeader; | 367 $('login-status-header').innerHTML = loginHeader; |
366 $('login-status-sub-header').innerHTML = loginSubHeader; | 368 $('login-status-sub-header').innerHTML = loginSubHeader; |
367 $('card-slider-frame').classList.add('showing-login-area'); | 369 $('card-slider-frame').classList.add('showing-login-area'); |
370 | |
371 if (iconURL) { | |
372 $('login-status-header-container').style.backgroundImage = url(iconURL); | |
373 $('login-status-header-container').classList.add('login-status-icon'); | |
374 } else { | |
375 $('login-status-header-container').style.backgroundImage = "none"; | |
Evan Stade
2011/12/02 21:02:16
single quotes
sail
2011/12/03 00:09:00
Done.
| |
376 $('login-status-header-container').classList.remove( | |
377 'login-status-icon'); | |
378 } | |
368 } else { | 379 } else { |
369 $('login-container').hidden = true; | 380 $('login-container').hidden = true; |
370 $('card-slider-frame').classList.remove('showing-login-area'); | 381 $('card-slider-frame').classList.remove('showing-login-area'); |
371 } | 382 } |
372 if (shouldShowLoginBubble) { | 383 if (shouldShowLoginBubble) { |
373 window.setTimeout(loginBubble.show.bind(loginBubble), 0); | 384 window.setTimeout(loginBubble.show.bind(loginBubble), 0); |
374 chrome.send('loginMessageSeen'); | 385 chrome.send('loginMessageSeen'); |
375 shouldShowLoginBubble = false; | 386 shouldShowLoginBubble = false; |
387 } else if (loginBubble) { | |
388 loginBubble.reposition(); | |
376 } | 389 } |
377 } | 390 } |
378 | 391 |
379 /** | 392 /** |
380 * Wrappers to forward the callback to corresponding PageListView member. | 393 * Wrappers to forward the callback to corresponding PageListView member. |
381 */ | 394 */ |
382 function appAdded(appData, opt_highlight) { | 395 function appAdded(appData, opt_highlight) { |
383 newTabView.appAdded(appData, opt_highlight); | 396 newTabView.appAdded(appData, opt_highlight); |
384 } | 397 } |
385 | 398 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
453 // TODO(estade): update the content handlers to use ntp namespace instead of | 466 // TODO(estade): update the content handlers to use ntp namespace instead of |
454 // making these global. | 467 // making these global. |
455 var getAppsCallback = ntp4.getAppsCallback; | 468 var getAppsCallback = ntp4.getAppsCallback; |
456 var appsPrefChangeCallback = ntp4.appsPrefChangeCallback; | 469 var appsPrefChangeCallback = ntp4.appsPrefChangeCallback; |
457 var themeChanged = ntp4.themeChanged; | 470 var themeChanged = ntp4.themeChanged; |
458 var recentlyClosedTabs = ntp4.setRecentlyClosedTabs; | 471 var recentlyClosedTabs = ntp4.setRecentlyClosedTabs; |
459 var setMostVisitedPages = ntp4.setMostVisitedPages; | 472 var setMostVisitedPages = ntp4.setMostVisitedPages; |
460 var updateLogin = ntp4.updateLogin; | 473 var updateLogin = ntp4.updateLogin; |
461 | 474 |
462 document.addEventListener('DOMContentLoaded', ntp4.onLoad); | 475 document.addEventListener('DOMContentLoaded', ntp4.onLoad); |
OLD | NEW |