Commit d2c3a9fa authored by Side Yilmaz's avatar Side Yilmaz Committed by Commit Bot

Block resume download for OTR profile if native is not initialized.

DownloadManagerService#resumeDownload function may triggered for OTR
profiles. However, download shouldn't be resumed if the native is not
initialized yet. This CL blocks to resume download initiated from OTR
profile, if native has not initialized yet.

Bug: 1138139, 1099577
Change-Id: I46e6e0b47474f760150754f57e8805466c937449
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2471738Reviewed-by: default avatarMin Qin <qinmin@chromium.org>
Reviewed-by: default avatarRamin Halavati <rhalavati@chromium.org>
Reviewed-by: default avatarMohamed Heikal <mheikal@chromium.org>
Reviewed-by: default avatarDavid Trainor <dtrainor@chromium.org>
Reviewed-by: default avatarHenrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Side YILMAZ <sideyilmaz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#819272}
parent b065ba62
......@@ -966,6 +966,10 @@ public class DownloadManagerService implements DownloadController.Observer,
}
incrementDownloadRetryCount(item.getId(), false);
}
// Downloads started from incognito mode should not be resumed in reduced mode.
if (!ProfileManager.isInitialized() && item.getDownloadInfo().isOffTheRecord()) return;
DownloadManagerServiceJni.get().resumeDownload(getNativeDownloadManagerService(),
DownloadManagerService.this, item.getId(),
getProfileKey(item.getDownloadInfo().isOffTheRecord()), hasUserGesture);
......
......@@ -5,6 +5,7 @@
#include "chrome/browser/android/profile_key_util.h"
#include "chrome/browser/android/profile_key_startup_accessor.h"
#include "chrome/browser/profiles/profile_key.h"
#include "chrome/browser/profiles/profile_manager.h"
namespace android {
......@@ -22,7 +23,7 @@ ProfileKey* GetLastUsedRegularProfileKey() {
ProfileKey* key = ProfileKeyStartupAccessor::GetInstance()->profile_key();
if (!key)
key = GetProfile()->GetProfileKey();
DCHECK(key);
DCHECK(key && !key->IsOffTheRecord());
return key;
}
......
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