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

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

Issue 2696223004: Desktop NTP: Add a UMA metric NewTabPage.TilesReceivedTime (Closed)
Patch Set: review Created 3 years, 10 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 ntp_tiles::NTPTileSource tile_source); 48 ntp_tiles::NTPTileSource tile_source);
49 49
50 protected: 50 protected:
51 explicit NTPUserDataLogger(content::WebContents* contents); 51 explicit NTPUserDataLogger(content::WebContents* contents);
52 52
53 private: 53 private:
54 friend class content::WebContentsUserData<NTPUserDataLogger>; 54 friend class content::WebContentsUserData<NTPUserDataLogger>;
55 55
56 FRIEND_TEST_ALL_PREFIXES(NTPUserDataLoggerTest, TestLogMostVisitedImpression); 56 FRIEND_TEST_ALL_PREFIXES(NTPUserDataLoggerTest, TestLogMostVisitedImpression);
57 FRIEND_TEST_ALL_PREFIXES(NTPUserDataLoggerTest, TestNumberOfTiles); 57 FRIEND_TEST_ALL_PREFIXES(NTPUserDataLoggerTest, TestNumberOfTiles);
58 FRIEND_TEST_ALL_PREFIXES(NTPUserDataLoggerTest, TestLoadTime);
58 59
59 // Number of Most Visited elements on the NTP for logging purposes. 60 // Number of Most Visited elements on the NTP for logging purposes.
60 static const int kNumMostVisited = 8; 61 static const int kNumMostVisited = 8;
61 62
62 // content::WebContentsObserver override 63 // content::WebContentsObserver override
63 void NavigationEntryCommitted( 64 void NavigationEntryCommitted(
64 const content::LoadCommittedDetails& load_details) override; 65 const content::LoadCommittedDetails& load_details) override;
65 66
66 // Implementation of NavigationEntryCommitted; separate for test. 67 // Implementation of NavigationEntryCommitted; separate for test.
67 void NavigatedFromURLToURL(const GURL& from, const GURL& to); 68 void NavigatedFromURLToURL(const GURL& from, const GURL& to);
(...skipping 10 matching lines...) Expand all
78 // If something happens that causes the NTP to pull tiles from different 79 // If something happens that causes the NTP to pull tiles from different
79 // sources, such as signing in (switching from client to server tiles), then 80 // sources, such as signing in (switching from client to server tiles), then
80 // only the impressions for the first source will be logged, leaving the 81 // only the impressions for the first source will be logged, leaving the
81 // number of impressions for a source slightly out-of-sync with navigations. 82 // number of impressions for a source slightly out-of-sync with navigations.
82 std::bitset<kNumMostVisited> impression_was_logged_; 83 std::bitset<kNumMostVisited> impression_was_logged_;
83 84
84 // Stores the tile source for each impression. Entries are only valid if the 85 // Stores the tile source for each impression. Entries are only valid if the
85 // corresponding entry in |impression_was_logged_| is true. 86 // corresponding entry in |impression_was_logged_| is true.
86 std::vector<ntp_tiles::NTPTileSource> impression_tile_source_; 87 std::vector<ntp_tiles::NTPTileSource> impression_tile_source_;
87 88
89 // The time we received the NTP_ALL_TILES_RECEIVED event.
90 base::TimeDelta tiles_received_time_;
91
88 // Whether we have already emitted NTP stats for this web contents. 92 // Whether we have already emitted NTP stats for this web contents.
89 bool has_emitted_; 93 bool has_emitted_;
90 94
91 // Are stats being logged during Chrome startup? 95 // Are stats being logged during Chrome startup?
92 bool during_startup_; 96 bool during_startup_;
93 97
94 // The URL of this New Tab Page - varies based on NTP version. 98 // The URL of this New Tab Page - varies based on NTP version.
95 GURL ntp_url_; 99 GURL ntp_url_;
96 100
97 DISALLOW_COPY_AND_ASSIGN(NTPUserDataLogger); 101 DISALLOW_COPY_AND_ASSIGN(NTPUserDataLogger);
98 }; 102 };
99 103
100 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NTP_USER_DATA_LOGGER_H_ 104 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NTP_USER_DATA_LOGGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/resources/local_ntp/most_visited_single.js ('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