Commit d68b0e06 authored by Min Qin's avatar Min Qin Committed by Commit Bot

Fix an issue that incognito download cannot resume/pause

For incognito, we need to ensure the DownloadOfflineContentProvider is
up when incognito profile is created.

BUG=1006126, 1006128

Change-Id: I48e1717210b42e16031bd42eccf6f4d1c1f17fb8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1816958
Commit-Queue: Min Qin <qinmin@chromium.org>
Reviewed-by: default avatarShakti Sahu <shaktisahu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#698583}
parent 204d2a8e
...@@ -205,8 +205,6 @@ void DownloadManagerService::Init(JNIEnv* env, ...@@ -205,8 +205,6 @@ void DownloadManagerService::Init(JNIEnv* env,
bool is_full_browser_started) { bool is_full_browser_started) {
java_ref_.Reset(env, obj); java_ref_.Reset(env, obj);
if (is_full_browser_started) { if (is_full_browser_started) {
DownloadStartupUtils::EnsureDownloadSystemInitialized(
true /* is_full_browser_started */, false /* is_incognito */);
OnFullBrowserStarted(env, obj); OnFullBrowserStarted(env, obj);
} else { } else {
// In reduced mode, only non-incognito downloads should be loaded. // In reduced mode, only non-incognito downloads should be loaded.
...@@ -221,10 +219,14 @@ void DownloadManagerService::OnFullBrowserStarted(JNIEnv* env, jobject obj) { ...@@ -221,10 +219,14 @@ void DownloadManagerService::OnFullBrowserStarted(JNIEnv* env, jobject obj) {
registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CREATED, registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CREATED,
content::NotificationService::AllSources()); content::NotificationService::AllSources());
// Register coordinator for each available profile. // Register coordinator for each available profile.
DownloadStartupUtils::EnsureDownloadSystemInitialized(
true /* is_full_browser_started */, false /* is_incognito */);
Profile* profile = Profile* profile =
ProfileManager::GetActiveUserProfile()->GetOriginalProfile(); ProfileManager::GetActiveUserProfile()->GetOriginalProfile();
ResetCoordinatorIfNeeded(profile->GetProfileKey()); ResetCoordinatorIfNeeded(profile->GetProfileKey());
if (profile->HasOffTheRecordProfile()) { if (profile->HasOffTheRecordProfile()) {
DownloadStartupUtils::EnsureDownloadSystemInitialized(
true /* is_full_browser_started */, true /* is_incognito */);
ResetCoordinatorIfNeeded( ResetCoordinatorIfNeeded(
profile->GetOffTheRecordProfile()->GetProfileKey()); profile->GetOffTheRecordProfile()->GetProfileKey());
} }
...@@ -237,6 +239,8 @@ void DownloadManagerService::Observe( ...@@ -237,6 +239,8 @@ void DownloadManagerService::Observe(
switch (type) { switch (type) {
case chrome::NOTIFICATION_PROFILE_CREATED: { case chrome::NOTIFICATION_PROFILE_CREATED: {
Profile* profile = content::Source<Profile>(source).ptr(); Profile* profile = content::Source<Profile>(source).ptr();
DownloadStartupUtils::EnsureDownloadSystemInitialized(
true /* is_full_browser_started */, profile->IsOffTheRecord());
ResetCoordinatorIfNeeded(profile->GetProfileKey()); ResetCoordinatorIfNeeded(profile->GetProfileKey());
} break; } break;
default: default:
......
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