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(
return;
}
if (item->GetMimeType() != kApkMimeType) {
return;
}
if (!CanSendPing(item)) {
return;
}
......@@ -165,13 +161,9 @@ void AndroidTelemetryService::OnDownloadUpdated(download::DownloadItem* item) {
}
bool AndroidTelemetryService::CanSendPing(download::DownloadItem* item) {
content::WebContents* web_contents =
content::DownloadItemUtils::GetWebContents(item);
if (!web_contents) {
// 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);
if (item->GetMimeType() != kApkMimeType) {
// This case is not recorded since we are not interested here in finding out
// how often people download non-APK files.
return false;
}
......@@ -181,7 +173,7 @@ bool AndroidTelemetryService::CanSendPing(download::DownloadItem* item) {
return false;
}
if (web_contents->GetBrowserContext()->IsOffTheRecord()) {
if (profile_->IsOffTheRecord()) {
RecordApkDownloadTelemetryOutcome(
ApkDownloadTelemetryOutcome::NOT_SENT_INCOGNITO);
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