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