Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4074)

Unified Diff: chrome/browser/resources/ntp4/new_tab.js

Issue 7481023: Adding notifications for new sync types. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More changes for review feedback. Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..5941c721f455c44b175a6afae08ff7dafa513625 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_closeHandler The callback invoked if the user
+ * manually dismisses the notification.
*/
- function showNotification(text, links) {
+ function showNotification(text, links, opt_closeHandler) {
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_closeHandler)
+ opt_closeHandler();
+ hideNotification();
+ };
+
$('notification').classList.remove('inactive');
notificationTimeout_ = window.setTimeout(hideNotification, 10000);
}

Powered by Google App Engine
This is Rietveld 408576698