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 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 */ | 361 */ |
362 function updateLogin(loginHeader, loginSubHeader) { | 362 function updateLogin(loginHeader, loginSubHeader, icon_url) { |
363 if (loginHeader || loginSubHeader) { | 363 if (loginHeader || loginSubHeader) { |
364 $('login-container').hidden = false; | 364 $('login-container').hidden = false; |
365 $('login-status-header').innerHTML = loginHeader; | 365 $('login-status-header').innerHTML = loginHeader; |
366 $('login-status-sub-header').innerHTML = loginSubHeader; | 366 $('login-status-sub-header').innerHTML = loginSubHeader; |
367 $('card-slider-frame').classList.add('showing-login-area'); | 367 $('card-slider-frame').classList.add('showing-login-area'); |
| 368 |
| 369 if (icon_url) { |
| 370 $('login-status-icon-container').hidden = false; |
| 371 $('login-status-icon').src = icon_url; |
| 372 } else { |
| 373 $('login-status-icon-container').hidden = true; |
| 374 } |
368 } else { | 375 } else { |
369 $('login-container').hidden = true; | 376 $('login-container').hidden = true; |
370 $('card-slider-frame').classList.remove('showing-login-area'); | 377 $('card-slider-frame').classList.remove('showing-login-area'); |
371 } | 378 } |
372 if (shouldShowLoginBubble) { | 379 if (shouldShowLoginBubble) { |
373 window.setTimeout(loginBubble.show.bind(loginBubble), 0); | 380 window.setTimeout(loginBubble.show.bind(loginBubble), 0); |
374 chrome.send('loginMessageSeen'); | 381 chrome.send('loginMessageSeen'); |
375 shouldShowLoginBubble = false; | 382 shouldShowLoginBubble = false; |
| 383 } else if (loginBubble) { |
| 384 loginBubble.reposition(); |
376 } | 385 } |
377 } | 386 } |
378 | 387 |
379 /** | 388 /** |
380 * Wrappers to forward the callback to corresponding PageListView member. | 389 * Wrappers to forward the callback to corresponding PageListView member. |
381 */ | 390 */ |
382 function appAdded(appData, opt_highlight) { | 391 function appAdded(appData, opt_highlight) { |
383 newTabView.appAdded(appData, opt_highlight); | 392 newTabView.appAdded(appData, opt_highlight); |
384 } | 393 } |
385 | 394 |
(...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 | 462 // TODO(estade): update the content handlers to use ntp namespace instead of |
454 // making these global. | 463 // making these global. |
455 var getAppsCallback = ntp4.getAppsCallback; | 464 var getAppsCallback = ntp4.getAppsCallback; |
456 var appsPrefChangeCallback = ntp4.appsPrefChangeCallback; | 465 var appsPrefChangeCallback = ntp4.appsPrefChangeCallback; |
457 var themeChanged = ntp4.themeChanged; | 466 var themeChanged = ntp4.themeChanged; |
458 var recentlyClosedTabs = ntp4.setRecentlyClosedTabs; | 467 var recentlyClosedTabs = ntp4.setRecentlyClosedTabs; |
459 var setMostVisitedPages = ntp4.setMostVisitedPages; | 468 var setMostVisitedPages = ntp4.setMostVisitedPages; |
460 var updateLogin = ntp4.updateLogin; | 469 var updateLogin = ntp4.updateLogin; |
461 | 470 |
462 document.addEventListener('DOMContentLoaded', ntp4.onLoad); | 471 document.addEventListener('DOMContentLoaded', ntp4.onLoad); |
OLD | NEW |