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

Unified Diff: chrome/browser/ui/browser.cc

Issue 8135017: Refactor downloads into a ProfileKeyedService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Incorporated latest rounds of comments from John. Created 9 years, 2 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
Index: chrome/browser/ui/browser.cc
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index acebb2522f34fdb59cf934a9afc9dad4fcbf4d4d..332d1ae1ed4c36b6cc1b4f055ab62a397a1f74ee 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -39,6 +39,8 @@
#include "chrome/browser/debugger/devtools_window.h"
#include "chrome/browser/download/chrome_download_manager_delegate.h"
#include "chrome/browser/download/download_item_model.h"
+#include "chrome/browser/download/download_service.h"
+#include "chrome/browser/download/download_service_factory.h"
#include "chrome/browser/download/download_started_animation.h"
#include "chrome/browser/extensions/crx_installer.h"
#include "chrome/browser/extensions/extension_browser_event_router.h"
@@ -4861,19 +4863,23 @@ void Browser::CheckDownloadsInProgress(bool* normal_downloads_are_present,
// If there are no download in-progress, our job is done.
DownloadManager* download_manager = NULL;
+ DownloadService* download_service =
+ DownloadServiceFactory::GetForProfile(profile());
// But first we need to check for the existence of the download manager, as
// GetDownloadManager() will unnecessarily try to create one if it does not
// exist.
- if (profile()->HasCreatedDownloadManager())
- download_manager = profile()->GetDownloadManager();
+ if (download_service->HasCreatedDownloadManager())
+ download_manager = download_service->GetDownloadManager();
if (profile()->IsOffTheRecord()) {
// Browser is incognito and so download_manager if present is for incognito
// downloads.
*incognito_downloads_are_present =
(download_manager && download_manager->in_progress_count() != 0);
// Check original profile.
- if (profile()->GetOriginalProfile()->HasCreatedDownloadManager())
- download_manager = profile()->GetOriginalProfile()->GetDownloadManager();
+ DownloadService* download_service = DownloadServiceFactory::GetForProfile(
+ profile()->GetOriginalProfile());
+ if (download_service->HasCreatedDownloadManager())
+ download_manager = download_service->GetDownloadManager();
}
*normal_downloads_are_present =

Powered by Google App Engine
This is Rietveld 408576698