Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2152)

Unified Diff: chrome/browser/ui/webui/ntp/ntp_user_data_logger.h

Issue 2127783002: Make EmitNtpStatistics() private. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/search/search_tab_helper.cc ('k') | chrome/browser/ui/webui/ntp/ntp_user_data_logger.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 c3efcc52bd411a8ed005c4b0d6220e4aabba5ebf..7150ce86d9c08b68d1bc4a20adbb49d097220629 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);
@@ -61,6 +62,19 @@ class NTPUserDataLogger
OnMostVisitedItemsChangedFromServer);
FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest,
OnMostVisitedItemsChangedFromClient);
+ FRIEND_TEST_ALL_PREFIXES(NTPUserDataLoggerTest,
+ TestLogging);
+
+ // 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 };
+
+ // 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_;
« no previous file with comments | « chrome/browser/ui/search/search_tab_helper.cc ('k') | chrome/browser/ui/webui/ntp/ntp_user_data_logger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698