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

Unified Diff: chrome/browser/resources/local_ntp/most_visited_util.js

Issue 111423005: [Most Visited] Log suggestion provider to UMA (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase? Created 7 years 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/local_ntp/most_visited_util.js
diff --git a/chrome/browser/resources/local_ntp/most_visited_util.js b/chrome/browser/resources/local_ntp/most_visited_util.js
index 75871b3915e9c7c26c82c6801f9c70ce529154c4..5a17fbd10bfff9b4e35d23d64c78312cf3c70ac5 100644
--- a/chrome/browser/resources/local_ntp/most_visited_util.js
+++ b/chrome/browser/resources/local_ntp/most_visited_util.js
@@ -84,9 +84,12 @@ function parseQueryParams(location) {
* @param {string|undefined} ping If specified, a location relative to the
* referrer of this iframe, to ping when the link is clicked. Only works if
* the referrer is HTTPS.
+ * @param {string|undefined} provider A provider name (max 8 alphanumeric
+ * characters) used for logging. Undefined if suggestion is not coming from
+ * the server.
* @return {HTMLAnchorElement} A new link element.
*/
-function createMostVisitedLink(params, href, title, text, ping) {
+function createMostVisitedLink(params, href, title, text, ping, provider) {
var styles = getMostVisitedStyles(params, !!text);
var link = document.createElement('a');
link.style.color = styles.color;
@@ -96,6 +99,8 @@ function createMostVisitedLink(params, href, title, text, ping) {
link.href = href;
if ('pos' in params && isFinite(params.pos)) {
link.ping = '/log.html?pos=' + params.pos;
+ if (provider)
+ link.ping += '&pr=' + provider;
// If a ping parameter was specified, add it to the list of pings, relative
// to the referrer of this iframe, which is the default search provider.
if (ping) {
@@ -192,7 +197,7 @@ function fillMostVisited(location, fill) {
if (/^javascript:/i.test(data.url) ||
/^javascript:/i.test(data.thumbnailUrl) ||
/^javascript:/i.test(data.thumbnailUrl2) ||
- (data.provider && !/^[a-z0-9]{0,8}$/i.test(data.provider)))
+ !/^[a-z0-9]{0,8}$/i.test(data.provider))
return;
if (data.direction)
document.body.dir = data.direction;
« no previous file with comments | « chrome/browser/resources/local_ntp/most_visited_title.js ('k') | chrome/browser/search/most_visited_iframe_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698