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 TilePage = ntp.TilePage; | 8 var TilePage = ntp.TilePage; |
9 | 9 |
10 /** | 10 /** |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 this.reset(); | 87 this.reset(); |
88 return; | 88 return; |
89 } | 89 } |
90 | 90 |
91 var id = tileID++; | 91 var id = tileID++; |
92 this.id = 'most-visited-tile-' + id; | 92 this.id = 'most-visited-tile-' + id; |
93 this.data_ = data; | 93 this.data_ = data; |
94 this.classList.add('focusable'); | 94 this.classList.add('focusable'); |
95 | 95 |
96 var faviconDiv = this.querySelector('.favicon'); | 96 var faviconDiv = this.querySelector('.favicon'); |
97 var faviconUrl = getFaviconUrl(data.url); | 97 faviconDiv.style.backgroundImage = getFaviconImageSet(data.url); |
98 faviconDiv.style.backgroundImage = url(faviconUrl); | 98 |
99 chrome.send('getFaviconDominantColor', [faviconUrl, this.id]); | 99 // The favicon should have the same dominant color regardless of the |
| 100 // device pixel ratio the favicon is requested for. |
| 101 chrome.send('getFaviconDominantColor', |
| 102 [getFaviconUrlForCurrentDevicePixelRatio(data.url), this.id]); |
100 | 103 |
101 var title = this.querySelector('.title'); | 104 var title = this.querySelector('.title'); |
102 title.textContent = data.title; | 105 title.textContent = data.title; |
103 title.dir = data.direction; | 106 title.dir = data.direction; |
104 | 107 |
105 // Sets the tooltip. | 108 // Sets the tooltip. |
106 this.title = data.title; | 109 this.title = data.title; |
107 | 110 |
108 var thumbnailUrl = 'chrome://thumb/' + data.url; | 111 var thumbnailUrl = 'chrome://thumb/' + data.url; |
109 this.querySelector('.thumbnail').style.backgroundImage = | 112 this.querySelector('.thumbnail').style.backgroundImage = |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 return oldData; | 465 return oldData; |
463 }; | 466 }; |
464 | 467 |
465 return { | 468 return { |
466 MostVisitedPage: MostVisitedPage, | 469 MostVisitedPage: MostVisitedPage, |
467 refreshData: refreshData, | 470 refreshData: refreshData, |
468 }; | 471 }; |
469 }); | 472 }); |
470 | 473 |
471 document.addEventListener('ntpLoaded', ntp.MostVisitedPage.onLoaded); | 474 document.addEventListener('ntpLoaded', ntp.MostVisitedPage.onLoaded); |
OLD | NEW |