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

Unified Diff: chrome/browser/resources/md_history/history_item.js

Issue 2255033002: [MD History] Copy stats from the old history page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@sidebar_stats
Patch Set: rebase Created 4 years, 4 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/md_history/history_item.js
diff --git a/chrome/browser/resources/md_history/history_item.js b/chrome/browser/resources/md_history/history_item.js
index b6b6603dfd28f920c4b07f74edfe8b5a1e6d983c..6a62ff7250b101e56868ab5d37f7b53d97a307cc 100644
--- a/chrome/browser/resources/md_history/history_item.js
+++ b/chrome/browser/resources/md_history/history_item.js
@@ -70,8 +70,10 @@ cr.define('md_history', function() {
if (this.$$('#bookmark-star') == this.root.activeElement)
this.$['menu-button'].focus();
- md_history.BrowserService.getInstance()
- .removeBookmark(this.item.url);
+ var browserService = md_history.BrowserService.getInstance();
+ browserService.removeBookmark(this.item.url);
+ browserService.recordAction('BookmarkStarClicked');
+
this.fire('remove-bookmark-stars', this.item.url);
},
@@ -91,6 +93,31 @@ cr.define('md_history', function() {
},
/**
+ * Record metrics when a result is clicked. This is deliberately tied to
+ * on-click rather than on-tap, as on-click triggers from middle clicks.
+ */
+ onLinkClick_: function() {
+ var browserService = md_history.BrowserService.getInstance();
+ browserService.recordAction('EntryLinkClick');
+ browserService.recordHistogram(
+ 'HistoryPage.ClickPosition', this.item.index, UMA_MAX_BUCKET_VALUE);
+
+ if (this.item.index <= UMA_MAX_SUBSET_BUCKET_VALUE) {
+ browserService.recordHistogram(
+ 'HistoryPage.ClickPositionSubset', this.item.index,
+ UMA_MAX_SUBSET_BUCKET_VALUE);
+ }
+
+ if (this.searchTerm)
+ browserService.recordAction('SearchResultClick');
+ },
+
+ onLinkRightClick_: function() {
+ md_history.BrowserService.getInstance().recordAction(
+ 'EntryLinkRightClick');
+ },
+
+ /**
* Set the favicon image, based on the URL of the history item.
* @private
*/

Powered by Google App Engine
This is Rietveld 408576698