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

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

Issue 2770303002: Add a helper method to truncate SourceStream's length (Closed)
Patch Set: nit Created 3 years, 9 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
« no previous file with comments | « content/browser/download/download_file_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // File method ordering: Methods in this file are in the same order as 5 // File method ordering: Methods in this file are in the same order as
6 // in download_item_impl.h, with the following exception: The public 6 // in download_item_impl.h, with the following exception: The public
7 // interface Start is placed in chronological order with the other 7 // interface Start is placed in chronological order with the other
8 // (private) routines that together define a DownloadItem's state 8 // (private) routines that together define a DownloadItem's state
9 // transitions as the download progresses. See "Download progression 9 // transitions as the download progresses. See "Download progression
10 // cascade" later in this file. 10 // cascade" later in this file.
(...skipping 1962 matching lines...) Expand 10 before | Expand all | Expand 10 after
1973 // request will not be dropped if the WebContents (and by extension, the 1973 // request will not be dropped if the WebContents (and by extension, the
1974 // associated renderer) goes away before a response is received. 1974 // associated renderer) goes away before a response is received.
1975 std::unique_ptr<DownloadUrlParameters> download_params( 1975 std::unique_ptr<DownloadUrlParameters> download_params(
1976 new DownloadUrlParameters(GetURL(), 1976 new DownloadUrlParameters(GetURL(),
1977 storage_partition->GetURLRequestContext())); 1977 storage_partition->GetURLRequestContext()));
1978 download_params->set_file_path(GetFullPath()); 1978 download_params->set_file_path(GetFullPath());
1979 if (received_slices_.size() > 0) { 1979 if (received_slices_.size() > 0) {
1980 std::vector<DownloadItem::ReceivedSlice> slices_to_download 1980 std::vector<DownloadItem::ReceivedSlice> slices_to_download
1981 = FindSlicesToDownload(received_slices_); 1981 = FindSlicesToDownload(received_slices_);
1982 download_params->set_offset(slices_to_download[0].offset); 1982 download_params->set_offset(slices_to_download[0].offset);
1983 download_params->set_length(slices_to_download[0].received_bytes);
1984 } else { 1983 } else {
1985 download_params->set_offset(GetReceivedBytes()); 1984 download_params->set_offset(GetReceivedBytes());
1986 } 1985 }
1987 download_params->set_last_modified(GetLastModifiedTime()); 1986 download_params->set_last_modified(GetLastModifiedTime());
1988 download_params->set_etag(GetETag()); 1987 download_params->set_etag(GetETag());
1989 download_params->set_hash_of_partial_file(hash_); 1988 download_params->set_hash_of_partial_file(hash_);
1990 download_params->set_hash_state(std::move(hash_state_)); 1989 download_params->set_hash_state(std::move(hash_state_));
1991 1990
1992 // Note that resumed downloads disallow redirects. Hence the referrer URL 1991 // Note that resumed downloads disallow redirects. Hence the referrer URL
1993 // (which is the contents of the Referer header for the last download request) 1992 // (which is the contents of the Referer header for the last download request)
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
2175 case RESUME_MODE_USER_CONTINUE: 2174 case RESUME_MODE_USER_CONTINUE:
2176 return "USER_CONTINUE"; 2175 return "USER_CONTINUE";
2177 case RESUME_MODE_USER_RESTART: 2176 case RESUME_MODE_USER_RESTART:
2178 return "USER_RESTART"; 2177 return "USER_RESTART";
2179 } 2178 }
2180 NOTREACHED() << "Unknown resume mode " << mode; 2179 NOTREACHED() << "Unknown resume mode " << mode;
2181 return "unknown"; 2180 return "unknown";
2182 } 2181 }
2183 2182
2184 } // namespace content 2183 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/download_file_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698