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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 namespace { | 49 namespace { |
50 | 50 |
51 void BeginDownload(scoped_ptr<DownloadUrlParameters> params, | 51 void BeginDownload(scoped_ptr<DownloadUrlParameters> params, |
52 uint32 download_id) { | 52 uint32 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(), net::DEFAULT_PRIORITY, NULL)); | 59 params->url(), net::DEFAULT_PRIORITY, NULL, NULL)); |
60 request->SetLoadFlags(request->load_flags() | params->load_flags()); | 60 request->SetLoadFlags(request->load_flags() | params->load_flags()); |
61 request->set_method(params->method()); | 61 request->set_method(params->method()); |
62 if (!params->post_body().empty()) { | 62 if (!params->post_body().empty()) { |
63 const std::string& body = params->post_body(); | 63 const std::string& body = params->post_body(); |
64 scoped_ptr<net::UploadElementReader> reader( | 64 scoped_ptr<net::UploadElementReader> reader( |
65 net::UploadOwnedBytesElementReader::CreateWithString(body)); | 65 net::UploadOwnedBytesElementReader::CreateWithString(body)); |
66 request->set_upload(make_scoped_ptr( | 66 request->set_upload(make_scoped_ptr( |
67 net::UploadDataStream::CreateWithReader(reader.Pass(), 0))); | 67 net::UploadDataStream::CreateWithReader(reader.Pass(), 0))); |
68 } | 68 } |
69 if (params->post_id() >= 0) { | 69 if (params->post_id() >= 0) { |
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 if (delegate_) | 708 if (delegate_) |
709 delegate_->OpenDownload(download); | 709 delegate_->OpenDownload(download); |
710 } | 710 } |
711 | 711 |
712 void DownloadManagerImpl::ShowDownloadInShell(DownloadItemImpl* download) { | 712 void DownloadManagerImpl::ShowDownloadInShell(DownloadItemImpl* download) { |
713 if (delegate_) | 713 if (delegate_) |
714 delegate_->ShowDownloadInShell(download); | 714 delegate_->ShowDownloadInShell(download); |
715 } | 715 } |
716 | 716 |
717 } // namespace content | 717 } // namespace content |
OLD | NEW |