OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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('ntp4', function() { | 9 cr.define('ntp4', function() { |
10 'use strict'; | 10 'use strict'; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 a.classList.add('recent-window'); | 83 a.classList.add('recent-window'); |
84 a.textContent = formatTabsText(data.tabs.length); | 84 a.textContent = formatTabsText(data.tabs.length); |
85 } else { | 85 } else { |
86 a.href = data.url; | 86 a.href = data.url; |
87 a.style.backgroundImage = 'url(chrome://favicon/' + data.url + ')'; | 87 a.style.backgroundImage = 'url(chrome://favicon/' + data.url + ')'; |
88 a.textContent = data.title; | 88 a.textContent = data.title; |
89 // TODO(estade): add app ping url. | 89 // TODO(estade): add app ping url. |
90 } | 90 } |
91 | 91 |
92 function onActivate(e) { | 92 function onActivate(e) { |
| 93 chrome.send('recordAppLaunchByURL', |
| 94 [encodeURIComponent(data.url), |
| 95 ntp4.APP_LAUNCH.NTP_RECENTLY_CLOSED]); |
93 // TODO(estade): don't convert to string. | 96 // TODO(estade): don't convert to string. |
94 chrome.send('reopenTab', [String(data.sessionId)]); | 97 chrome.send('reopenTab', [String(data.sessionId)]); |
| 98 // We are likely deleted by this point! |
| 99 |
95 e.preventDefault(); | 100 e.preventDefault(); |
96 } | 101 } |
97 a.addEventListener('activate', onActivate); | 102 a.addEventListener('activate', onActivate); |
98 | 103 |
99 this.menu.appendChild(a); | 104 this.menu.appendChild(a); |
100 cr.ui.decorate(a, MenuItem); | 105 cr.ui.decorate(a, MenuItem); |
101 }, | 106 }, |
102 }; | 107 }; |
103 | 108 |
104 return { | 109 return { |
105 RecentMenuButton: RecentMenuButton, | 110 RecentMenuButton: RecentMenuButton, |
106 }; | 111 }; |
107 }); | 112 }); |
OLD | NEW |