Index: chrome/browser/resources/ntp4/new_tab.js |
=================================================================== |
--- chrome/browser/resources/ntp4/new_tab.js (revision 97318) |
+++ chrome/browser/resources/ntp4/new_tab.js (working copy) |
@@ -207,6 +207,13 @@ |
bookmarksPage = new ntp4.BookmarksPage(); |
appendTilePage(bookmarksPage, localStrings.getString('bookmarksPage')); |
chrome.send('getBookmarksData'); |
+ |
+ var serverpromo = localStrings.getString('serverpromo'); |
+ if (serverpromo) { |
+ showNotification(parseHtmlSubset(serverpromo), [], function() { |
+ chrome.send('closePromo'); |
+ }, 60000); |
+ } |
} |
/** |
@@ -645,10 +652,17 @@ |
* @param {Function} opt_closeHandler The callback invoked if the user |
* manually dismisses the notification. |
*/ |
- function showNotification(text, links, opt_closeHandler) { |
+ function showNotification(text, links, opt_closeHandler, opt_timeout) { |
window.clearTimeout(notificationTimeout_); |
- document.querySelector('#notification > span').textContent = text; |
+ var span = document.querySelector('#notification > span'); |
+ if (typeof text == 'string') { |
Evan Stade
2011/08/19 20:43:23
name of text param and documentation needs updatin
achuithb
2011/08/19 21:30:28
Done.
|
+ span.textContent = text; |
+ } else { |
+ span.textContent = ''; // Remove all children. |
+ span.appendChild(text); |
+ } |
+ |
var linksBin = $('notificationLinks'); |
linksBin.textContent = ''; |
for (var i = 0; i < links.length; i++) { |
@@ -671,8 +685,9 @@ |
hideNotification(); |
}; |
+ var timeout = opt_timeout || 10000; |
$('notification').classList.remove('inactive'); |
- notificationTimeout_ = window.setTimeout(hideNotification, 10000); |
+ notificationTimeout_ = window.setTimeout(hideNotification, timeout); |
} |
/** |