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 Thumbnail = ntp.Thumbnail; | 8 var Thumbnail = ntp.Thumbnail; |
9 var ThumbnailPage = ntp.ThumbnailPage; | 9 var ThumbnailPage = ntp.ThumbnailPage; |
10 | 10 |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 */ | 204 */ |
205 handleCardSelected_: function(e) { | 205 handleCardSelected_: function(e) { |
206 if (!document.documentElement.classList.contains('starting-up')) | 206 if (!document.documentElement.classList.contains('starting-up')) |
207 chrome.send('mostVisitedSelected'); | 207 chrome.send('mostVisitedSelected'); |
208 }, | 208 }, |
209 | 209 |
210 /** @override */ | 210 /** @override */ |
211 setDataList: function(dataList) { | 211 setDataList: function(dataList) { |
212 var startTime = Date.now(); | 212 var startTime = Date.now(); |
213 ThumbnailPage.prototype.setDataList.apply(this, arguments); | 213 ThumbnailPage.prototype.setDataList.apply(this, arguments); |
| 214 this.updateGrid(); |
214 logEvent('mostVisited.layout: ' + (Date.now() - startTime)); | 215 logEvent('mostVisited.layout: ' + (Date.now() - startTime)); |
215 }, | 216 }, |
216 }; | 217 }; |
217 | 218 |
218 /** | 219 /** |
219 * Executed once the NTP has loaded. Checks if the Most Visited pane is | 220 * Executed once the NTP has loaded. Checks if the Most Visited pane is |
220 * shown or not. If it is shown, the 'mostVisitedSelected' message is sent | 221 * shown or not. If it is shown, the 'mostVisitedSelected' message is sent |
221 * to the C++ code, to record the fact that the user has seen this pane. | 222 * to the C++ code, to record the fact that the user has seen this pane. |
222 */ | 223 */ |
223 MostVisitedPage.onLoaded = function() { | 224 MostVisitedPage.onLoaded = function() { |
224 if (ntp.getCardSlider() && | 225 if (ntp.getCardSlider() && |
225 ntp.getCardSlider().currentCardValue && | 226 ntp.getCardSlider().currentCardValue && |
226 ntp.getCardSlider().currentCardValue.classList | 227 ntp.getCardSlider().currentCardValue.classList |
227 .contains('most-visited-page')) { | 228 .contains('most-visited-page')) { |
228 chrome.send('mostVisitedSelected'); | 229 chrome.send('mostVisitedSelected'); |
229 } | 230 } |
230 }; | 231 }; |
231 | 232 |
232 return { | 233 return { |
233 MostVisitedPage: MostVisitedPage, | 234 MostVisitedPage: MostVisitedPage, |
234 }; | 235 }; |
235 }); | 236 }); |
236 | 237 |
237 document.addEventListener('ntpLoaded', ntp.MostVisitedPage.onLoaded); | 238 document.addEventListener('ntpLoaded', ntp.MostVisitedPage.onLoaded); |
OLD | NEW |