Commit e6cf69a4 authored by Varun Khaneja's avatar Varun Khaneja Committed by Commit Bot

AndroidTelemetryService: Check incognito mode based on profile

Functionally, this is a NO-OP but it does simplify the code and
eliminates the NOT_SENT_MISSING_WEB_CONTENTS scenario.

R=drubery

Bug: 938559,907280
Change-Id: Ifd3e27b865df97aa07d5a1b7653cd0f01910454a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1504958Reviewed-by: default avatarDaniel Rubery <drubery@chromium.org>
Commit-Queue: Varun Khaneja <vakh@chromium.org>
Auto-Submit: Varun Khaneja <vakh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#638351}
parent 7797b8c8
...@@ -129,10 +129,6 @@ void AndroidTelemetryService::OnDownloadCreated( ...@@ -129,10 +129,6 @@ void AndroidTelemetryService::OnDownloadCreated(
return; return;
} }
if (item->GetMimeType() != kApkMimeType) {
return;
}
if (!CanSendPing(item)) { if (!CanSendPing(item)) {
return; return;
} }
...@@ -165,13 +161,9 @@ void AndroidTelemetryService::OnDownloadUpdated(download::DownloadItem* item) { ...@@ -165,13 +161,9 @@ void AndroidTelemetryService::OnDownloadUpdated(download::DownloadItem* item) {
} }
bool AndroidTelemetryService::CanSendPing(download::DownloadItem* item) { bool AndroidTelemetryService::CanSendPing(download::DownloadItem* item) {
content::WebContents* web_contents = if (item->GetMimeType() != kApkMimeType) {
content::DownloadItemUtils::GetWebContents(item); // This case is not recorded since we are not interested here in finding out
if (!web_contents) { // how often people download non-APK files.
// TODO(vakh): This can happen sometimes when a download resumes on a
// browser re-launch. Identify this case and document it better.
RecordApkDownloadTelemetryOutcome(
ApkDownloadTelemetryOutcome::NOT_SENT_MISSING_WEB_CONTENTS);
return false; return false;
} }
...@@ -181,7 +173,7 @@ bool AndroidTelemetryService::CanSendPing(download::DownloadItem* item) { ...@@ -181,7 +173,7 @@ bool AndroidTelemetryService::CanSendPing(download::DownloadItem* item) {
return false; return false;
} }
if (web_contents->GetBrowserContext()->IsOffTheRecord()) { if (profile_->IsOffTheRecord()) {
RecordApkDownloadTelemetryOutcome( RecordApkDownloadTelemetryOutcome(
ApkDownloadTelemetryOutcome::NOT_SENT_INCOGNITO); ApkDownloadTelemetryOutcome::NOT_SENT_INCOGNITO);
return false; return false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment