| Index: content/browser/renderer_host/resource_dispatcher_host.cc
|
| diff --git a/content/browser/renderer_host/resource_dispatcher_host.cc b/content/browser/renderer_host/resource_dispatcher_host.cc
|
| index 6c195272ce7a02be798672fbcf4c504182aa18a7..35e215b9d1743a4538e76fafcb3c6549f33537be 100644
|
| --- a/content/browser/renderer_host/resource_dispatcher_host.cc
|
| +++ b/content/browser/renderer_host/resource_dispatcher_host.cc
|
| @@ -7,6 +7,7 @@
|
| #include "content/browser/renderer_host/resource_dispatcher_host.h"
|
|
|
| #include <set>
|
| +#include <string>
|
| #include <vector>
|
|
|
| #include "base/bind.h"
|
| @@ -18,6 +19,7 @@
|
| #include "base/shared_memory.h"
|
| #include "base/stl_util-inl.h"
|
| #include "base/time.h"
|
| +#include "base/values.h"
|
| #include "chrome/browser/download/download_file_manager.h"
|
| #include "chrome/browser/download/download_manager.h"
|
| #include "chrome/browser/download/download_request_limiter.h"
|
| @@ -677,6 +679,11 @@ void ResourceDispatcherHost::BeginDownload(
|
| const GURL& referrer,
|
| const DownloadSaveInfo& save_info,
|
| bool prompt_for_save_location,
|
| + std::string method,
|
| + DictionaryValue* extra_headers,
|
| + std::string post_body,
|
| + DownloadResourceHandler::OnResponseStartedCallback started_cb,
|
| + DownloadResourceHandler::OnUnstartableCallback unstartable_cb,
|
| int child_id,
|
| int route_id,
|
| const content::ResourceContext& context) {
|
| @@ -709,10 +716,13 @@ void ResourceDispatcherHost::BeginDownload(
|
| download_file_manager_.get(),
|
| request,
|
| prompt_for_save_location,
|
| + started_cb,
|
| + unstartable_cb,
|
| save_info));
|
|
|
| - if (delegate_)
|
| + if (delegate_) {
|
| handler = delegate_->DownloadStarting(handler, child_id, route_id);
|
| + }
|
|
|
| const net::URLRequestContext* request_context = context.request_context();
|
|
|
| @@ -721,13 +731,32 @@ void ResourceDispatcherHost::BeginDownload(
|
| << url.possibly_invalid_spec();
|
| return;
|
| }
|
| + if (method.empty()) {
|
| + method = "GET";
|
| + }
|
|
|
| - request->set_method("GET");
|
| + request->set_method(method);
|
| request->set_referrer(MaybeStripReferrer(referrer).spec());
|
| request->set_context(context.request_context());
|
| request->set_load_flags(request->load_flags() |
|
| net::LOAD_IS_DOWNLOAD);
|
|
|
| + if (extra_headers != NULL) {
|
| + DictionaryValue::key_iterator headers_end = extra_headers->end_keys();
|
| + for (DictionaryValue::key_iterator headers_iter =
|
| + extra_headers->begin_keys();
|
| + headers_iter != headers_end; ++headers_iter) {
|
| + std::string value;
|
| + if (extra_headers->GetStringWithoutPathExpansion(*headers_iter, &value)) {
|
| + request->SetExtraRequestHeaderByName(
|
| + *headers_iter, value, false/*overwrite*/);
|
| + }
|
| + }
|
| + }
|
| + if (!post_body.empty()) {
|
| + request->AppendBytesToUpload(post_body.data(), post_body.size());
|
| + }
|
| +
|
| ResourceDispatcherHostRequestInfo* extra_info =
|
| CreateRequestInfoForBrowserRequest(
|
| handler, child_id, route_id, true, context);
|
|
|