| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 image.src = src; | 71 image.src = src; |
| 72 } | 72 } |
| 73 | 73 |
| 74 var useIcons = params['icons'] == '1'; | 74 var useIcons = params['icons'] == '1'; |
| 75 if (data.dummy) { | 75 if (data.dummy) { |
| 76 showEmptyTile(); | 76 showEmptyTile(); |
| 77 logEvent(NTP_LOGGING_EVENT_TYPE.NTP_EXTERNAL_TILE); | 77 logEvent(NTP_LOGGING_EVENT_TYPE.NTP_EXTERNAL_TILE); |
| 78 } else if (useIcons && data.largeIconUrl) { | 78 } else if (useIcons && data.largeIconUrl) { |
| 79 createThumbnail(data.largeIconUrl, 'large-icon'); | 79 createThumbnail(data.largeIconUrl, 'large-icon'); |
| 80 // TODO(huangs): Log event for large icons. | 80 // TODO(huangs): Log event for large icons. |
| 81 } else if (!useIcons && data.thumbnailUrl) { | 81 } else if (!useIcons && data.thumbnailUrls && data.thumbnailUrls.length) { |
| 82 createThumbnail(data.thumbnailUrl, 'thumbnail'); | 82 createThumbnail(data.thumbnailUrls[0], 'thumbnail'); |
| 83 logEvent(NTP_LOGGING_EVENT_TYPE.NTP_THUMBNAIL_TILE); | 83 logEvent(NTP_LOGGING_EVENT_TYPE.NTP_THUMBNAIL_TILE); |
| 84 } else if (data.domain) { | 84 } else if (data.domain) { |
| 85 showDomainElement(); | 85 showDomainElement(); |
| 86 logEvent(NTP_LOGGING_EVENT_TYPE.NTP_GRAY_TILE); | 86 logEvent(NTP_LOGGING_EVENT_TYPE.NTP_GRAY_TILE); |
| 87 } else { | 87 } else { |
| 88 showEmptyTile(); | 88 showEmptyTile(); |
| 89 logEvent(NTP_LOGGING_EVENT_TYPE.NTP_EXTERNAL_TILE); | 89 logEvent(NTP_LOGGING_EVENT_TYPE.NTP_EXTERNAL_TILE); |
| 90 } | 90 } |
| 91 logEvent(NTP_LOGGING_EVENT_TYPE.NTP_TILE); | 91 logEvent(NTP_LOGGING_EVENT_TYPE.NTP_TILE); |
| 92 | 92 |
| 93 // Log an impression if we know the position of the tile. | 93 // Log an impression if we know the position of the tile. |
| 94 if (isFinite(params.pos) && data.provider) { | 94 if (isFinite(params.pos) && data.provider) { |
| 95 logMostVisitedImpression(parseInt(params.pos, 10), data.provider); | 95 logMostVisitedImpression(parseInt(params.pos, 10), data.provider); |
| 96 } | 96 } |
| 97 }); | 97 }); |
| 98 }); | 98 }); |
| OLD | NEW |