Chromium Code Reviews| Index: content/browser/download/download_manager_impl.cc |
| diff --git a/content/browser/download/download_manager_impl.cc b/content/browser/download/download_manager_impl.cc |
| index 65f60c9c1c8162aae0d4f785538ad6dab76c0c6c..3cd4360f50b85316a09880585127d5e861010290 100644 |
| --- a/content/browser/download/download_manager_impl.cc |
| +++ b/content/browser/download/download_manager_impl.cc |
| @@ -36,6 +36,7 @@ |
| #include "content/public/browser/notification_types.h" |
| #include "content/public/browser/render_process_host.h" |
| #include "content/public/browser/web_contents_delegate.h" |
| +#include "net/base/upload_data.h" |
| // TODO(benjhayden): Change this to DCHECK when we have more debugging |
| // information from the next dev cycle, before the next stable/beta branch is |
| @@ -56,10 +57,11 @@ namespace { |
| // Param structs exist because base::Bind can only handle 6 args. |
| struct URLParams { |
| - URLParams(const GURL& url, const GURL& referrer) |
| - : url_(url), referrer_(referrer) {} |
| + URLParams(const GURL& url, const GURL& referrer, int64 post_id) |
| + : url_(url), referrer_(referrer), post_id_(post_id) {} |
| GURL url_; |
| GURL referrer_; |
| + int64 post_id_; |
| }; |
| struct RenderParams { |
| @@ -78,6 +80,15 @@ void BeginDownload(const URLParams& url_params, |
| scoped_ptr<net::URLRequest> request( |
| new net::URLRequest(url_params.url_, resource_dispatcher_host)); |
| request->set_referrer(url_params.referrer_.spec()); |
| + if (url_params.post_id_ >= 0) { |
|
Randy Smith (Not in Mondays)
2012/02/02 19:46:10
If we decide that we eventually want to support PO
cbentzel
2012/02/03 15:54:47
Done.
|
| + // The POST in this case does not have an actual body, and only works |
| + // when retrieving data from cache. |
| + DCHECK(prefer_cache); |
| + request->set_method("POST"); |
| + scoped_refptr<net::UploadData> upload_data = new net::UploadData(); |
| + upload_data->set_identifier(url_params.post_id_); |
| + request->set_upload(upload_data); |
| + } |
| resource_dispatcher_host->BeginDownload( |
| request.Pass(), prefer_cache, save_info, |
| DownloadResourceHandler::OnStartedCallback(), |
| @@ -835,6 +846,7 @@ void DownloadManagerImpl::DownloadUrl( |
| const GURL& referrer, |
| const std::string& referrer_charset, |
| bool prefer_cache, |
| + int64 post_id, |
| const DownloadSaveInfo& save_info, |
| WebContents* web_contents) { |
| ResourceDispatcherHost* resource_dispatcher_host = |
| @@ -847,7 +859,7 @@ void DownloadManagerImpl::DownloadUrl( |
| BrowserThread::IO, FROM_HERE, |
| base::Bind( |
| &BeginDownload, |
| - URLParams(url, referrer), |
| + URLParams(url, referrer, post_id), |
| prefer_cache, |
| save_info, |
| resource_dispatcher_host, |