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

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: 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
« no previous file with comments | « chrome/browser/ui/webui/active_downloads_ui.cc ('k') | chrome/browser/ui/webui/downloads_ui.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 b2f8ecb1acffcb087cd7deb915f77aba165f4625..5cc861bb33443ef369b61fd5c650bb910c5d9423 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,8 +221,9 @@ void DownloadsDOMHandler::ModelChanged() {
Profile* profile =
Profile::FromBrowserContext(download_manager_->browser_context());
if (profile->GetOriginalProfile() != profile) {
- profile->GetOriginalProfile()->GetDownloadManager()->SearchDownloads(
- WideToUTF16(search_text_), &download_items_);
+ DownloadServiceFactory::GetForProfile(
+ profile->GetOriginalProfile())->GetDownloadManager()->SearchDownloads(
+ WideToUTF16(search_text_), &download_items_);
}
sort(download_items_.begin(), download_items_.end(), DownloadItemSorter());
@@ -339,7 +344,9 @@ 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) {
« no previous file with comments | « chrome/browser/ui/webui/active_downloads_ui.cc ('k') | chrome/browser/ui/webui/downloads_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698