diff options
author | jstritar@chromium.org <jstritar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-16 15:59:33 +0000 |
---|---|---|
committer | jstritar@chromium.org <jstritar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-16 15:59:33 +0000 |
commit | 46fd1ea45461917171ecea8744a2db4b43df1d61 (patch) | |
tree | faced94944df6857520a4d11a3b3367191ea7baa /chrome/browser/resources/ntp | |
parent | 6492714d580187b79302635291d01c2bfa58ceec (diff) | |
download | chromium_src-46fd1ea45461917171ecea8744a2db4b43df1d61.zip chromium_src-46fd1ea45461917171ecea8744a2db4b43df1d61.tar.gz chromium_src-46fd1ea45461917171ecea8744a2db4b43df1d61.tar.bz2 |
Add a histogram to track application launches by type. Unfortunately, this undercounts apps that are launched via a URL that redirects to the app's web extent.
BUG=62410
TEST=None.
Review URL: http://codereview.chromium.org/6312189
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75122 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/resources/ntp')
-rw-r--r-- | chrome/browser/resources/ntp/apps.js | 38 | ||||
-rw-r--r-- | chrome/browser/resources/ntp/most_visited.js | 7 |
2 files changed, 32 insertions, 13 deletions
diff --git a/chrome/browser/resources/ntp/apps.js b/chrome/browser/resources/ntp/apps.js index 3f50d760..eba94bf 100644 --- a/chrome/browser/resources/ntp/apps.js +++ b/chrome/browser/resources/ntp/apps.js @@ -6,12 +6,6 @@ var MAX_APPS_PER_ROW = []; MAX_APPS_PER_ROW[LayoutMode.SMALL] = 4; MAX_APPS_PER_ROW[LayoutMode.NORMAL] = 6; -// The URL prefix used in the app link 'ping' attributes. -var PING_APP_LAUNCH_PREFIX = 'record-app-launch'; - -// The URL prefix used in the webstore link 'ping' attributes. -var PING_WEBSTORE_LAUNCH_PREFIX = 'record-webstore-launch'; - function getAppsCallback(data) { logEvent('received apps'); @@ -24,7 +18,7 @@ function getAppsCallback(data) { var appsSectionContent = $('apps-content'); var appsMiniview = appsSection.getElementsByClassName('miniview')[0]; var appsPromo = $('apps-promo'); - var appsPromoPing = PING_WEBSTORE_LAUNCH_PREFIX + '+' + apps.showPromo; + var appsPromoPing = APP_LAUNCH_URL.PING_WEBSTORE + '+' + apps.showPromo; var webStoreEntry, webStoreMiniEntry; // Hide menu options that are not supported on the OS or windowing system. @@ -171,19 +165,36 @@ var apps = (function() { if (opt_mouseEvent) { // Launch came from a click. - chrome.send('launchApp', [appId, left, top, width, height, + chrome.send('launchApp', [appId, String(getAppLaunchType()), + left, top, width, height, opt_mouseEvent.altKey, opt_mouseEvent.ctrlKey, opt_mouseEvent.metaKey, opt_mouseEvent.shiftKey, opt_mouseEvent.button]); } else { // Launch came from 'command' event from elsewhere in UI. - chrome.send('launchApp', [appId, left, top, width, height, + chrome.send('launchApp', [appId, String(getAppLaunchType()), + left, top, width, height, false /* altKey */, false /* ctrlKey */, false /* metaKey */, false /* shiftKey */, 0 /* button */]); } } + function isAppsMenu(node) { + return node.id == 'apps-menu'; + } + + function getAppLaunchType() { + // We determine if the apps section is maximized, collapsed or in menu mode + // based on the class of the apps section. + if ($('apps').classList.contains('menu')) + return APP_LAUNCH.NTP_APPS_MENU; + else if ($('apps').classList.contains('collapsed')) + return APP_LAUNCH.NTP_APPS_COLLAPSED; + else + return APP_LAUNCH.NTP_APPS_MAXIMIZED; + } + /** * @this {!HTMLAnchorElement} */ @@ -604,7 +615,8 @@ var apps = (function() { var a = div.firstChild; a.onclick = handleClick; - a.setAttribute('ping', PING_APP_LAUNCH_PREFIX + '+' + this.showPromo); + a.setAttribute('ping', + getAppPingUrl('PING_BY_ID', this.showPromo, 'NTP_APPS_MAXIMIZED')); a.style.backgroundImage = url(app['icon_big']); if (hashParams['app-id'] == app['id']) { div.setAttribute('new', 'new'); @@ -644,7 +656,8 @@ var apps = (function() { a.textContent = app['name']; a.href = app['launch_url']; a.onclick = handleClick; - a.setAttribute('ping', PING_APP_LAUNCH_PREFIX + '+' + this.showPromo); + a.setAttribute('ping', + getAppPingUrl('PING_BY_ID', this.showPromo, 'NTP_APPS_COLLAPSED')); a.style.backgroundImage = url(app['icon_small']); a.className = 'item'; span.appendChild(a); @@ -660,7 +673,8 @@ var apps = (function() { a.textContent = app['name']; a.href = app['launch_url']; a.onclick = handleClick; - a.setAttribute('ping', PING_APP_LAUNCH_PREFIX + '+' + this.showPromo); + a.setAttribute('ping', + getAppPingUrl('PING_BY_ID', this.showPromo, 'NTP_APPS_MENU')); a.style.backgroundImage = url(app['icon_small']); a.className = 'item'; diff --git a/chrome/browser/resources/ntp/most_visited.js b/chrome/browser/resources/ntp/most_visited.js index 183ad20..5ea73c6 100644 --- a/chrome/browser/resources/ntp/most_visited.js +++ b/chrome/browser/resources/ntp/most_visited.js @@ -571,6 +571,8 @@ var MostVisited = (function() { t.tabIndex = 1; t.href = d.url; + t.setAttribute('ping', + getAppPingUrl('PING_BY_URL', d.url, 'NTP_MOST_VISITED')); t.querySelector('.pin').title = localStrings.getString(d.pinned ? 'unpinthumbnailtooltip' : 'pinthumbnailtooltip'); t.querySelector('.remove').title = @@ -602,6 +604,8 @@ var MostVisited = (function() { var span = document.createElement('span'); var a = span.appendChild(document.createElement('a')); a.href = item.url; + a.setAttribute('ping', + getAppPingUrl('PING_BY_URL', item.url, 'NTP_MOST_VISITED')); a.textContent = item.title; a.style.backgroundImage = url('chrome://favicon/' + item.url); a.className = 'item'; @@ -616,7 +620,8 @@ var MostVisited = (function() { for (var i = 0, item; item = data[i]; i++) { if (!item.filler) { addClosedMenuEntry( - this.menu, item.url, item.title, 'chrome://favicon/' + item.url); + this.menu, item.url, item.title, 'chrome://favicon/' + item.url, + getAppPingUrl('PING_BY_URL', item.url, 'NTP_MOST_VISITED')); } } addClosedMenuFooter( |