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

Side by Side Diff: chrome/browser/ui/webui/ntp/ntp_user_data_logger.h

Issue 2429523002: Cleanup desktop NTP metrics recording (Closed)
Patch Set: . Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_WEBUI_NTP_NTP_USER_DATA_LOGGER_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_NTP_NTP_USER_DATA_LOGGER_H_
6 #define CHROME_BROWSER_UI_WEBUI_NTP_NTP_USER_DATA_LOGGER_H_ 6 #define CHROME_BROWSER_UI_WEBUI_NTP_NTP_USER_DATA_LOGGER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <bitset> 10 #include <bitset>
(...skipping 16 matching lines...) Expand all
27 public: 27 public:
28 ~NTPUserDataLogger() override; 28 ~NTPUserDataLogger() override;
29 29
30 // Gets the associated NTPUserDataLogger, creating it if necessary. 30 // Gets the associated NTPUserDataLogger, creating it if necessary.
31 // 31 //
32 // MUST be called only when the NTP is active. 32 // MUST be called only when the NTP is active.
33 static NTPUserDataLogger* GetOrCreateFromWebContents( 33 static NTPUserDataLogger* GetOrCreateFromWebContents(
34 content::WebContents* content); 34 content::WebContents* content);
35 35
36 // Called when an event occurs on the NTP that requires a counter to be 36 // Called when an event occurs on the NTP that requires a counter to be
37 // incremented. |time| is the delta time in ms from navigation start until 37 // incremented. |time| is the delta time from navigation start until this
38 // this event happened. 38 // event happened.
39 void LogEvent(NTPLoggingEventType event, base::TimeDelta time); 39 void LogEvent(NTPLoggingEventType event, base::TimeDelta time);
40 40
41 // Logs an impression on one of the NTP tiles by a given source. 41 // Logs an impression on one of the NTP tiles by a given source.
42 void LogMostVisitedImpression(int position, NTPLoggingTileSource tile_source); 42 void LogMostVisitedImpression(int position, NTPLoggingTileSource tile_source);
43 43
44 // Logs a navigation on one of the NTP tiles by a given source. 44 // Logs a navigation on one of the NTP tiles by a given source.
45 void LogMostVisitedNavigation(int position, NTPLoggingTileSource tile_source); 45 void LogMostVisitedNavigation(int position, NTPLoggingTileSource tile_source);
46 46
47 protected: 47 protected:
48 explicit NTPUserDataLogger(content::WebContents* contents); 48 explicit NTPUserDataLogger(content::WebContents* contents);
49 49
50 private: 50 private:
51 friend class content::WebContentsUserData<NTPUserDataLogger>; 51 friend class content::WebContentsUserData<NTPUserDataLogger>;
52 52
53 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest,
54 OnMostVisitedItemsChangedFromServer);
55 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest,
56 OnMostVisitedItemsChangedFromClient);
57 FRIEND_TEST_ALL_PREFIXES(NTPUserDataLoggerTest,
58 TestLogging);
59 FRIEND_TEST_ALL_PREFIXES(NTPUserDataLoggerTest, TestLogMostVisitedImpression); 53 FRIEND_TEST_ALL_PREFIXES(NTPUserDataLoggerTest, TestLogMostVisitedImpression);
60 FRIEND_TEST_ALL_PREFIXES(NTPUserDataLoggerTest, TestNumberOfTiles); 54 FRIEND_TEST_ALL_PREFIXES(NTPUserDataLoggerTest, TestNumberOfTiles);
61 55
62 // Number of Most Visited elements on the NTP for logging purposes. 56 // Number of Most Visited elements on the NTP for logging purposes.
63 static const int kNumMostVisited = 8; 57 static const int kNumMostVisited = 8;
64 58
65 // content::WebContentsObserver override 59 // content::WebContentsObserver override
66 void NavigationEntryCommitted( 60 void NavigationEntryCommitted(
67 const content::LoadCommittedDetails& load_details) override; 61 const content::LoadCommittedDetails& load_details) override;
68 62
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 // Are stats being logged during Chrome startup? 94 // Are stats being logged during Chrome startup?
101 bool during_startup_; 95 bool during_startup_;
102 96
103 // The URL of this New Tab Page - varies based on NTP version. 97 // The URL of this New Tab Page - varies based on NTP version.
104 GURL ntp_url_; 98 GURL ntp_url_;
105 99
106 DISALLOW_COPY_AND_ASSIGN(NTPUserDataLogger); 100 DISALLOW_COPY_AND_ASSIGN(NTPUserDataLogger);
107 }; 101 };
108 102
109 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NTP_USER_DATA_LOGGER_H_ 103 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NTP_USER_DATA_LOGGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/search/search_ipc_router_unittest.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