Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(613)

Side by Side Diff: content/browser/download/download_request_core.cc

Issue 2256173002: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Replace a WrapUnique() nested inside a MakeUnique() Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_request_core.h" 5 #include "content/browser/download/download_request_core.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 } 129 }
130 130
131 if (params->post_id() >= 0) { 131 if (params->post_id() >= 0) {
132 // The POST in this case does not have an actual body, and only works 132 // The POST in this case does not have an actual body, and only works
133 // when retrieving data from cache. This is done because we don't want 133 // when retrieving data from cache. This is done because we don't want
134 // to do a re-POST without user consent, and currently don't have a good 134 // to do a re-POST without user consent, and currently don't have a good
135 // plan on how to display the UI for that. 135 // plan on how to display the UI for that.
136 DCHECK(params->prefer_cache()); 136 DCHECK(params->prefer_cache());
137 DCHECK_EQ("POST", params->method()); 137 DCHECK_EQ("POST", params->method());
138 std::vector<std::unique_ptr<net::UploadElementReader>> element_readers; 138 std::vector<std::unique_ptr<net::UploadElementReader>> element_readers;
139 request->set_upload(base::WrapUnique(new net::ElementsUploadDataStream( 139 request->set_upload(base::MakeUnique<net::ElementsUploadDataStream>(
140 std::move(element_readers), params->post_id()))); 140 std::move(element_readers), params->post_id()));
141 } 141 }
142 142
143 int load_flags = request->load_flags(); 143 int load_flags = request->load_flags();
144 if (params->prefer_cache()) { 144 if (params->prefer_cache()) {
145 // If there is upload data attached, only retrieve from cache because there 145 // If there is upload data attached, only retrieve from cache because there
146 // is no current mechanism to prompt the user for their consent for a 146 // is no current mechanism to prompt the user for their consent for a
147 // re-post. For GETs, try to retrieve data from the cache and skip 147 // re-post. For GETs, try to retrieve data from the cache and skip
148 // validating the entry if present. 148 // validating the entry if present.
149 if (request->get_upload()) 149 if (request->get_upload())
150 load_flags |= net::LOAD_ONLY_FROM_CACHE; 150 load_flags |= net::LOAD_ONLY_FROM_CACHE;
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 return DOWNLOAD_INTERRUPT_REASON_NONE; 628 return DOWNLOAD_INTERRUPT_REASON_NONE;
629 } 629 }
630 630
631 if (http_headers.response_code() == net::HTTP_PARTIAL_CONTENT) 631 if (http_headers.response_code() == net::HTTP_PARTIAL_CONTENT)
632 return DOWNLOAD_INTERRUPT_REASON_SERVER_BAD_CONTENT; 632 return DOWNLOAD_INTERRUPT_REASON_SERVER_BAD_CONTENT;
633 633
634 return DOWNLOAD_INTERRUPT_REASON_NONE; 634 return DOWNLOAD_INTERRUPT_REASON_NONE;
635 } 635 }
636 636
637 } // namespace content 637 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/dom_storage/dom_storage_context_wrapper.cc ('k') | content/browser/fileapi/dragged_file_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698