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

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

Issue 9958116: Adds the NewTabPage.SuggestedSitesAction stat. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 8 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
« no previous file with comments | « no previous file | chrome/browser/ui/webui/ntp/suggestions_page_handler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/ntp4/suggestions_page.js
===================================================================
--- chrome/browser/resources/ntp4/suggestions_page.js (revision 131961)
+++ chrome/browser/resources/ntp4/suggestions_page.js (working copy)
@@ -8,6 +8,16 @@
var TilePage = ntp.TilePage;
/**
+ * See description for these values in suggestions_page_handler.h.
+ * @enum {number}
+ */
+ var SuggestedSitesAction = {
+ CLICKED_SUGGESTED_TILE: 11,
+ CLICKED_OTHER_NTP_PANE: 12,
+ OTHER: 13
+ };
+
+ /**
* A counter for generating unique tile IDs.
*/
var tileID = 0;
@@ -134,6 +144,8 @@
// Records the index of this tile.
chrome.send('metricsHandler:recordInHistogram',
['NewTabPage.SuggestedSite', this.index, 8]);
+ chrome.send('suggestedSitesAction',
+ [SuggestedSitesAction.CLICKED_SUGGESTED_TILE]);
}
},
@@ -286,6 +298,9 @@
this.classList.add('suggestions-page');
this.data_ = null;
this.suggestionsTiles_ = this.getElementsByClassName('suggestions real');
+
+ this.addEventListener('carddeselected', this.handleCardDeselected_);
+ this.addEventListener('cardselected', this.handleCardSelected_);
},
/**
@@ -314,6 +329,25 @@
},
/**
+ * Handles the 'card deselected' event (i.e. the user clicked to another
+ * pane).
+ * @param {Event} e The CardChanged event.
+ */
+ handleCardDeselected_: function(e) {
+ chrome.send('suggestedSitesAction',
+ [SuggestedSitesAction.CLICKED_OTHER_NTP_PANE]);
+ },
+
+ /**
+ * Handles the 'card selected' event (i.e. the user clicked to select the
+ * Suggested pane).
+ * @param {Event} e The CardChanged event.
+ */
+ handleCardSelected_: function(e) {
+ chrome.send('suggestedSitesSelected');
+ },
+
+ /**
* Array of suggestions data objects.
* @type {Array}
*/
« no previous file with comments | « no previous file | chrome/browser/ui/webui/ntp/suggestions_page_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698