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

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

Issue 4804001: Add new promotional line for NTP.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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_new_tab.js
===================================================================
--- chrome/browser/resources/new_new_tab.js (revision 67122)
+++ chrome/browser/resources/new_new_tab.js (working copy)
@@ -814,11 +814,16 @@
hideNotification();
}
- // Remove any possible first-run trails.
+ // Remove classList entries from previous notifications.
notification.classList.remove('first-run');
+ notification.classList.remove('promo');
+ var notificationNode = notificationElement.firstElementChild;
+ notificationNode.removeChild(notificationNode.firstChild);
+
var actionLink = notificationElement.querySelector('.link-color');
- notificationElement.firstElementChild.textContent = text;
+ notificationElement.firstElementChild.appendChild(parseHtmlSubset(text));
arv (Not doing code reviews) 2010/11/24 00:02:43 I would prefer if the parsing could be done outsid
Miranda Callahan 2010/11/24 00:39:41 Done.
+
actionLink.textContent = actionText;
actionLink.onclick = doAction;
@@ -859,6 +864,15 @@
notification.classList.add('first-run');
}
+function showPromoNotification() {
+ showNotification(localStrings.getString('serverpromo'),
+ localStrings.getString('closefirstrunnotification'),
+ function () { chrome.send('closePromo'); },
+ 60000);
+ var notificationElement = $('notification');
+ notification.classList.add('promo');
+}
+
$('main').addEventListener('click', function(e) {
var p = e.target;
while (p && p.tagName != 'H2') {
@@ -1190,6 +1204,8 @@
// Only show the first run notification if first run.
if (firstRun) {
showFirstRunNotification();
+ } else if (localStrings.getString('serverpromo')) {
+ showPromoNotification();
}
}

Powered by Google App Engine
This is Rietveld 408576698