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

Unified Diff: chrome/browser/download/download_util.cc

Issue 2805091: Download code cleanup: (Closed)
Patch Set: rebased Created 10 years, 5 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/download/download_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/download/download_util.cc
diff --git a/chrome/browser/download/download_util.cc b/chrome/browser/download/download_util.cc
index a3e064f939bea9461e7c72990146d047f4cae925..a5323272b92501aa1ae0bdb8a26ca2b8ee69472f 100644
--- a/chrome/browser/download/download_util.cc
+++ b/chrome/browser/download/download_util.cc
@@ -22,9 +22,12 @@
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/download/download_item.h"
#include "chrome/browser/download/download_item_model.h"
#include "chrome/browser/download/download_manager.h"
+#include "chrome/browser/net/chrome_url_request_context.h"
+#include "chrome/browser/renderer_host/resource_dispatcher_host.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/time_format.h"
@@ -515,4 +518,34 @@ int GetUniquePathNumber(const FilePath& path) {
return -1;
}
+void DownloadUrl(
+ const GURL& url,
+ const GURL& referrer,
+ const std::string& referrer_charset,
+ const DownloadSaveInfo& save_info,
+ ResourceDispatcherHost* rdh,
+ int render_process_host_id,
+ int render_view_id,
+ URLRequestContextGetter* request_context_getter) {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
+
+ URLRequestContext* context = request_context_getter->GetURLRequestContext();
+ context->set_referrer_charset(referrer_charset);
+
+ rdh->BeginDownload(url,
+ referrer,
+ save_info,
+ true, // Show "Save as" UI.
+ render_process_host_id,
+ render_view_id,
+ context);
+}
+
+void CancelDownloadRequest(ResourceDispatcherHost* rdh,
+ int render_process_id,
+ int request_id) {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
+ rdh->CancelRequest(render_process_id, request_id, false);
+}
+
} // namespace download_util
« no previous file with comments | « chrome/browser/download/download_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698