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

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

Issue 23874005: Ensure the 1993 NTP logs to UMA Most Visited tiles that use the fallback thumbnail instead of the p… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Answered asvitkine comments Created 7 years, 3 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/webui/ntp/ntp_user_data_logger.h ('k') | chrome/common/ntp_logging_events.h » ('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.cc
diff --git a/chrome/browser/ui/webui/ntp/ntp_user_data_logger.cc b/chrome/browser/ui/webui/ntp/ntp_user_data_logger.cc
index 95d86ed2b587601324347e38b26d35404e244337..f3383de159aab38f2b5fc5c267ad8870aa20c2ac 100644
--- a/chrome/browser/ui/webui/ntp/ntp_user_data_logger.cc
+++ b/chrome/browser/ui/webui/ntp/ntp_user_data_logger.cc
@@ -16,12 +16,23 @@ NTPUserDataLogger::~NTPUserDataLogger() {}
void NTPUserDataLogger::EmitThumbnailErrorRate() {
DCHECK_LE(number_of_thumbnail_errors_, number_of_thumbnail_attempts_);
if (number_of_thumbnail_attempts_ != 0) {
- UMA_HISTOGRAM_PERCENTAGE("NewTabPage.ThumbnailErrorRate",
- GetPercentError(number_of_thumbnail_errors_,
- number_of_thumbnail_attempts_));
+ UMA_HISTOGRAM_PERCENTAGE(
+ "NewTabPage.ThumbnailErrorRate",
+ GetPercentError(number_of_thumbnail_errors_,
+ number_of_thumbnail_attempts_));
+ }
+ DCHECK_LE(number_of_fallback_thumbnails_used_,
+ number_of_fallback_thumbnails_requested_);
+ if (number_of_fallback_thumbnails_requested_ != 0) {
+ UMA_HISTOGRAM_PERCENTAGE(
+ "NewTabPage.ThumbnailFallbackRate",
+ GetPercentError(number_of_fallback_thumbnails_used_,
+ number_of_fallback_thumbnails_requested_));
}
number_of_thumbnail_attempts_ = 0;
number_of_thumbnail_errors_ = 0;
+ number_of_fallback_thumbnails_requested_ = 0;
+ number_of_fallback_thumbnails_used_ = 0;
}
void NTPUserDataLogger::EmitMouseoverCount() {
@@ -40,6 +51,12 @@ void NTPUserDataLogger::LogEvent(NTPLoggingEventType event) {
case NTP_THUMBNAIL_ERROR:
number_of_thumbnail_errors_++;
break;
+ case NTP_FALLBACK_THUMBNAIL_REQUESTED:
+ number_of_fallback_thumbnails_requested_++;
+ break;
+ case NTP_FALLBACK_THUMBNAIL_USED:
+ number_of_fallback_thumbnails_used_++;
+ break;
default:
NOTREACHED();
}
@@ -64,7 +81,9 @@ NTPUserDataLogger::NTPUserDataLogger(content::WebContents* contents)
: content::WebContentsObserver(contents),
number_of_mouseovers_(0),
number_of_thumbnail_attempts_(0),
- number_of_thumbnail_errors_(0) {
+ number_of_thumbnail_errors_(0),
+ number_of_fallback_thumbnails_requested_(0),
+ number_of_fallback_thumbnails_used_(0) {
}
size_t NTPUserDataLogger::GetPercentError(size_t errors, size_t events) const {
« no previous file with comments | « chrome/browser/ui/webui/ntp/ntp_user_data_logger.h ('k') | chrome/common/ntp_logging_events.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698