| 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..993b67efeed9d95c9769850098d0ed596407a3f4 100644
|
| --- a/chrome/browser/resources/local_ntp/most_visited_util.js
|
| +++ b/chrome/browser/resources/local_ntp/most_visited_util.js
|
| @@ -36,6 +36,12 @@ var NTP_LOGGING_EVENT_TYPE = {
|
| NTP_EXTERNAL_TILE: 7
|
| };
|
|
|
| +/** @type {string} Indicating the suggestion came from the server. */
|
| +var SERVER_PROVIDER = 'server';
|
| +
|
| +/** @type {string} Indicating the suggestions came from the client. */
|
| +var CLIENT_PROVIDER = 'client';
|
| +
|
| /**
|
| * Parses query parameters from Location.
|
| * @param {string} location The URL to generate the CSS url for.
|
| @@ -70,9 +76,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 +91,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 +173,7 @@ function fillMostVisited(location, fill) {
|
| data.direction = params.di || '';
|
| data.domain = params.dom || '';
|
| data.ping = params.ping || '';
|
| + data.provider = params.pr || SERVER_PROVIDER;
|
| // 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);
|
| @@ -170,11 +182,13 @@ function fillMostVisited(location, fill) {
|
| data = apiHandle.getMostVisitedItemData(params.rid);
|
| if (!data)
|
| return;
|
| + data.provider = CLIENT_PROVIDER;
|
| delete data.ping;
|
| }
|
| if (/^javascript:/i.test(data.url) ||
|
| /^javascript:/i.test(data.thumbnailUrl) ||
|
| - /^javascript:/i.test(data.thumbnailUrl2))
|
| + /^javascript:/i.test(data.thumbnailUrl2) ||
|
| + !/^[a-z0-9]{0,8}$/i.test(data.provider))
|
| return;
|
| if (data.direction)
|
| document.body.dir = data.direction;
|
|
|