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

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

Issue 2091323002: Kill NewTabPage.NumberOfMouseOvers. (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 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 #include "chrome/browser/ui/webui/ntp/ntp_user_data_logger.h" 5 #include "chrome/browser/ui/webui/ntp/ntp_user_data_logger.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 } 106 }
107 107
108 // static 108 // static
109 std::string NTPUserDataLogger::GetMostVisitedNavigationHistogramNameForProvider( 109 std::string NTPUserDataLogger::GetMostVisitedNavigationHistogramNameForProvider(
110 const std::string& provider) { 110 const std::string& provider) {
111 return base::StringPrintf(kMostVisitedNavigationHistogramWithProvider, 111 return base::StringPrintf(kMostVisitedNavigationHistogramWithProvider,
112 provider.c_str()); 112 provider.c_str());
113 } 113 }
114 114
115 void NTPUserDataLogger::EmitNtpStatistics() { 115 void NTPUserDataLogger::EmitNtpStatistics() {
116 UMA_HISTOGRAM_COUNTS("NewTabPage.NumberOfMouseOvers", number_of_mouseovers_);
117 number_of_mouseovers_ = 0;
118
119 // We only send statistics once per page. 116 // We only send statistics once per page.
120 // And we don't send if there are no tiles recorded. 117 // And we don't send if there are no tiles recorded.
121 if (has_emitted_ || !number_of_tiles_) 118 if (has_emitted_ || !number_of_tiles_)
122 return; 119 return;
123 120
124 // LoadTime only gets update once per page, so we don't have it on reloads. 121 // LoadTime only gets update once per page, so we don't have it on reloads.
125 if (load_time_ > base::TimeDelta::FromMilliseconds(0)) { 122 if (load_time_ > base::TimeDelta::FromMilliseconds(0)) {
126 logLoadTimeHistogram("NewTabPage.LoadTime", load_time_); 123 logLoadTimeHistogram("NewTabPage.LoadTime", load_time_);
127 124
128 // Split between ML and MV. 125 // Split between ML and MV.
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 break; 196 break;
200 case NTP_THUMBNAIL_ERROR: 197 case NTP_THUMBNAIL_ERROR:
201 number_of_thumbnail_errors_++; 198 number_of_thumbnail_errors_++;
202 break; 199 break;
203 case NTP_GRAY_TILE_FALLBACK: 200 case NTP_GRAY_TILE_FALLBACK:
204 number_of_gray_tile_fallbacks_++; 201 number_of_gray_tile_fallbacks_++;
205 break; 202 break;
206 case NTP_EXTERNAL_TILE_FALLBACK: 203 case NTP_EXTERNAL_TILE_FALLBACK:
207 number_of_external_tile_fallbacks_++; 204 number_of_external_tile_fallbacks_++;
208 break; 205 break;
209 case NTP_MOUSEOVER: 206 case NTP_MOUSEOVER:
Marc Treib 2016/06/24 14:48:02 Remove the case, so it'll fall into the NOTREACHED
210 number_of_mouseovers_++;
211 break; 207 break;
212 case NTP_TILE_LOADED: 208 case NTP_TILE_LOADED:
213 // The time at which the last tile has loaded (title, thumbnail or single) 209 // The time at which the last tile has loaded (title, thumbnail or single)
214 // is a good proxy for the total load time of the NTP, therefore we keep 210 // is a good proxy for the total load time of the NTP, therefore we keep
215 // the max as the load time. 211 // the max as the load time.
216 load_time_ = std::max(load_time_, time); 212 load_time_ = std::max(load_time_, time);
217 break; 213 break;
218 default: 214 default:
219 NOTREACHED(); 215 NOTREACHED();
220 } 216 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 : content::WebContentsObserver(contents), 279 : content::WebContentsObserver(contents),
284 has_server_side_suggestions_(false), 280 has_server_side_suggestions_(false),
285 has_client_side_suggestions_(false), 281 has_client_side_suggestions_(false),
286 number_of_tiles_(0), 282 number_of_tiles_(0),
287 number_of_thumbnail_tiles_(0), 283 number_of_thumbnail_tiles_(0),
288 number_of_gray_tiles_(0), 284 number_of_gray_tiles_(0),
289 number_of_external_tiles_(0), 285 number_of_external_tiles_(0),
290 number_of_thumbnail_errors_(0), 286 number_of_thumbnail_errors_(0),
291 number_of_gray_tile_fallbacks_(0), 287 number_of_gray_tile_fallbacks_(0),
292 number_of_external_tile_fallbacks_(0), 288 number_of_external_tile_fallbacks_(0),
293 number_of_mouseovers_(0),
294 has_emitted_(false), 289 has_emitted_(false),
295 during_startup_(false) { 290 during_startup_(false) {
296 during_startup_ = !AfterStartupTaskUtils::IsBrowserStartupComplete(); 291 during_startup_ = !AfterStartupTaskUtils::IsBrowserStartupComplete();
297 292
298 // We record metrics about session data here because when this class typically 293 // We record metrics about session data here because when this class typically
299 // emits metrics it is too late. This session data would theoretically have 294 // emits metrics it is too late. This session data would theoretically have
300 // been used to populate the page, and we want to learn about its state when 295 // been used to populate the page, and we want to learn about its state when
301 // the NTP is being generated. 296 // the NTP is being generated.
302 if (contents) { 297 if (contents) {
303 ProfileSyncService* sync = ProfileSyncServiceFactory::GetForProfile( 298 ProfileSyncService* sync = ProfileSyncServiceFactory::GetForProfile(
304 Profile::FromBrowserContext(contents->GetBrowserContext())); 299 Profile::FromBrowserContext(contents->GetBrowserContext()));
305 if (sync) { 300 if (sync) {
306 browser_sync::SessionsSyncManager* sessions = 301 browser_sync::SessionsSyncManager* sessions =
307 static_cast<browser_sync::SessionsSyncManager*>( 302 static_cast<browser_sync::SessionsSyncManager*>(
308 sync->GetSessionsSyncableService()); 303 sync->GetSessionsSyncableService());
309 if (sessions) { 304 if (sessions) {
310 sync_sessions::SyncSessionsMetrics::RecordYoungestForeignTabAgeOnNTP( 305 sync_sessions::SyncSessionsMetrics::RecordYoungestForeignTabAgeOnNTP(
311 sessions); 306 sessions);
312 } 307 }
313 } 308 }
314 } 309 }
315 } 310 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/ntp/ntp_user_data_logger.h ('k') | chrome/browser/ui/webui/ntp/ntp_user_data_logger_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698