| Index: chrome/browser/resources/ntp4/suggestions_page.js
|
| ===================================================================
|
| --- chrome/browser/resources/ntp4/suggestions_page.js (revision 134120)
|
| +++ chrome/browser/resources/ntp4/suggestions_page.js (working copy)
|
| @@ -8,16 +8,6 @@
|
| var TilePage = ntp.TilePage;
|
|
|
| /**
|
| - * See description for these values in suggestions_page_handler.h.
|
| - * @enum {number}
|
| - */
|
| - var SuggestedSitesAction = {
|
| - CLICKED_SUGGESTED_TILE: 11,
|
| - CLICKED_OTHER_NTP_PANE: 12,
|
| - OTHER: 13
|
| - };
|
| -
|
| - /**
|
| * A counter for generating unique tile IDs.
|
| */
|
| var tileID = 0;
|
| @@ -145,7 +135,7 @@
|
| chrome.send('metricsHandler:recordInHistogram',
|
| ['NewTabPage.SuggestedSite', this.index, 8]);
|
| chrome.send('suggestedSitesAction',
|
| - [SuggestedSitesAction.CLICKED_SUGGESTED_TILE]);
|
| + [ntp.NtpFollowAction.CLICKED_TILE]);
|
| }
|
| },
|
|
|
| @@ -334,8 +324,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',
|
| + [ntp.NtpFollowAction.CLICKED_OTHER_NTP_PANE]);
|
| + }
|
| },
|
|
|
| /**
|
| @@ -344,7 +336,8 @@
|
| * @param {Event} e The CardChanged event.
|
| */
|
| handleCardSelected_: function(e) {
|
| - chrome.send('suggestedSitesSelected');
|
| + if (!document.documentElement.classList.contains('starting-up'))
|
| + chrome.send('suggestedSitesSelected');
|
| },
|
|
|
| /**
|
| @@ -379,6 +372,20 @@
|
| };
|
|
|
| /**
|
| + * Executed once the NTP has loaded. Checks if the Suggested pane is
|
| + * shown or not. If it is shown, the 'suggestedSitesSelected' message is sent
|
| + * to the C++ code, to record the fact that the user has seen this pane.
|
| + */
|
| + SuggestionsPage.onLoaded = function() {
|
| + if (ntp.getCardSlider() &&
|
| + ntp.getCardSlider().currentCardValue &&
|
| + ntp.getCardSlider().currentCardValue.classList
|
| + .contains('suggestions-page')) {
|
| + chrome.send('suggestedSitesSelected');
|
| + }
|
| + }
|
| +
|
| + /**
|
| * We've gotten additional data for Suggestions page. Update our old data with
|
| * the new data. The ordering of the new data is not important, except when a
|
| * page is pinned. Thus we try to minimize re-ordering.
|
| @@ -455,3 +462,5 @@
|
| refreshData: refreshData,
|
| };
|
| });
|
| +
|
| +document.addEventListener('ntpLoaded', ntp.SuggestionsPage.onLoaded);
|
|
|