Chromium Code Reviews| Index: chrome/browser/resources/ntp4/new_tab.js |
| diff --git a/chrome/browser/resources/ntp4/new_tab.js b/chrome/browser/resources/ntp4/new_tab.js |
| index 885dd1656fffb57c63cd70c79a25391bbcb6a406..b8f6fc2bb3fef512964fc1ebb748f38c0ccc8f3d 100644 |
| --- a/chrome/browser/resources/ntp4/new_tab.js |
| +++ b/chrome/browser/resources/ntp4/new_tab.js |
| @@ -127,10 +127,6 @@ cr.define('ntp4', function() { |
| shownPage = templateData['shown_page_type']; |
| shownPageIndex = templateData['shown_page_index']; |
| - document.querySelector('#notification button').onclick = function(e) { |
| - hideNotification(); |
| - }; |
| - |
| // Request data on the apps so we can fill them in. |
| // Note that this is kicked off asynchronously. 'getAppsCallback' will be |
| // invoked at some point after this function returns. |
| @@ -594,8 +590,10 @@ cr.define('ntp4', function() { |
| * records describing the links in the notification. Each record should |
| * have a 'text' attribute (the display string) and an 'action' attribute |
| * (a function to run when the link is activated). |
| + * @param {Function} opt_close_handler The callback invoked if the user |
| + * manually dismisses the notification. |
| */ |
| - function showNotification(text, links) { |
| + function showNotification(text, links, opt_close_handler) { |
|
Evan Stade
2011/08/02 22:18:37
opt_closeHandler
Andrew T Wilson (Slow)
2011/08/03 19:03:34
Done.
|
| window.clearTimeout(notificationTimeout_); |
| document.querySelector('#notification > span').textContent = text; |
| @@ -615,6 +613,12 @@ cr.define('ntp4', function() { |
| linksBin.appendChild(link); |
| } |
| + document.querySelector('#notification button').onclick = function(e) { |
| + if (opt_close_handler) |
| + opt_close_handler(); |
| + hideNotification(); |
| + }; |
| + |
| $('notification').classList.remove('inactive'); |
| notificationTimeout_ = window.setTimeout(hideNotification, 10000); |
| } |