| 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
|
|
|