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

Unified Diff: chrome/browser/android/download/download_manager_service.cc

Issue 2332213002: [Download Home] Properly enqueue download requests (Closed)
Patch Set: Created 4 years, 3 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 | « chrome/browser/android/download/download_manager_service.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/download/download_manager_service.cc
diff --git a/chrome/browser/android/download/download_manager_service.cc b/chrome/browser/android/download/download_manager_service.cc
index f00173594033be98ce8d3a58358bbd1f0e705993..249a7727797d4ea881d9cc9312c81b6467134f80 100644
--- a/chrome/browser/android/download/download_manager_service.cc
+++ b/chrome/browser/android/download/download_manager_service.cc
@@ -82,7 +82,8 @@ DownloadManagerService::DownloadManagerService(
JNIEnv* env,
jobject obj)
: java_ref_(env, obj),
- is_history_query_complete_(false) {
+ is_history_query_complete_(false),
+ pending_get_downloads_actions_(NONE) {
DownloadControllerBase::Get()->SetDefaultDownloadFileName(
l10n_util::GetStringUTF8(IDS_DEFAULT_DOWNLOAD_FILENAME));
}
@@ -131,9 +132,9 @@ void DownloadManagerService::GetAllDownloads(JNIEnv* env,
if (is_history_query_complete_)
GetAllDownloadsInternal(is_off_the_record);
else if (is_off_the_record)
- EnqueueDownloadAction(std::string(), INITIALIZE_OFF_THE_RECORD_UI);
+ pending_get_downloads_actions_ |= OFF_THE_RECORD;
else
- EnqueueDownloadAction(std::string(), INITIALIZE_UI);
+ pending_get_downloads_actions_ |= REGULAR;
}
void DownloadManagerService::GetAllDownloadsInternal(bool is_off_the_record) {
@@ -218,12 +219,6 @@ void DownloadManagerService::OnHistoryQueryComplete() {
case CANCEL:
CancelDownloadInternal(download_guid, false);
break;
- case INITIALIZE_UI:
- GetAllDownloadsInternal(false);
- break;
- case INITIALIZE_OFF_THE_RECORD_UI:
- GetAllDownloadsInternal(true);
- break;
default:
NOTREACHED();
break;
@@ -231,6 +226,12 @@ void DownloadManagerService::OnHistoryQueryComplete() {
}
pending_actions_.clear();
+ // Respond to any requests to get all downloads.
+ if (pending_get_downloads_actions_ & REGULAR)
+ GetAllDownloadsInternal(false);
+ if (pending_get_downloads_actions_ & OFF_THE_RECORD)
+ GetAllDownloadsInternal(true);
+
// Monitor all DownloadItems for changes.
updateNotifier(this, GetDownloadManager(false), original_notifier_);
updateNotifier(this, GetDownloadManager(true), off_the_record_notifier_);
@@ -351,10 +352,6 @@ void DownloadManagerService::EnqueueDownloadAction(
case REMOVE:
iter->second = action;
break;
- case INITIALIZE_UI:
- case INITIALIZE_OFF_THE_RECORD_UI:
- iter->second = action;
- break;
default:
NOTREACHED();
break;
« no previous file with comments | « chrome/browser/android/download/download_manager_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698