Chromium Code Reviews| Index: chrome/browser/ui/webui/ntp/ntp_user_data_logger.h |
| diff --git a/chrome/browser/ui/webui/ntp/ntp_user_data_logger.h b/chrome/browser/ui/webui/ntp/ntp_user_data_logger.h |
| index 27f858d3d51aa9932a7b69c727177a54bc06638d..94d10870badaee6441a07e311761e664574cbccf 100644 |
| --- a/chrome/browser/ui/webui/ntp/ntp_user_data_logger.h |
| +++ b/chrome/browser/ui/webui/ntp/ntp_user_data_logger.h |
| @@ -31,11 +31,6 @@ class NTPUserDataLogger |
| static NTPUserDataLogger* GetOrCreateFromWebContents( |
| content::WebContents* content); |
| - // Logs a number of statistics regarding the NTP. Called when an NTP tab is |
| - // about to be deactivated (be it by switching tabs, losing focus or closing |
| - // the tab/shutting down Chrome), or when the user navigates to a URL. |
| - void EmitNtpStatistics(); |
| - |
| // Called when an event occurs on the NTP that requires a counter to be |
| // incremented. |time| is the delta time in ms from navigation start until |
| // this event happened. |
| @@ -51,6 +46,12 @@ class NTPUserDataLogger |
| void NavigationEntryCommitted( |
| const content::LoadCommittedDetails& load_details) override; |
| + // Called when the tab is closed. Logs statistics. |
| + void TabDeactivated(); |
| + |
| + // Called when the set of most visited sites changes. Flushes statistics. |
| + void MostVisitedItemsChanged(); |
| + |
| protected: |
| explicit NTPUserDataLogger(content::WebContents* contents); |
| @@ -62,6 +63,17 @@ class NTPUserDataLogger |
| FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest, |
| OnMostVisitedItemsChangedFromClient); |
| + // To clarify at the call site whether we are calling EmitNtpStatistics() for |
| + // a good reason (CLOSED, NAVIGATED_AWAY) or a questionable one (MV_CHANGED, |
| + // INTNERNAL_FLUSH). |
|
Marc Treib
2016/07/06 12:04:27
nit: typo
sfiera
2016/07/06 12:08:41
Done.
|
| + // TODO(sfiera): remove MV_CHANGED, INTERNAL_FLUSH. |
| + enum class EmitReason { CLOSED, NAVIGATED_AWAY, MV_CHANGED, INTERNAL_FLUSH }; |
| + |
| + // Logs a number of statistics regarding the NTP. Called when an NTP tab is |
| + // about to be deactivated (be it by switching tabs, losing focus or closing |
| + // the tab/shutting down Chrome), or when the user navigates to a URL. |
| + void EmitNtpStatistics(EmitReason reason); |
| + |
| // True if at least one iframe came from a server-side suggestion. |
| bool has_server_side_suggestions_; |