 Chromium Code Reviews
 Chromium Code Reviews Issue 10182006:
  Adds the MostVisitedAction stat. This stat will provide a baseline to compare  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src/
    
  
    Issue 10182006:
  Adds the MostVisitedAction stat. This stat will provide a baseline to compare  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src/| Index: chrome/browser/resources/ntp4/suggestions_page.js | 
| =================================================================== | 
| --- chrome/browser/resources/ntp4/suggestions_page.js (revision 133422) | 
| +++ chrome/browser/resources/ntp4/suggestions_page.js (working copy) | 
| @@ -8,11 +8,11 @@ | 
| var TilePage = ntp.TilePage; | 
| /** | 
| - * See description for these values in suggestions_page_handler.h. | 
| + * See description for these values in ntp_stats.h. | 
| * @enum {number} | 
| */ | 
| - var SuggestedSitesAction = { | 
| - CLICKED_SUGGESTED_TILE: 11, | 
| + var NtpFollowAction = { | 
| + CLICKED_TILE: 11, | 
| CLICKED_OTHER_NTP_PANE: 12, | 
| OTHER: 13 | 
| }; | 
| @@ -145,7 +145,7 @@ | 
| chrome.send('metricsHandler:recordInHistogram', | 
| ['NewTabPage.SuggestedSite', this.index, 8]); | 
| chrome.send('suggestedSitesAction', | 
| - [SuggestedSitesAction.CLICKED_SUGGESTED_TILE]); | 
| + [NtpFollowAction.CLICKED_TILE]); | 
| } | 
| }, | 
| @@ -334,8 +334,10 @@ | 
| * @param {Event} e The CardChanged event. | 
| */ | 
| handleCardDeselected_: function(e) { | 
| - chrome.send('suggestedSitesAction', | 
| - [SuggestedSitesAction.CLICKED_OTHER_NTP_PANE]); | 
| + if (!document.documentElement.classList.contains('starting-up')) { | 
| + chrome.send('suggestedSitesAction', | 
| + [NtpFollowAction.CLICKED_OTHER_NTP_PANE]); | 
| + } | 
| }, | 
| /** | 
| @@ -344,7 +346,9 @@ | 
| * @param {Event} e The CardChanged event. | 
| */ | 
| handleCardSelected_: function(e) { | 
| - chrome.send('suggestedSitesSelected'); | 
| + if (!document.documentElement.classList.contains('starting-up')) { | 
| + chrome.send('suggestedSitesSelected'); | 
| + } | 
| }, | 
| /** | 
| @@ -374,6 +378,19 @@ | 
| return false; | 
| }, | 
| + /** | 
| + * Executed once the NTP has loaded. Checks if the Suggested pane is | 
| + * shown or not. | 
| + */ | 
| + onLoaded: function() { | 
| + if (ntp.getCardSlider() && ntp.getCardSlider().currentCardValue) { | 
| + if (ntp.getCardSlider().currentCardValue.classList | 
| + .contains('suggestions-page')) { | 
| + chrome.send('suggestedSitesSelected'); | 
| + } | 
| + } | 
| + }, | 
| + | 
| /** @inheritDoc */ | 
| heightForWidth: heightForWidth, | 
| }; | 
| @@ -455,3 +472,5 @@ | 
| refreshData: refreshData, | 
| }; | 
| }); | 
| + | 
| +document.addEventListener('ntploaded', ntp.SuggestionsPage.prototype.onLoaded); | 
| 
beaudoin
2012/04/23 16:46:52
Same comment.
 
macourteau
2012/04/23 19:49:41
Done.
 |