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 bd389ae09a9d1efd6521e674bd65aa78c5931bfb..cd95ad47a67d6ddb7b819d83d89053d237bf8b68 100644 |
--- a/chrome/browser/resources/local_ntp/most_visited_util.js |
+++ b/chrome/browser/resources/local_ntp/most_visited_util.js |
@@ -70,9 +70,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; |
@@ -82,6 +85,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) { |
@@ -162,6 +167,7 @@ function fillMostVisited(location, fill) { |
data.direction = params.di || ''; |
data.domain = params.dom || ''; |
data.ping = params.ping || ''; |
+ data.provider = params.pr || ''; |
beaudoin
2013/12/12 19:37:21
I suggest:
params.pr || SERVER;
With SERVER bein
Mathieu
2013/12/12 21:39:13
Done.
|
// Log the fact that suggestion was obtained from the server. |
var ntpApiHandle = chrome.embeddedSearch.newTabPage; |
ntpApiHandle.logEvent(NTP_LOGGING_EVENT_TYPE.NTP_SERVER_SIDE_SUGGESTION); |
@@ -174,7 +180,8 @@ function fillMostVisited(location, fill) { |
} |
if (/^javascript:/i.test(data.url) || |
/^javascript:/i.test(data.thumbnailUrl) || |
- /^javascript:/i.test(data.thumbnailUrl2)) |
+ /^javascript:/i.test(data.thumbnailUrl2) || |
+ (data.provider && !/^[a-z0-9]{0,8}$/i.test(data.provider))) |
return; |
if (data.direction) |
document.body.dir = data.direction; |