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 6e6f965b058ad9fab999be97fa0a462f5c26fb1a..13ed126232772df57fe7e6bdafd87ee3f19d13aa 100644 |
| --- a/chrome/browser/ui/webui/ntp/ntp_user_data_logger.h |
| +++ b/chrome/browser/ui/webui/ntp/ntp_user_data_logger.h |
| @@ -25,6 +25,9 @@ class NTPUserDataLogger |
| public: |
| ~NTPUserDataLogger() override; |
| + // Gets the associated NTPUserDataLogger, creating it if necessary. |
| + // |
| + // MUST be called only when the NTP is active. |
|
Marc Treib
2016/07/12 08:17:46
Can we DCHECK this? search::IsInstantNTP might be
sfiera
2016/07/14 14:11:08
DCHECK added.
|
| static NTPUserDataLogger* GetOrCreateFromWebContents( |
| content::WebContents* content); |
| @@ -42,9 +45,6 @@ class NTPUserDataLogger |
| // 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); |
| @@ -63,16 +63,26 @@ class NTPUserDataLogger |
| const content::LoadCommittedDetails& load_details) override; |
| // To clarify at the call site whether we are calling EmitNtpStatistics() for |
| - // a good reason (CLOSED, NAVIGATED_AWAY) or a questionable one (MV_CHANGED, |
| - // INTERNAL_FLUSH). |
| - // TODO(sfiera): remove MV_CHANGED, INTERNAL_FLUSH. |
| - enum class EmitReason { CLOSED, NAVIGATED_AWAY, MV_CHANGED, INTERNAL_FLUSH }; |
| + // a good reason (CLOSED, NAVIGATED_AWAY) or a questionable one |
| + // (INTERNAL_FLUSH). |
| + // TODO(sfiera): remove INTERNAL_FLUSH. |
| + enum class EmitReason { CLOSED, NAVIGATED_AWAY, 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); |
| + // Records whether we have yet logged an impression for the tile at a given |
| + // index. A typical NTP will log 8 impressions, but could record fewer for new |
| + // users that haven't built up a history yet. |
| + // |
| + // If something happens that causes the NTP to pull tiles from different |
| + // sources, such as logging in (switching from client to server tiles), then |
| + // only the impressions for the first source will be logged, leaving the |
| + // number of impressions for a source slightly out-of-sync with navigations. |
| + std::vector<bool> impression_was_logged_; |
| + |
| // True if at least one iframe came from a server-side suggestion. |
| bool has_server_side_suggestions_; |