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

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

Issue 7481023: Adding notifications for new sync types. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Now stores acknowledged types in a ListValue, not a StringValue. 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
Index: chrome/browser/resources/new_tab.js
diff --git a/chrome/browser/resources/new_tab.js b/chrome/browser/resources/new_tab.js
index 46b5691c39b90fd963742c6fe7fb3d554dde4190..7ffc06123b16aba2b73137c301ab549eb0e9556b 100644
--- a/chrome/browser/resources/new_tab.js
+++ b/chrome/browser/resources/new_tab.js
@@ -1027,12 +1027,18 @@ function showNotification(message, actionText, opt_f, opt_delay) {
function closeNotification() {
if (notification.classList.contains('promo'))
chrome.send('closePromo');
+ if (notification.classList.contains('syncnotify')) {
+ chrome.send('closeSyncNotification');
+ // Make sure we don't reshow the notification now that it's closed.
+ syncNotificationHidden = true;
+ }
hideNotification();
}
// Remove classList entries from previous notifications.
notification.classList.remove('first-run');
notification.classList.remove('promo');
+ notification.classList.remove('syncnotify');
var messageContainer = notificationElement.firstElementChild;
var actionLink = notificationElement.querySelector('#action-link');
@@ -1103,6 +1109,23 @@ function showPromoNotification() {
notification.classList.add('promo');
}
+// Set to true by closeNotification() if the sync notification has been hidden
+// by the user.
+var syncNotificationHidden;
+
+function showSyncNotification() {
+ // Don't show the notification if it's already been hidden by the user.
+ if (syncNotificationHidden)
+ return;
+ showNotification(parseHtmlSubset(localStrings.getString(
+ 'syncNotification')),
+ localStrings.getString('syncLinkText'),
+ function () { chrome.send('SyncTypeLinkClicked'); },
+ 60000);
+ var notificationElement = $('notification');
+ notification.classList.add('syncnotify');
+}
+
$('main').addEventListener('click', function(e) {
var p = e.target;
while (p && p.tagName != 'H2') {
@@ -1463,6 +1486,10 @@ function setMostVisitedPages(data, hasBlacklistedUrls) {
if (localStrings.getString('serverpromo')) {
showPromoNotification();
}
+
+ if (localStrings.getString('syncNotification')) {
+ showSyncNotification();
+ }
}
function maybeDoneLoading() {

Powered by Google App Engine
This is Rietveld 408576698