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

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

Issue 8135017: Refactor downloads into a ProfileKeyedService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged to LKGR to run try bots. 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/webui/downloads_dom_handler.cc
diff --git a/chrome/browser/ui/webui/downloads_dom_handler.cc b/chrome/browser/ui/webui/downloads_dom_handler.cc
index 9ee87022111dfd63086d49bb71cbdc3960537e5d..b0394b66251048fb0828f75481346e188a3f4eaa 100644
--- a/chrome/browser/ui/webui/downloads_dom_handler.cc
+++ b/chrome/browser/ui/webui/downloads_dom_handler.cc
@@ -20,6 +20,8 @@
#include "chrome/browser/download/chrome_download_manager_delegate.h"
#include "chrome/browser/download/download_history.h"
#include "chrome/browser/download/download_prefs.h"
+#include "chrome/browser/download/download_service.h"
+#include "chrome/browser/download/download_service_factory.h"
#include "chrome/browser/download/download_util.h"
#include "chrome/browser/platform_util.h"
#include "chrome/browser/profiles/profile.h"
@@ -83,7 +85,9 @@ class DownloadsDOMHandler::OriginalDownloadManagerObserver
DownloadManager::Observer* observer,
Profile* original_profile)
: observer_(observer) {
- original_profile_download_manager_ = original_profile->GetDownloadManager();
+ original_profile_download_manager_ =
+ DownloadServiceFactory::GetForProfile(original_profile)->
+ GetDownloadManager();
original_profile_download_manager_->AddObserver(this);
}
@@ -217,7 +221,8 @@ void DownloadsDOMHandler::ModelChanged() {
Profile* profile =
Profile::FromBrowserContext(download_manager_->browser_context());
if (profile->GetOriginalProfile() != profile) {
- profile->GetOriginalProfile()->GetDownloadManager()->SearchDownloads(
+ DownloadServiceFactory::GetForProfile(
+ profile->GetOriginalProfile())->GetDownloadManager()->SearchDownloads(
WideToUTF16(search_text_), &download_items_);
}
@@ -339,7 +344,8 @@ void DownloadsDOMHandler::HandleClearAll(const ListValue* args) {
// If this is an incognito downloader, clear All should clear main download
// manager as well.
if (profile->GetOriginalProfile() != profile)
- profile->GetOriginalProfile()->GetDownloadManager()->RemoveAllDownloads();
+ DownloadServiceFactory::GetForProfile(profile->GetOriginalProfile())->
+ GetDownloadManager()->RemoveAllDownloads();
}
void DownloadsDOMHandler::HandleOpenDownloadsFolder(const ListValue* args) {

Powered by Google App Engine
This is Rietveld 408576698