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

Unified Diff: content/browser/android/download_controller_android_impl.cc

Issue 2058593002: Add UMA for studying download cancellation reasons (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
Index: content/browser/android/download_controller_android_impl.cc
diff --git a/content/browser/android/download_controller_android_impl.cc b/content/browser/android/download_controller_android_impl.cc
index 874e47a361e1c8d3902820bf84da03321c1a2557..ca2771615e9cf402e23616c66325b98649dbd4ac 100644
--- a/content/browser/android/download_controller_android_impl.cc
+++ b/content/browser/android/download_controller_android_impl.cc
@@ -13,6 +13,7 @@
#include "base/bind.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
+#include "base/metrics/histogram_macros.h"
#include "base/synchronization/lock.h"
#include "base/time/time.h"
#include "content/browser/android/content_view_core_impl.h"
@@ -132,6 +133,10 @@ static void OnRequestFileAccessResult(JNIEnv* env,
cb(reinterpret_cast<
DownloadControllerAndroid::AcquireFileAccessPermissionCallback*>(
callback_id));
+ if (!granted) {
+ DownloadControllerAndroid::RecordDownloadCancelReason(
+ DownloadControllerAndroid::kNoStoragePermission);
+ }
cb->Run(granted);
}
@@ -163,6 +168,13 @@ void DownloadControllerAndroid::SetDownloadControllerAndroid(
}
// static
+void DownloadControllerAndroid::RecordDownloadCancelReason(
+ DownloadCancelReason reason) {
+ UMA_HISTOGRAM_ENUMERATION(
+ "MobileDownload.CancelReason", reason, kCancelReasonMax);
+}
+
+// static
DownloadControllerAndroidImpl* DownloadControllerAndroidImpl::GetInstance() {
return base::Singleton<DownloadControllerAndroidImpl>::get();
}

Powered by Google App Engine
This is Rietveld 408576698