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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
44 // thumbnail errors. The backup thumbnail is always preloaded so that the | 44 // thumbnail errors. The backup thumbnail is always preloaded so that the |
45 // server can't gain knowledge on the local thumbnail DB by specifying a | 45 // server can't gain knowledge on the local thumbnail DB by specifying a |
46 // second URL that is only sometimes fetched. | 46 // second URL that is only sometimes fetched. |
47 if (data.thumbnailUrl2) { | 47 if (data.thumbnailUrl2) { |
48 var image2 = createAndAppendThumbnail(false); | 48 var image2 = createAndAppendThumbnail(false); |
49 image2.onerror = showDomainElement; | 49 image2.onerror = showDomainElement; |
50 image2.src = data.thumbnailUrl2; | 50 image2.src = data.thumbnailUrl2; |
51 // The first thumbnail's onerror function will swap the visibility of | 51 // The first thumbnail's onerror function will swap the visibility of |
52 // the two thumbnails. | 52 // the two thumbnails. |
53 image.onerror = function() { | 53 image.onerror = function() { |
54 logEvent(NTP_LOGGING_EVENT_TYPE.NTP_THUMBNAIL_FALLBACK); | |
Mathieu
2013/09/03 21:40:23
NTP_FALLBACK_THUMBNAIL_USED?
beaudoin
2013/09/03 22:34:55
Done.
| |
54 image.style.visibility = 'hidden'; | 55 image.style.visibility = 'hidden'; |
55 image2.style.visibility = 'visible'; | 56 image2.style.visibility = 'visible'; |
56 }; | 57 }; |
58 logEvent(NTP_LOGGING_EVENT_TYPE.NTP_THUMBNAIL_WITH_FALLBACK_ATTEMPT); | |
Mathieu
2013/09/03 21:40:23
nit: NTP_FALLBACK_THUMBNAIL_REQUESTED to be closer
beaudoin
2013/09/03 22:34:55
Done.
| |
57 } else { | 59 } else { |
58 image.onerror = showDomainElement; | 60 image.onerror = showDomainElement; |
59 } | 61 } |
60 image.src = data.thumbnailUrl; | 62 image.src = data.thumbnailUrl; |
61 logEvent(NTP_LOGGING_EVENT_TYPE.NTP_THUMBNAIL_ATTEMPT); | 63 logEvent(NTP_LOGGING_EVENT_TYPE.NTP_THUMBNAIL_ATTEMPT); |
62 } else { | 64 } else { |
63 showDomainElement(); | 65 showDomainElement(); |
64 } | 66 } |
65 }); | 67 }); |
66 }); | 68 }); |
OLD | NEW |