diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-04-05 14:08:31 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-04-11 07:46:53 +0000 |
commit | 6a4cabb866f66d4128a97cdc6d9d08ce074f1247 (patch) | |
tree | ab00f70a5e89278d6a0d16ff0c42578dc4d84a2d /chromium/chrome/browser/resources/local_ntp/most_visited_single.js | |
parent | e733310db58160074f574c429d48f8308c0afe17 (diff) |
BASELINE: Update Chromium to 57.0.2987.144
Change-Id: I29db402ff696c71a04c4dbaec822c2e53efe0267
Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
Diffstat (limited to 'chromium/chrome/browser/resources/local_ntp/most_visited_single.js')
-rw-r--r-- | chromium/chrome/browser/resources/local_ntp/most_visited_single.js | 38 |
1 files changed, 11 insertions, 27 deletions
diff --git a/chromium/chrome/browser/resources/local_ntp/most_visited_single.js b/chromium/chrome/browser/resources/local_ntp/most_visited_single.js index f08b0cec42c..aba6f846b8b 100644 --- a/chromium/chrome/browser/resources/local_ntp/most_visited_single.js +++ b/chromium/chrome/browser/resources/local_ntp/most_visited_single.js @@ -23,13 +23,15 @@ var LOG_TYPE = { /** * The different sources that an NTP tile can have. - * Note: Keep in sync with common/ntp_logging_events.h + * Note: Keep in sync with components/ntp_tiles/ntp_tile_source.h * @enum {number} * @const */ -var NTPLoggingTileSource = { - CLIENT: 0, - SERVER: 1, +var NTPTileSource = { + TOP_SITES: 0, + SUGGESTIONS_SERVICE: 1, + POPULAR: 3, + WHITELIST: 4, }; @@ -83,11 +85,6 @@ var tiles = null; */ var queryArgs = {}; -/** - * Url to ping when suggestions have been shown. - */ -var impressionUrl = null; - /** * Log an event on the NTP. @@ -100,7 +97,7 @@ var logEvent = function(eventType) { /** * Log impression of an NTP tile. * @param {number} tileIndex Position of the tile, >= 0 and < NUMBER_OF_TILES. - * @param {number} tileSource The source from NTPLoggingTileSource. + * @param {number} tileSource The source from NTPTileSource. */ function logMostVisitedImpression(tileIndex, tileSource) { chrome.embeddedSearch.newTabPage.logMostVisitedImpression(tileIndex, @@ -110,7 +107,7 @@ function logMostVisitedImpression(tileIndex, tileSource) { /** * Log click on an NTP tile. * @param {number} tileIndex Position of the tile, >= 0 and < NUMBER_OF_TILES. - * @param {number} tileSource The source from NTPLoggingTileSource. + * @param {number} tileSource The source from NTPTileSource. */ function logMostVisitedNavigation(tileIndex, tileSource) { chrome.embeddedSearch.newTabPage.logMostVisitedNavigation(tileIndex, @@ -279,11 +276,6 @@ var showTiles = function() { // Make sure the tiles variable contain the next tileset we may use. tiles = document.createElement('div'); - - if (impressionUrl) { - navigator.sendBeacon(impressionUrl); - impressionUrl = null; - } }; @@ -296,12 +288,12 @@ var showTiles = function() { var addTile = function(args) { if (isFinite(args.rid)) { // If a valid number passed in |args.rid|: a local chrome suggestion. - var data = chrome.embeddedSearch.searchBox.getMostVisitedItemData(args.rid); + var data = + chrome.embeddedSearch.newTabPage.getMostVisitedItemData(args.rid); if (!data) return; data.tid = data.rid; - data.tileSource = NTPLoggingTileSource.CLIENT; if (!data.faviconUrl) { data.faviconUrl = 'chrome-search://favicon/size/16@' + window.devicePixelRatio + 'x/' + data.renderViewId + '/' + data.tid; @@ -309,7 +301,7 @@ var addTile = function(args) { tiles.appendChild(renderTile(data)); } else if (args.url) { // If a URL is passed: a server-side suggestion. - args.tileSource = NTPLoggingTileSource.SERVER; + args.tileSource = NTPTileSource.SUGGESTIONS_SERVICE; // check sanity of the arguments if (/^javascript:/i.test(args.url) || /^javascript:/i.test(args.thumbnailUrl)) @@ -382,14 +374,6 @@ var renderTile = function(data) { } tile.setAttribute('aria-label', data.title); tile.title = data.title; - if (data.impressionUrl) { - impressionUrl = data.impressionUrl; - } - if (data.pingUrl) { - tile.addEventListener('click', function(ev) { - navigator.sendBeacon(data.pingUrl); - }); - } tile.addEventListener('click', function(ev) { logMostVisitedNavigation(position, data.tileSource); |