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

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

Issue 11013021: Basic keyboard access for recently_closed menu on NTP (re-work). (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase to current version. Created 8 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 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 The recently closed menu: button, model data, and menu. 6 * @fileoverview The recently closed menu: button, model data, and menu.
7 */ 7 */
8 8
9 cr.define('ntp', function() { 9 cr.define('ntp', function() {
10 'use strict'; 10 'use strict';
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 a.href = ''; 83 a.href = '';
84 a.classList.add('recent-window'); 84 a.classList.add('recent-window');
85 a.textContent = formatTabsText(data.tabs.length); 85 a.textContent = formatTabsText(data.tabs.length);
86 a.title = data.tabs.map(function(tab) { return tab.title; }).join('\n'); 86 a.title = data.tabs.map(function(tab) { return tab.title; }).join('\n');
87 } else { 87 } else {
88 a.href = data.url; 88 a.href = data.url;
89 a.style.backgroundImage = 'url(chrome://favicon/' + data.url + ')'; 89 a.style.backgroundImage = 'url(chrome://favicon/' + data.url + ')';
90 a.textContent = data.title; 90 a.textContent = data.title;
91 } 91 }
92 92
93 function onClick(e) { 93 function onActivated(e) {
94 ntp.logTimeToClick('RecentlyClosed'); 94 ntp.logTimeToClick('RecentlyClosed');
95 chrome.send('recordAppLaunchByURL', 95 chrome.send('recordAppLaunchByURL',
96 [encodeURIComponent(data.url), 96 [encodeURIComponent(data.url),
97 ntp.APP_LAUNCH.NTP_RECENTLY_CLOSED]); 97 ntp.APP_LAUNCH.NTP_RECENTLY_CLOSED]);
98 var index = Array.prototype.indexOf.call(a.parentNode.children, a); 98 var index = Array.prototype.indexOf.call(a.parentNode.children, a);
99 chrome.send('reopenTab', [data.sessionId, index, 99 var orig = e.originalEvent;
100 e.button, e.altKey, e.ctrlKey, e.metaKey, e.shiftKey]); 100 var params = [data.sessionId,
101 index,
102 orig.type == 'click' ? orig.button : 0,
103 orig.altKey,
104 orig.ctrlKey,
105 orig.metaKey,
106 orig.shiftKey];
107 chrome.send('reopenTab', params);
108
101 // We are likely deleted by this point! 109 // We are likely deleted by this point!
102 110 e.stopPropagation();
Dan Beam 2013/03/14 21:22:01 aboxhall@: ^ why did you add this?
103 e.preventDefault(); 111 e.preventDefault();
104 } 112 }
105 a.addEventListener('click', onClick); 113 a.addEventListener('activate', onActivated);
106 114
107 this.menu.appendChild(a); 115 this.menu.appendChild(a);
108 cr.ui.decorate(a, MenuItem); 116 cr.ui.decorate(a, MenuItem);
109 }, 117 },
110 }; 118 };
111 119
112 return { 120 return {
113 RecentMenuButton: RecentMenuButton, 121 RecentMenuButton: RecentMenuButton,
114 }; 122 };
115 }); 123 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698