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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 request->set_upload( | 66 request->set_upload( |
67 net::ElementsUploadDataStream::CreateWithReader(reader.Pass(), 0)); | 67 net::ElementsUploadDataStream::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 |
71 // when retrieving data from cache. This is done because we don't want | 71 // when retrieving data from cache. This is done because we don't want |
72 // to do a re-POST without user consent, and currently don't have a good | 72 // to do a re-POST without user consent, and currently don't have a good |
73 // plan on how to display the UI for that. | 73 // plan on how to display the UI for that. |
74 DCHECK(params->prefer_cache()); | 74 DCHECK(params->prefer_cache()); |
75 DCHECK_EQ("POST", params->method()); | 75 DCHECK_EQ("POST", params->method()); |
76 ScopedVector<net::UploadElementReader> element_readers; | 76 std::vector<scoped_ptr<net::UploadElementReader>> element_readers; |
77 request->set_upload(make_scoped_ptr( | 77 request->set_upload(make_scoped_ptr(new net::ElementsUploadDataStream( |
78 new net::ElementsUploadDataStream(element_readers.Pass(), | 78 std::move(element_readers), params->post_id()))); |
79 params->post_id()))); | |
80 } | 79 } |
81 | 80 |
82 // If we're not at the beginning of the file, retrieve only the remaining | 81 // If we're not at the beginning of the file, retrieve only the remaining |
83 // portion. | 82 // portion. |
84 bool has_last_modified = !params->last_modified().empty(); | 83 bool has_last_modified = !params->last_modified().empty(); |
85 bool has_etag = !params->etag().empty(); | 84 bool has_etag = !params->etag().empty(); |
86 | 85 |
87 // If we've asked for a range, we want to make sure that we only | 86 // If we've asked for a range, we want to make sure that we only |
88 // get that range if our current copy of the information is good. | 87 // get that range if our current copy of the information is good. |
89 // We shouldn't be asked to continue if we don't have a verifier. | 88 // We shouldn't be asked to continue if we don't have a verifier. |
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 if (delegate_) | 748 if (delegate_) |
750 delegate_->OpenDownload(download); | 749 delegate_->OpenDownload(download); |
751 } | 750 } |
752 | 751 |
753 void DownloadManagerImpl::ShowDownloadInShell(DownloadItemImpl* download) { | 752 void DownloadManagerImpl::ShowDownloadInShell(DownloadItemImpl* download) { |
754 if (delegate_) | 753 if (delegate_) |
755 delegate_->ShowDownloadInShell(download); | 754 delegate_->ShowDownloadInShell(download); |
756 } | 755 } |
757 | 756 |
758 } // namespace content | 757 } // namespace content |
OLD | NEW |