OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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('ntp4', function() { | 5 cr.define('ntp4', function() { |
6 'use strict'; | 6 'use strict'; |
7 | 7 |
8 var TilePage = ntp4.TilePage; | 8 var TilePage = ntp4.TilePage; |
9 | 9 |
10 /** | 10 /** |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 '<div class="thumbnail-shield fills-parent"></div>' + | 57 '<div class="thumbnail-shield fills-parent"></div>' + |
58 '</span>' + | 58 '</span>' + |
59 '<span class="favicon"></span>' + | 59 '<span class="favicon"></span>' + |
60 '</span>' + | 60 '</span>' + |
61 '<div class="color-stripe"></div>' + | 61 '<div class="color-stripe"></div>' + |
62 '<span class="title"></span>'; | 62 '<span class="title"></span>'; |
63 | 63 |
64 this.removeAttribute('tabIndex'); | 64 this.removeAttribute('tabIndex'); |
65 this.data_ = null; | 65 this.data_ = null; |
66 this.removeAttribute('id'); | 66 this.removeAttribute('id'); |
| 67 this.title = ''; |
67 }, | 68 }, |
68 | 69 |
69 /** | 70 /** |
70 * Update the appearance of this tile according to |data|. | 71 * Update the appearance of this tile according to |data|. |
71 * @param {Object} data A dictionary of relevant data for the page. | 72 * @param {Object} data A dictionary of relevant data for the page. |
72 */ | 73 */ |
73 updateForData: function(data) { | 74 updateForData: function(data) { |
74 if (this.classList.contains('blacklisted') && data) { | 75 if (this.classList.contains('blacklisted') && data) { |
75 // Animate appearance of new tile. | 76 // Animate appearance of new tile. |
76 this.classList.add('new-tile-contents'); | 77 this.classList.add('new-tile-contents'); |
(...skipping 19 matching lines...) Expand all Loading... |
96 faviconDiv.dir = data.direction; | 97 faviconDiv.dir = data.direction; |
97 if (data.faviconDominantColor) | 98 if (data.faviconDominantColor) |
98 this.stripeColor = data.faviconDominantColor; | 99 this.stripeColor = data.faviconDominantColor; |
99 else | 100 else |
100 chrome.send('getFaviconDominantColor', [faviconUrl, this.id]); | 101 chrome.send('getFaviconDominantColor', [faviconUrl, this.id]); |
101 | 102 |
102 var title = this.querySelector('.title'); | 103 var title = this.querySelector('.title'); |
103 title.textContent = data.title; | 104 title.textContent = data.title; |
104 title.dir = data.direction; | 105 title.dir = data.direction; |
105 | 106 |
| 107 // Sets the tooltip. |
| 108 this.title = data.title; |
| 109 |
106 var thumbnailUrl = data.thumbnailUrl || 'chrome://thumb/' + data.url; | 110 var thumbnailUrl = data.thumbnailUrl || 'chrome://thumb/' + data.url; |
107 this.querySelector('.thumbnail').style.backgroundImage = | 111 this.querySelector('.thumbnail').style.backgroundImage = |
108 url(thumbnailUrl); | 112 url(thumbnailUrl); |
109 | 113 |
110 this.href = data.url; | 114 this.href = data.url; |
111 | 115 |
112 this.classList.remove('filler'); | 116 this.classList.remove('filler'); |
113 }, | 117 }, |
114 | 118 |
115 /** | 119 /** |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 } | 414 } |
411 | 415 |
412 return oldData; | 416 return oldData; |
413 }; | 417 }; |
414 | 418 |
415 return { | 419 return { |
416 MostVisitedPage: MostVisitedPage, | 420 MostVisitedPage: MostVisitedPage, |
417 refreshData: refreshData, | 421 refreshData: refreshData, |
418 }; | 422 }; |
419 }); | 423 }); |
OLD | NEW |