OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 cr.define('ntp', function() { | 5 cr.define('ntp', function() { |
6 'use strict'; | 6 'use strict'; |
7 | 7 |
8 var Tile = ntp.Tile; | 8 var Tile = ntp.Tile; |
9 var TilePage = ntp.TilePage; | 9 var TilePage = ntp.TilePage; |
10 | 10 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 84 |
85 var thumbnailImage = this.querySelector('.thumbnail-image'); | 85 var thumbnailImage = this.querySelector('.thumbnail-image'); |
86 | 86 |
87 var banner = thumbnailImage.querySelector('.thumbnail-banner'); | 87 var banner = thumbnailImage.querySelector('.thumbnail-banner'); |
88 if (banner) | 88 if (banner) |
89 thumbnailImage.removeChild(banner); | 89 thumbnailImage.removeChild(banner); |
90 | 90 |
91 var favicon = this.querySelector('.thumbnail-favicon') || | 91 var favicon = this.querySelector('.thumbnail-favicon') || |
92 this.ownerDocument.createElement('div'); | 92 this.ownerDocument.createElement('div'); |
93 favicon.className = 'thumbnail-favicon'; | 93 favicon.className = 'thumbnail-favicon'; |
94 favicon.style.backgroundImage = url(getFaviconUrl(dataUrl)); | 94 favicon.style.backgroundImage = getFaviconImageSet(dataUrl); |
95 this.appendChild(favicon); | 95 this.appendChild(favicon); |
96 | 96 |
97 var self = this; | 97 var self = this; |
98 var image = new Image(); | 98 var image = new Image(); |
99 | 99 |
100 // If the thumbnail image fails to load, show an alternative presentation. | 100 // If the thumbnail image fails to load, show an alternative presentation. |
101 // TODO(jeremycho): Move to a separate function? | 101 // TODO(jeremycho): Move to a separate function? |
102 image.onerror = function() { | 102 image.onerror = function() { |
103 banner = thumbnailImage.querySelector('.thumbnail-banner') || | 103 banner = thumbnailImage.querySelector('.thumbnail-banner') || |
104 self.ownerDocument.createElement('div'); | 104 self.ownerDocument.createElement('div'); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 shouldAcceptDrag: function(e) { | 173 shouldAcceptDrag: function(e) { |
174 return false; | 174 return false; |
175 }, | 175 }, |
176 }; | 176 }; |
177 | 177 |
178 return { | 178 return { |
179 Thumbnail: Thumbnail, | 179 Thumbnail: Thumbnail, |
180 ThumbnailPage: ThumbnailPage, | 180 ThumbnailPage: ThumbnailPage, |
181 }; | 181 }; |
182 }); | 182 }); |
OLD | NEW |