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

Side by Side Diff: chrome/browser/resources/ntp4/new_tab.js

Issue 668983004: Add <a is="action-link">, a web component extension of <a> for in-page actions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 6 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview New tab page 6 * @fileoverview New tab page
7 * This is the main code for the new tab page used by touch-enabled Chrome 7 * This is the main code for the new tab page used by touch-enabled Chrome
8 * browsers. For now this is still a prototype. 8 * browsers. For now this is still a prototype.
9 */ 9 */
10 10
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 }, 60000); 292 }, 60000);
293 chrome.send('notificationPromoViewed'); 293 chrome.send('notificationPromoViewed');
294 } 294 }
295 295
296 cr.dispatchSimpleEvent(document, 'ntpLoaded', true, true); 296 cr.dispatchSimpleEvent(document, 'ntpLoaded', true, true);
297 document.documentElement.classList.remove('starting-up'); 297 document.documentElement.classList.remove('starting-up');
298 298
299 startTime = Date.now(); 299 startTime = Date.now();
300 }); 300 });
301 301
302 preventDefaultOnPoundLinkClicks(); // From webui/js/util.js.
303 cr.ui.FocusManager.disableMouseFocusOnButtons(); 302 cr.ui.FocusManager.disableMouseFocusOnButtons();
304 } 303 }
305 304
306 /** 305 /**
307 * Launches the chrome web store app with the chrome-ntp-launcher 306 * Launches the chrome web store app with the chrome-ntp-launcher
308 * source. 307 * source.
309 * @param {Event} e The click event. 308 * @param {Event} e The click event.
310 */ 309 */
311 function onChromeWebStoreButtonClick(e) { 310 function onChromeWebStoreButtonClick(e) {
312 chrome.send('recordAppLaunchByURL', 311 chrome.send('recordAppLaunchByURL',
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 if (typeof message == 'string') { 455 if (typeof message == 'string') {
457 span.textContent = message; 456 span.textContent = message;
458 } else { 457 } else {
459 span.textContent = ''; // Remove all children. 458 span.textContent = ''; // Remove all children.
460 span.appendChild(message); 459 span.appendChild(message);
461 } 460 }
462 461
463 var linksBin = $('notificationLinks'); 462 var linksBin = $('notificationLinks');
464 linksBin.textContent = ''; 463 linksBin.textContent = '';
465 for (var i = 0; i < links.length; i++) { 464 for (var i = 0; i < links.length; i++) {
466 var link = linksBin.ownerDocument.createElement('div'); 465 var link = linksBin.ownerDocument.createElement('a', 'action-link');
467 link.textContent = links[i].text; 466 link.textContent = links[i].text;
468 link.action = links[i].action; 467 link.action = links[i].action;
469 link.onclick = function() { 468 link.onclick = function() {
470 this.action(); 469 this.action();
471 hideNotification(); 470 hideNotification();
472 }; 471 };
473 link.setAttribute('role', 'button');
474 link.setAttribute('tabindex', 0);
475 link.className = 'link-button';
476 linksBin.appendChild(link); 472 linksBin.appendChild(link);
477 } 473 }
478 474
479 function closeFunc(e) { 475 function closeFunc(e) {
480 if (opt_closeHandler) 476 if (opt_closeHandler)
481 opt_closeHandler(); 477 opt_closeHandler();
482 hideNotification(); 478 hideNotification();
483 } 479 }
484 480
485 document.querySelector('#notification button').onclick = closeFunc; 481 document.querySelector('#notification button').onclick = closeFunc;
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 setFaviconDominantColor: setFaviconDominantColor, 783 setFaviconDominantColor: setFaviconDominantColor,
788 showNotification: showNotification, 784 showNotification: showNotification,
789 themeChanged: themeChanged, 785 themeChanged: themeChanged,
790 updateLogin: updateLogin 786 updateLogin: updateLogin
791 }; 787 };
792 }); 788 });
793 789
794 document.addEventListener('DOMContentLoaded', ntp.onLoad); 790 document.addEventListener('DOMContentLoaded', ntp.onLoad);
795 791
796 var toCssPx = cr.ui.toCssPx; 792 var toCssPx = cr.ui.toCssPx;
OLDNEW
« no previous file with comments | « chrome/browser/resources/ntp4/new_tab.html ('k') | chrome/browser/resources/ntp4/new_tab_theme.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698