| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 | 5 |
| 6 /** | 6 /** |
| 7 * @fileoverview Rendering for iframed most visited thumbnails. | 7 * @fileoverview Rendering for iframed most visited thumbnails. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 window.addEventListener('DOMContentLoaded', function() { | 10 window.addEventListener('DOMContentLoaded', function() { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 params, data.url, data.title, undefined, data.direction, | 38 params, data.url, data.title, undefined, data.direction, |
| 39 data.provider)); | 39 data.provider)); |
| 40 } | 40 } |
| 41 // Creates and adds an image. | 41 // Creates and adds an image. |
| 42 function createThumbnail(src) { | 42 function createThumbnail(src) { |
| 43 var image = document.createElement('img'); | 43 var image = document.createElement('img'); |
| 44 image.onload = function() { | 44 image.onload = function() { |
| 45 var link = createMostVisitedLink( | 45 var link = createMostVisitedLink( |
| 46 params, data.url, data.title, undefined, data.direction, | 46 params, data.url, data.title, undefined, data.direction, |
| 47 data.provider); | 47 data.provider); |
| 48 // Use blocker to prevent context menu from showing image-related items. |
| 49 var blocker = document.createElement('span'); |
| 50 blocker.className = 'blocker'; |
| 51 link.appendChild(blocker); |
| 48 link.appendChild(image); | 52 link.appendChild(image); |
| 49 displayLink(link); | 53 displayLink(link); |
| 50 }; | 54 }; |
| 51 image.onerror = function() { | 55 image.onerror = function() { |
| 52 // If no external thumbnail fallback (etfb), and have domain. | 56 // If no external thumbnail fallback (etfb), and have domain. |
| 53 if (!params.etfb && data.domain) { | 57 if (!params.etfb && data.domain) { |
| 54 showDomainElement(); | 58 showDomainElement(); |
| 55 logEvent(NTP_LOGGING_EVENT_TYPE.NTP_GRAY_TILE_FALLBACK); | 59 logEvent(NTP_LOGGING_EVENT_TYPE.NTP_GRAY_TILE_FALLBACK); |
| 56 } else { | 60 } else { |
| 57 showEmptyTile(); | 61 showEmptyTile(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 73 logEvent(NTP_LOGGING_EVENT_TYPE.NTP_EXTERNAL_TILE); | 77 logEvent(NTP_LOGGING_EVENT_TYPE.NTP_EXTERNAL_TILE); |
| 74 } | 78 } |
| 75 logEvent(NTP_LOGGING_EVENT_TYPE.NTP_TILE); | 79 logEvent(NTP_LOGGING_EVENT_TYPE.NTP_TILE); |
| 76 | 80 |
| 77 // Log an impression if we know the position of the tile. | 81 // Log an impression if we know the position of the tile. |
| 78 if (isFinite(params.pos) && data.provider) { | 82 if (isFinite(params.pos) && data.provider) { |
| 79 logMostVisitedImpression(parseInt(params.pos, 10), data.provider); | 83 logMostVisitedImpression(parseInt(params.pos, 10), data.provider); |
| 80 } | 84 } |
| 81 }); | 85 }); |
| 82 }); | 86 }); |
| OLD | NEW |