summaryrefslogtreecommitdiffstats
path: root/content/browser/download/download_manager.cc
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-19 20:49:52 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-19 20:49:52 +0000
commita0ce3284a4fb3aee664c8ad998fb6c4d4b8d0080 (patch)
tree2a160a7305bbf6ef8f02249fa2c86af28676263c /content/browser/download/download_manager.cc
parentdcc592a99ae6a563a200cf253d1d3856c511582d (diff)
downloadchromium_src-a0ce3284a4fb3aee664c8ad998fb6c4d4b8d0080.zip
chromium_src-a0ce3284a4fb3aee664c8ad998fb6c4d4b8d0080.tar.gz
chromium_src-a0ce3284a4fb3aee664c8ad998fb6c4d4b8d0080.tar.bz2
Move simple download calls to chrome code to use ContentBrowserClient interface.
BUG=82782 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=97477 Review URL: http://codereview.chromium.org/7670086 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97506 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/download/download_manager.cc')
-rw-r--r--content/browser/download/download_manager.cc32
1 files changed, 27 insertions, 5 deletions
diff --git a/content/browser/download/download_manager.cc b/content/browser/download/download_manager.cc
index 8808a10..f84742c 100644
--- a/content/browser/download/download_manager.cc
+++ b/content/browser/download/download_manager.cc
@@ -11,13 +11,13 @@
#include "base/stl_util.h"
#include "base/task.h"
#include "build/build_config.h"
-#include "chrome/browser/browser_process.h"
#include "chrome/browser/download/download_history.h"
#include "chrome/browser/download/download_prefs.h"
#include "chrome/browser/download/download_util.h"
#include "chrome/browser/history/download_history_info.h"
#include "chrome/browser/profiles/profile.h"
#include "content/browser/browser_thread.h"
+#include "content/browser/content_browser_client.h"
#include "content/browser/download/download_create_info.h"
#include "content/browser/download/download_file_manager.h"
#include "content/browser/download/download_item.h"
@@ -30,6 +30,29 @@
#include "content/common/content_notification_types.h"
#include "content/common/notification_service.h"
+namespace {
+
+void BeginDownload(
+ const GURL& url,
+ const GURL& referrer,
+ const DownloadSaveInfo& save_info,
+ int render_process_host_id,
+ int render_view_id,
+ const content::ResourceContext* context) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+
+ content::GetContentClient()->browser()->GetResourceDispatcherHost()->
+ BeginDownload(url,
+ referrer,
+ save_info,
+ true, // Show "Save as" UI.
+ render_process_host_id,
+ render_view_id,
+ *context);
+}
+
+} // namespace
+
DownloadManager::DownloadManager(DownloadManagerDelegate* delegate,
DownloadStatusUpdater* status_updater)
: shutdown_needed_(false),
@@ -215,7 +238,8 @@ bool DownloadManager::Init(Profile* profile) {
// In test mode, there may be no ResourceDispatcherHost. In this case it's
// safe to avoid setting |file_manager_| because we only call a small set of
// functions, none of which need it.
- ResourceDispatcherHost* rdh = g_browser_process->resource_dispatcher_host();
+ ResourceDispatcherHost* rdh =
+ content::GetContentClient()->browser()->GetResourceDispatcherHost();
if (rdh) {
file_manager_ = rdh->download_file_manager();
DCHECK(file_manager_);
@@ -715,12 +739,10 @@ void DownloadManager::DownloadUrlToFile(const GURL& url,
// We send a pointer to content::ResourceContext, instead of the usual
// reference, so that a copy of the object isn't made.
BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
- NewRunnableFunction(&download_util::DownloadUrl,
+ NewRunnableFunction(&BeginDownload,
url,
referrer,
- referrer_charset,
save_info,
- g_browser_process->resource_dispatcher_host(),
tab_contents->GetRenderProcessHost()->id(),
tab_contents->render_view_host()->routing_id(),
&tab_contents->browser_context()->