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

Unified Diff: chrome/browser/resources/ntp4/apps_page.js

Issue 9254023: [NTP4] Track the position of each app that's launched. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/ntp4/apps_page.js
diff --git a/chrome/browser/resources/ntp4/apps_page.js b/chrome/browser/resources/ntp4/apps_page.js
index 0cf06dafdc84fa1fc64af8a99de6eaab24351b2e..88d636d414e148c1bf1072d5359b967f699d8378 100644
--- a/chrome/browser/resources/ntp4/apps_page.js
+++ b/chrome/browser/resources/ntp4/apps_page.js
@@ -475,6 +475,7 @@ cr.define('ntp4', function() {
'utm_source',
'chrome-ntp-icon');
+ this.recordAppClickIndex_(this.tile.index);
chrome.send('launchApp',
[this.appId, APP_LAUNCH.NTP_APPS_MAXIMIZED, url,
e.button, e.altKey, e.ctrlKey, e.metaKey, e.shiftKey]);
@@ -490,6 +491,7 @@ cr.define('ntp4', function() {
*/
onKeydown_: function(e) {
if (e.keyIdentifier == 'Enter') {
+ this.recordAppClickIndex_(this.tile.index);
chrome.send('launchApp',
[this.appId, APP_LAUNCH.NTP_APPS_MAXIMIZED, '',
0, e.altKey, e.ctrlKey, e.metaKey, e.shiftKey]);
@@ -499,6 +501,16 @@ cr.define('ntp4', function() {
},
/**
+ * Record app position "clicked" (or when a user presses Enter on an app
kmadhusu 2012/01/19 18:29:03 nit: "Enter"
Dan Beam 2012/01/19 19:47:24 Why double quotes (from style guide: Use single qu
kmadhusu 2012/01/19 20:27:21 I thought it would be a good idea to emphasis on "
Dan Beam 2012/01/19 22:29:21 Done. (was just wondering why, :)
+ * using keyboard nav).
+ * @param {number} index The clicked index to record.
kmadhusu 2012/01/19 18:29:03 nit: @private
Dan Beam 2012/01/19 19:47:24 Done.
+ */
+ recordAppClickIndex_: function(index) {
+ chrome.send('metricsHandler:recordInHistogram',
+ ['NewTabPage.AppClickIndex', index + 1, 100]);
Dan Beam 2012/01/19 08:18:14 ^ I just put 100 as a semi-arbitrary number, thoug
kmadhusu 2012/01/19 18:29:03 Add this comment in the code for future references
kmadhusu 2012/01/19 18:29:03 Can you declare a constant for this magic number?
kmadhusu 2012/01/19 18:29:03 Why do you want to record the app clicked position
Dan Beam 2012/01/19 19:47:24 Done.
Dan Beam 2012/01/19 19:47:24 Done.
Dan Beam 2012/01/19 19:47:24 From the bug: Ideally segmented by position (simil
+ },
+
+ /**
* Adds a node to the list of targets that will launch the app. This list
* is also used in onMousedown to determine whether the app contents should
* be shown as active (if we don't do this, then clicking anywhere in
« no previous file with comments | « no previous file | chrome/browser/resources/ntp4/most_visited_page.js » ('j') | chrome/browser/resources/ntp4/most_visited_page.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698