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} |
*/ |