| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/download/download_manager_impl.h" | 5 #include "content/browser/download/download_manager_impl.h" |
| 6 | 6 |
| 7 #include <iterator> | 7 #include <iterator> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 void BeginDownload(scoped_ptr<DownloadUrlParameters> params, | 51 void BeginDownload(scoped_ptr<DownloadUrlParameters> params, |
| 52 DownloadId download_id) { | 52 DownloadId download_id) { |
| 53 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 53 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 54 // ResourceDispatcherHost{Base} is-not-a URLRequest::Delegate, and | 54 // ResourceDispatcherHost{Base} is-not-a URLRequest::Delegate, and |
| 55 // DownloadUrlParameters can-not include resource_dispatcher_host_impl.h, so | 55 // DownloadUrlParameters can-not include resource_dispatcher_host_impl.h, so |
| 56 // we must down cast. RDHI is the only subclass of RDH as of 2012 May 4. | 56 // we must down cast. RDHI is the only subclass of RDH as of 2012 May 4. |
| 57 scoped_ptr<net::URLRequest> request( | 57 scoped_ptr<net::URLRequest> request( |
| 58 params->resource_context()->GetRequestContext()->CreateRequest( | 58 params->resource_context()->GetRequestContext()->CreateRequest( |
| 59 params->url(), NULL)); | 59 params->url(), NULL)); |
| 60 if (params->referrer().url.is_valid()) | 60 if (params->referrer().url.is_valid()) |
| 61 request->set_referrer(params->referrer().url.spec()); | 61 request->SetReferrer(params->referrer().url.spec()); |
| 62 webkit_glue::ConfigureURLRequestForReferrerPolicy( | 62 webkit_glue::ConfigureURLRequestForReferrerPolicy( |
| 63 request.get(), params->referrer().policy); | 63 request.get(), params->referrer().policy); |
| 64 request->set_load_flags(request->load_flags() | params->load_flags()); | 64 request->set_load_flags(request->load_flags() | params->load_flags()); |
| 65 request->set_method(params->method()); | 65 request->set_method(params->method()); |
| 66 if (!params->post_body().empty()) { | 66 if (!params->post_body().empty()) { |
| 67 const std::string& body = params->post_body(); | 67 const std::string& body = params->post_body(); |
| 68 scoped_ptr<net::UploadElementReader> reader( | 68 scoped_ptr<net::UploadElementReader> reader( |
| 69 net::UploadOwnedBytesElementReader::CreateWithString(body)); | 69 net::UploadOwnedBytesElementReader::CreateWithString(body)); |
| 70 request->set_upload(make_scoped_ptr( | 70 request->set_upload(make_scoped_ptr( |
| 71 net::UploadDataStream::CreateWithReader(reader.Pass(), 0))); | 71 net::UploadDataStream::CreateWithReader(reader.Pass(), 0))); |
| (...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 663 if (delegate_) | 663 if (delegate_) |
| 664 delegate_->OpenDownload(download); | 664 delegate_->OpenDownload(download); |
| 665 } | 665 } |
| 666 | 666 |
| 667 void DownloadManagerImpl::ShowDownloadInShell(DownloadItemImpl* download) { | 667 void DownloadManagerImpl::ShowDownloadInShell(DownloadItemImpl* download) { |
| 668 if (delegate_) | 668 if (delegate_) |
| 669 delegate_->ShowDownloadInShell(download); | 669 delegate_->ShowDownloadInShell(download); |
| 670 } | 670 } |
| 671 | 671 |
| 672 } // namespace content | 672 } // namespace content |
| OLD | NEW |