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

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

Issue 6313009: Add possibility to divide chrome users into groups of equal size, and change ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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/new_new_tab.html ('k') | chrome/browser/sessions/session_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/new_new_tab.js
===================================================================
--- chrome/browser/resources/new_new_tab.js (revision 72341)
+++ chrome/browser/resources/new_new_tab.js (working copy)
@@ -807,7 +807,7 @@
}
/**
- * Invoked when the link in the sync status section is clicked.
+ * Invoked when the link in the sync promo or sync status section is clicked.
*/
function syncSectionLinkClicked(e) {
chrome.send('SyncLinkClicked');
@@ -935,9 +935,11 @@
* @param {function=} opt_f Function to call when the user clicks the action
* link.
* @param {number=} opt_delay The time in milliseconds before hiding the
- * i notification.
+ * notification.
+ * @param {boolean=} close If true, show a close link next to the notification.
*/
-function showNotification(message, actionText, opt_f, opt_delay) {
+function showNotification(message, actionText, opt_f, opt_delay, opt_close) {
+// TODO(arv): Create a notification component.
var notificationElement = $('notification');
var f = opt_f || function() {};
var delay = opt_delay || 10000;
@@ -957,13 +959,27 @@
hideNotification();
}
+ function closeNotification() {
+ chrome.send('closePromo');
+ hideNotification();
+ }
+
// Remove classList entries from previous notifications.
notification.classList.remove('first-run');
notification.classList.remove('promo');
var messageContainer = notificationElement.firstElementChild;
- var actionLink = notificationElement.querySelector('.link-color');
+ var actionLink = notificationElement.querySelector('#action-link');
+ if (opt_close) {
+ var closeLink = notificationElement.querySelector('#close-link');
+ closeLink.textContent =
+ localStrings.getString('closefirstrunnotification');
+ closeLink.onclick = closeNotification;
+ closeLink.onkeydown = handleIfEnterKey(closeNotification);
+ closeLink.tabIndex = 1;
+ }
+
if (typeof message == 'string') {
messageContainer.textContent = message;
} else {
@@ -993,14 +1009,17 @@
var notificationElement = $('notification');
notificationElement.classList.remove('show');
document.body.classList.remove('notification-shown');
- var actionLink = notificationElement.querySelector('.link-color');
+ var actionLink = notificationElement.querySelector('#actionlink');
+ var closeLink = notificationElement.querySelector('#closelink');
// Prevent tabbing to the hidden link.
actionLink.tabIndex = -1;
+ closeLink.tabIndex = -1;
// Setting tabIndex to -1 only prevents future tabbing to it. If, however, the
// user switches window or a tab and then moves back to this tab the element
// may gain focus. We therefore make sure that we blur the element so that the
// element focus is not restored when coming back to this window.
actionLink.blur();
+ closeLink.blur();
}
function showFirstRunNotification() {
@@ -1013,9 +1032,10 @@
function showPromoNotification() {
showNotification(parseHtmlSubset(localStrings.getString('serverpromo')),
- localStrings.getString('closefirstrunnotification'),
- function () { chrome.send('closePromo'); },
- 60000);
+ localStrings.getString('syncpromotext'),
+ function () { chrome.send('SyncLinkClicked'); },
+ 60000,
+ true);
var notificationElement = $('notification');
notification.classList.add('promo');
}
« no previous file with comments | « chrome/browser/resources/new_new_tab.html ('k') | chrome/browser/sessions/session_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698