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

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

Issue 7550015: ntp4: record app launch source (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: better comments Created 9 years, 4 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 | Annotate | Revision Log
OLDNEW
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
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 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/ntp4/new_tab.html ('k') | chrome/browser/ui/webui/ntp/app_launcher_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698