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() { |