OLD | NEW |
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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| 11 #include "base/time/time.h" |
11 #include "chrome/common/ntp_logging_events.h" | 12 #include "chrome/common/ntp_logging_events.h" |
12 #include "content/public/browser/web_contents_observer.h" | 13 #include "content/public/browser/web_contents_observer.h" |
13 #include "content/public/browser/web_contents_user_data.h" | 14 #include "content/public/browser/web_contents_user_data.h" |
14 | 15 |
15 namespace content { | 16 namespace content { |
16 class WebContents; | 17 class WebContents; |
17 } | 18 } |
18 | 19 |
19 // Helper class for logging data from the NTP. Attached to each NTP instance. | 20 // Helper class for logging data from the NTP. Attached to each NTP instance. |
20 class NTPUserDataLogger | 21 class NTPUserDataLogger |
(...skipping 13 matching lines...) Expand all Loading... |
34 // Returns the name of the histogram that should be logged for a navigation | 35 // Returns the name of the histogram that should be logged for a navigation |
35 // to a specified Most Visited |provider|. | 36 // to a specified Most Visited |provider|. |
36 static std::string GetMostVisitedNavigationHistogramNameForProvider( | 37 static std::string GetMostVisitedNavigationHistogramNameForProvider( |
37 const std::string& provider); | 38 const std::string& provider); |
38 | 39 |
39 // Logs a number of statistics regarding the NTP. Called when an NTP tab is | 40 // Logs a number of statistics regarding the NTP. Called when an NTP tab is |
40 // about to be deactivated (be it by switching tabs, losing focus or closing | 41 // about to be deactivated (be it by switching tabs, losing focus or closing |
41 // the tab/shutting down Chrome), or when the user navigates to a URL. | 42 // the tab/shutting down Chrome), or when the user navigates to a URL. |
42 void EmitNtpStatistics(); | 43 void EmitNtpStatistics(); |
43 | 44 |
44 // Called each time an event occurs on the NTP that requires a counter to be | 45 // Called when an event occurs on the NTP that requires a counter to be |
45 // incremented. | 46 // incremented. |time| is the delta time in ms from navigation start until |
46 void LogEvent(NTPLoggingEventType event); | 47 // this event happened. |
| 48 void LogEvent(NTPLoggingEventType event, base::TimeDelta time); |
47 | 49 |
48 // Logs an impression on one of the Most Visited tiles by a given provider. | 50 // Logs an impression on one of the Most Visited tiles by a given provider. |
49 void LogMostVisitedImpression(int position, const base::string16& provider); | 51 void LogMostVisitedImpression(int position, const base::string16& provider); |
50 | 52 |
51 // Logs a navigation on one of the Most Visited tiles by a given provider. | 53 // Logs a navigation on one of the Most Visited tiles by a given provider. |
52 void LogMostVisitedNavigation(int position, const base::string16& provider); | 54 void LogMostVisitedNavigation(int position, const base::string16& provider); |
53 | 55 |
54 // content::WebContentsObserver override | 56 // content::WebContentsObserver override |
55 void NavigationEntryCommitted( | 57 void NavigationEntryCommitted( |
56 const content::LoadCommittedDetails& load_details) override; | 58 const content::LoadCommittedDetails& load_details) override; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // Total number of mouseovers for this NTP session. | 98 // Total number of mouseovers for this NTP session. |
97 size_t number_of_mouseovers_; | 99 size_t number_of_mouseovers_; |
98 | 100 |
99 // The URL of this New Tab Page - varies based on NTP version. | 101 // The URL of this New Tab Page - varies based on NTP version. |
100 GURL ntp_url_; | 102 GURL ntp_url_; |
101 | 103 |
102 DISALLOW_COPY_AND_ASSIGN(NTPUserDataLogger); | 104 DISALLOW_COPY_AND_ASSIGN(NTPUserDataLogger); |
103 }; | 105 }; |
104 | 106 |
105 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NTP_USER_DATA_LOGGER_H_ | 107 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NTP_USER_DATA_LOGGER_H_ |
OLD | NEW |