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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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)); |
60 request->SetLoadFlags(request->load_flags() | params->load_flags()); | 60 request->set_load_flags(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) { |
70 // The POST in this case does not have an actual body, and only works | 70 // The POST in this case does not have an actual body, and only works |
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 if (delegate_) | 714 if (delegate_) |
715 delegate_->OpenDownload(download); | 715 delegate_->OpenDownload(download); |
716 } | 716 } |
717 | 717 |
718 void DownloadManagerImpl::ShowDownloadInShell(DownloadItemImpl* download) { | 718 void DownloadManagerImpl::ShowDownloadInShell(DownloadItemImpl* download) { |
719 if (delegate_) | 719 if (delegate_) |
720 delegate_->ShowDownloadInShell(download); | 720 delegate_->ShowDownloadInShell(download); |
721 } | 721 } |
722 | 722 |
723 } // namespace content | 723 } // namespace content |
OLD | NEW |