Chromium Code Reviews| Index: chrome/browser/resources/ntp/apps.js |
| diff --git a/chrome/browser/resources/ntp/apps.js b/chrome/browser/resources/ntp/apps.js |
| index 81d7eb0624569050c58f00ba3e3c70a1875cc3ab..c728d835a0864397733018cc49aa435e54fa8fa8 100644 |
| --- a/chrome/browser/resources/ntp/apps.js |
| +++ b/chrome/browser/resources/ntp/apps.js |
| @@ -18,7 +18,7 @@ function getAppsCallback(data) { |
| appsSectionContent.textContent = ''; |
| data.apps.sort(function(a,b) { |
| - return a.app_launch_index - b.app_launch_index |
| + return a.app_launch_index - b.app_launch_index; |
| }); |
| clearClosedMenu(apps.menu); |
| @@ -124,6 +124,13 @@ var apps = (function() { |
| chrome.send('launchApp', [appId, |
| String(left), String(top), |
| String(width), String(height)]); |
| + |
| + chrome.send('recordAppLaunch', [appId]); |
|
Aaron Boodman
2010/11/10 20:38:00
It seems it would be safer to send 'recordAppLaunc
|
| + } |
| + |
| + function recordAppLaunch(e) { |
| + var appId = e.currentTarget.getAttribute('app-id'); |
| + chrome.send('recordAppLaunch', [appId]); |
| } |
| /** |
| @@ -232,6 +239,7 @@ var apps = (function() { |
| var a = div.firstChild; |
| a.onclick = handleClick; |
| + a.onmousedown = handleIfMiddleClick(recordAppLaunch); |
| a.style.backgroundImage = url(app['icon_big']); |
| if (hashParams['app-id'] == app['id']) { |
| div.setAttribute('new', 'new'); |
| @@ -271,6 +279,7 @@ var apps = (function() { |
| a.textContent = app['name']; |
| a.href = app['launch_url']; |
| a.onclick = handleClick; |
| + a.onmousedown = handleIfMiddleClick(recordAppLaunch); |
| a.style.backgroundImage = url(app['icon_small']); |
| a.className = 'item'; |
| span.appendChild(a); |
| @@ -286,6 +295,7 @@ var apps = (function() { |
| a.textContent = app['name']; |
| a.href = app['launch_url']; |
| a.onclick = handleClick; |
| + a.onmousedown = handleIfMiddleClick(recordAppLaunch); |
| a.style.backgroundImage = url(app['icon_small']); |
| a.className = 'item'; |
| return a; |
| @@ -297,6 +307,9 @@ var apps = (function() { |
| 'name': localStrings.getString('web_store_title'), |
| 'launch_url': localStrings.getString('web_store_url') |
| }); |
| + var link = elm.querySelector('a'); |
| + link.onclick = recordAppLaunch; |
| + link.onmousedown = handleIfMiddleClick(recordAppLaunch); |
| elm.setAttribute('app-id', 'web-store-entry'); |
| return elm; |
| } |