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

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: learn_the_alphabet 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..211842c2f3632d1592559fe9a710ad1a7c912c9b 100644
--- a/chrome/browser/resources/md_history/history_item.js
+++ b/chrome/browser/resources/md_history/history_item.js
@@ -32,6 +32,8 @@ cr.define('md_history', function() {
// The path of this history item inside its parent.
path: String,
+
+ index: Number,
},
/**
@@ -70,8 +72,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);
},
@@ -82,6 +86,7 @@ cr.define('md_history', function() {
onMenuButtonTap_: function(e) {
this.fire('toggle-menu', {
target: Polymer.dom(e).localTarget,
+ index: this.index,
item: this.item,
path: this.path,
});
@@ -91,6 +96,35 @@ 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');
+
+ if (this.searchTerm)
+ browserService.recordAction('SearchResultClick');
+
+ if (this.index == undefined)
+ return;
+
+ browserService.recordHistogram(
+ 'HistoryPage.ClickPosition', this.index, UMA_MAX_BUCKET_VALUE);
+
+ if (this.index <= UMA_MAX_SUBSET_BUCKET_VALUE) {
+ browserService.recordHistogram(
+ 'HistoryPage.ClickPositionSubset', this.index,
+ UMA_MAX_SUBSET_BUCKET_VALUE);
+ }
+ },
+
+ onLinkRightClick_: function() {
+ md_history.BrowserService.getInstance().recordAction(
+ 'EntryLinkRightClick');
+ },
+
+ /**
* Set the favicon image, based on the URL of the history item.
* @private
*/
« no previous file with comments | « chrome/browser/resources/md_history/history_item.html ('k') | chrome/browser/resources/md_history/history_list.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698