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

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: Merged with trunk. Created 9 years, 4 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
« no previous file with comments | « chrome/browser/resources/ntp4/most_visited_page.js ('k') | chrome/browser/sync/profile_sync_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5c0ba441268fc69a1386d31e218ecd9e7bbf0f42..e3ff54bef9debe21d49e0e21fc94412f059e6f95 100644
--- a/chrome/browser/resources/ntp4/new_tab.js
+++ b/chrome/browser/resources/ntp4/new_tab.js
@@ -145,10 +145,6 @@ cr.define('ntp4', function() {
window.history.replaceState({}, '', '/');
}
- 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.
@@ -626,8 +622,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;
@@ -647,6 +645,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);
}
« no previous file with comments | « chrome/browser/resources/ntp4/most_visited_page.js ('k') | chrome/browser/sync/profile_sync_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698