OLD | NEW |
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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 var isWindow = data.type == 'window'; | 76 var isWindow = data.type == 'window'; |
77 var a = this.ownerDocument.createElement('a'); | 77 var a = this.ownerDocument.createElement('a'); |
78 a.className = 'footer-menu-item'; | 78 a.className = 'footer-menu-item'; |
79 if (isWindow) { | 79 if (isWindow) { |
80 a.href = ''; | 80 a.href = ''; |
81 a.classList.add('recent-window'); | 81 a.classList.add('recent-window'); |
82 a.textContent = formatTabsText(data.tabs.length); | 82 a.textContent = formatTabsText(data.tabs.length); |
83 a.title = data.tabs.map(function(tab) { return tab.title; }).join('\n'); | 83 a.title = data.tabs.map(function(tab) { return tab.title; }).join('\n'); |
84 } else { | 84 } else { |
85 a.href = data.url; | 85 a.href = data.url; |
86 a.style.backgroundImage = url(getFaviconUrl(data.url)); | 86 a.style.backgroundImage = getFaviconImageSet(data.url); |
87 a.textContent = data.title; | 87 a.textContent = data.title; |
88 } | 88 } |
89 | 89 |
90 function onActivated(e) { | 90 function onActivated(e) { |
91 ntp.logTimeToClick('RecentlyClosed'); | 91 ntp.logTimeToClick('RecentlyClosed'); |
92 chrome.send('recordAppLaunchByURL', | 92 chrome.send('recordAppLaunchByURL', |
93 [encodeURIComponent(data.url), | 93 [encodeURIComponent(data.url), |
94 ntp.APP_LAUNCH.NTP_RECENTLY_CLOSED]); | 94 ntp.APP_LAUNCH.NTP_RECENTLY_CLOSED]); |
95 var index = Array.prototype.indexOf.call(a.parentNode.children, a); | 95 var index = Array.prototype.indexOf.call(a.parentNode.children, a); |
96 var orig = e.originalEvent; | 96 var orig = e.originalEvent; |
(...skipping 14 matching lines...) Expand all Loading... |
111 | 111 |
112 this.menu.appendChild(a); | 112 this.menu.appendChild(a); |
113 cr.ui.decorate(a, MenuItem); | 113 cr.ui.decorate(a, MenuItem); |
114 }, | 114 }, |
115 }; | 115 }; |
116 | 116 |
117 return { | 117 return { |
118 RecentMenuButton: RecentMenuButton, | 118 RecentMenuButton: RecentMenuButton, |
119 }; | 119 }; |
120 }); | 120 }); |
OLD | NEW |