Index: chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_fetcher_win.cc |
diff --git a/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_fetcher_win.cc b/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_fetcher_win.cc |
index 34605c3ef2fe9b458a940a8ba7da4243e33fae60..e2563a89da2c47702a9370f9993fbe0c6b2047bc 100644 |
--- a/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_fetcher_win.cc |
+++ b/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_fetcher_win.cc |
@@ -18,6 +18,7 @@ |
#include "base/macros.h" |
#include "base/memory/ptr_util.h" |
#include "base/memory/ref_counted.h" |
+#include "base/metrics/histogram_macros.h" |
#include "base/sequenced_task_runner.h" |
#include "base/strings/stringprintf.h" |
#include "base/strings/utf_string_conversions.h" |
@@ -52,6 +53,21 @@ base::FilePath::StringType CleanerTempDirectoryPrefix() { |
install_mode); |
} |
+enum CleanerDownloadStatusHistogramValue { |
csharp
2017/07/07 17:32:51
Please add a comment saying this must say in sync
ftirelo
2017/07/07 20:27:53
Done.
|
+ CLEANER_DOWNLOAD_STATUS_SUCCEEDED = 0, |
+ CLEANER_DOWNLOAD_STATUS_OTHER_FAILURE = 1, |
+ CLEANER_DOWNLOAD_STATUS_NOT_FOUND_ON_SERVER = 2, |
+ CLEANER_DOWNLOAD_STATUS_FAILED_TO_CREATE_TEMP_DIR = 3, |
+ |
+ CLEANER_DOWNLOAD_STATUS_MAX, |
+}; |
+ |
+void RecordCleanerDownloadStatusHistogram( |
+ CleanerDownloadStatusHistogramValue value) { |
+ UMA_HISTOGRAM_ENUMERATION("SoftwareReporter.CleanerDownloadStatus", value, |
+ CLEANER_DOWNLOAD_STATUS_MAX); |
+} |
+ |
// Class that will attempt to download the Chrome Cleaner executable and call a |
// given callback when done. Instances of ChromeCleanerFetcher own themselves |
// and will self-delete if they encounter an error or when the network request |
@@ -126,6 +142,8 @@ void ChromeCleanerFetcher::OnTemporaryDirectoryCreated(bool success) { |
PostCallbackAndDeleteSelf( |
base::FilePath(), |
ChromeCleanerFetchStatus::kFailedToCreateTemporaryDirectory); |
+ RecordCleanerDownloadStatusHistogram( |
csharp
2017/07/07 17:32:51
This should probably be move up a line so it is do
ftirelo
2017/07/07 20:27:53
Done. Also did for the other calls.
|
+ CLEANER_DOWNLOAD_STATUS_FAILED_TO_CREATE_TEMP_DIR); |
return; |
} |
@@ -168,6 +186,8 @@ void ChromeCleanerFetcher::OnURLFetchComplete(const net::URLFetcher* source) { |
if (source->GetResponseCode() == net::HTTP_NOT_FOUND) { |
PostCallbackAndDeleteSelf(base::FilePath(), |
ChromeCleanerFetchStatus::kNotFoundOnServer); |
+ RecordCleanerDownloadStatusHistogram( |
+ CLEANER_DOWNLOAD_STATUS_NOT_FOUND_ON_SERVER); |
return; |
} |
@@ -177,6 +197,7 @@ void ChromeCleanerFetcher::OnURLFetchComplete(const net::URLFetcher* source) { |
!source->GetResponseAsFilePath(/*take_ownership=*/true, &download_path)) { |
PostCallbackAndDeleteSelf(base::FilePath(), |
ChromeCleanerFetchStatus::kOtherFailure); |
+ RecordCleanerDownloadStatusHistogram(CLEANER_DOWNLOAD_STATUS_OTHER_FAILURE); |
return; |
} |
@@ -188,6 +209,7 @@ void ChromeCleanerFetcher::OnURLFetchComplete(const net::URLFetcher* source) { |
PostCallbackAndDeleteSelf(std::move(download_path), |
ChromeCleanerFetchStatus::kSuccess); |
+ RecordCleanerDownloadStatusHistogram(CLEANER_DOWNLOAD_STATUS_SUCCEEDED); |
} |
} // namespace |