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

Unified Diff: content/browser/download/download_item_impl.cc

Issue 2758453003: Recording download mime types for normal profile (Closed)
Patch Set: comments Created 3 years, 9 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 | « no previous file | content/browser/download/download_item_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/download/download_item_impl.cc
diff --git a/content/browser/download/download_item_impl.cc b/content/browser/download/download_item_impl.cc
index 507ace3f58836cc192837a19cf459b4915197981..cbc8cbe5dd32a6b6d6a8dbd684c0fad473deb19d 100644
--- a/content/browser/download/download_item_impl.cc
+++ b/content/browser/download/download_item_impl.cc
@@ -1165,9 +1165,6 @@ void DownloadItemImpl::Init(bool active,
DownloadType download_type) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
- if (active)
- RecordDownloadCount(START_COUNT);
-
std::string file_name;
if (download_type == SRC_HISTORY_IMPORT) {
// target_path_ works for History and Save As versions.
@@ -1204,6 +1201,7 @@ void DownloadItemImpl::Start(
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(!download_file_.get());
DVLOG(20) << __func__ << "() this=" << DebugString(true);
+ RecordDownloadCount(START_COUNT);
download_file_ = std::move(file);
job_ = DownloadJobFactory::CreateJob(this, std::move(req_handle),
@@ -1265,6 +1263,15 @@ void DownloadItemImpl::Start(
return;
}
+ if (state_ == INITIAL_INTERNAL) {
+ RecordDownloadCount(NEW_DOWNLOAD_COUNT);
+ RecordDownloadMimeType(mime_type_);
+ if (!GetBrowserContext()->IsOffTheRecord()) {
+ RecordDownloadCount(NEW_DOWNLOAD_COUNT_NORMAL_PROFILE);
+ RecordDownloadMimeTypeForNormalProfile(mime_type_);
+ }
+ }
+
// Successful download start.
DCHECK(download_file_);
DCHECK(job_);
@@ -1563,6 +1570,9 @@ void DownloadItemImpl::Completed() {
end_time_ = base::Time::Now();
TransitionTo(COMPLETE_INTERNAL);
RecordDownloadCompleted(start_tick_, received_bytes_);
+ if (!GetBrowserContext()->IsOffTheRecord()) {
+ RecordDownloadCount(COMPLETED_COUNT_NORMAL_PROFILE);
+ }
if (auto_opened_) {
// If it was already handled by the delegate, do nothing.
« no previous file with comments | « no previous file | content/browser/download/download_item_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698