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

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

Issue 2758453003: Recording download mime types for normal profile (Closed)
Patch Set: Mime type breakdown 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_request_core.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 f118a476be598052f23acd1ffe392e303b084e39..8881ff91cbaf84cd9cbbc4b2e48ce73ff3b20e10 100644
--- a/content/browser/download/download_item_impl.cc
+++ b/content/browser/download/download_item_impl.cc
@@ -1158,8 +1158,13 @@ void DownloadItemImpl::Init(bool active,
DownloadType download_type) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
- if (active)
+ if (active) {
RecordDownloadCount(START_COUNT);
+ if (GetWebContents() &&
asanka 2017/03/22 21:03:02 For a new single resource download, Init() gets ca
shaktisahu 2017/03/22 22:21:36 Done.
+ !GetWebContents()->GetBrowserContext()->IsOffTheRecord()) {
+ RecordDownloadCount(START_COUNT_NORMAL_PROFILE);
+ }
+ }
std::string file_name;
if (download_type == SRC_HISTORY_IMPORT) {
@@ -1258,6 +1263,12 @@ void DownloadItemImpl::Start(
return;
}
+ RecordDownloadMimeType(mime_type_);
+ if (GetWebContents() &&
+ !GetWebContents()->GetBrowserContext()->IsOffTheRecord()) {
asanka 2017/03/22 21:03:03 Call DownloadItemImpl::GetBrowserContext() directl
shaktisahu 2017/03/22 22:21:36 Done. Thanks. I am interested in new downloads onl
+ RecordDownloadMimeTypeForNormalProfile(mime_type_);
+ }
+
// Successful download start.
DCHECK(download_file_);
DCHECK(job_);
@@ -1553,6 +1564,10 @@ void DownloadItemImpl::Completed() {
end_time_ = base::Time::Now();
TransitionTo(COMPLETE_INTERNAL);
RecordDownloadCompleted(start_tick_, received_bytes_);
+ if (GetWebContents() &&
+ !GetWebContents()->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_request_core.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698