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 chrome.send('getFaviconDominantColor', |
99 chrome.send('getFaviconDominantColor', [faviconUrl, this.id]); | 99 [get1xFaviconUrl(data.url), this.id]); |
100 | 100 |
101 var title = this.querySelector('.title'); | 101 var title = this.querySelector('.title'); |
102 title.textContent = data.title; | 102 title.textContent = data.title; |
103 title.dir = data.direction; | 103 title.dir = data.direction; |
104 | 104 |
105 // Sets the tooltip. | 105 // Sets the tooltip. |
106 this.title = data.title; | 106 this.title = data.title; |
107 | 107 |
108 var thumbnailUrl = 'chrome://thumb/' + data.url; | 108 var thumbnailUrl = 'chrome://thumb/' + data.url; |
109 this.querySelector('.thumbnail').style.backgroundImage = | 109 this.querySelector('.thumbnail').style.backgroundImage = |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 return oldData; | 462 return oldData; |
463 }; | 463 }; |
464 | 464 |
465 return { | 465 return { |
466 MostVisitedPage: MostVisitedPage, | 466 MostVisitedPage: MostVisitedPage, |
467 refreshData: refreshData, | 467 refreshData: refreshData, |
468 }; | 468 }; |
469 }); | 469 }); |
470 | 470 |
471 document.addEventListener('ntpLoaded', ntp.MostVisitedPage.onLoaded); | 471 document.addEventListener('ntpLoaded', ntp.MostVisitedPage.onLoaded); |
OLD | NEW |