Chromium Code Reviews

Unified Diff: chrome/browser/resources/new_new_tab.js

Issue 4708002: Add a histogram for tracking web store promo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: incorporate feedback Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: chrome/browser/resources/new_new_tab.js
diff --git a/chrome/browser/resources/new_new_tab.js b/chrome/browser/resources/new_new_tab.js
index 6b3be4ad5560bb9e2ead69d5f11da662574cb817..77bf754c4a47bfa562f460b8a2095a077de817f3 100644
--- a/chrome/browser/resources/new_new_tab.js
+++ b/chrome/browser/resources/new_new_tab.js
@@ -908,6 +908,13 @@ function handleIfEnterKey(f) {
};
}
+function handleIfMiddleClick(f) {
+ return function(e) {
+ if (e.button == 1)
+ f(e);
+ };
+}
+
function maybeReopenTab(e) {
var el = findAncestor(e.target, function(el) {
return el.sessionId !== undefined;
@@ -1202,12 +1209,20 @@ function isDoneLoading() {
return !document.body.classList.contains('loading');
}
+function recordWebStoreLaunch() {
+ chrome.send('recordWebStoreLaunch', []);
+}
+
// Initialize the apps promo.
document.addEventListener('DOMContentLoaded', function() {
var promoText1 = $('apps-promo-text1');
promoText1.innerHTML = promoText1.textContent;
promoText1.querySelector('a').href = localStrings.getString('web_store_url');
+ var promoLink = promoText1.querySelector('a');
+ promoLink.onclick = recordWebStoreLaunch;
+ promoLink.onmousedown = handleIfMiddleClick(recordWebStoreLaunch);
+
$('apps-promo-hide').addEventListener('click', function() {
chrome.send('hideAppsPromo', []);
document.documentElement.classList.remove('apps-promo-visible');

Powered by Google App Engine