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

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

Issue 16693003: Allow continuation after download is interrupted before initial rename. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | content/browser/download/download_item_impl_unittest.cc » ('j') | 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 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after
1154 void DownloadItemImpl::OnDownloadRenamedToIntermediateName( 1154 void DownloadItemImpl::OnDownloadRenamedToIntermediateName(
1155 DownloadInterruptReason reason, 1155 DownloadInterruptReason reason,
1156 const base::FilePath& full_path) { 1156 const base::FilePath& full_path) {
1157 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1157 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1158 VLOG(20) << __FUNCTION__ << " download=" << DebugString(true); 1158 VLOG(20) << __FUNCTION__ << " download=" << DebugString(true);
1159 1159
1160 if (DOWNLOAD_INTERRUPT_REASON_NONE != destination_error_) { 1160 if (DOWNLOAD_INTERRUPT_REASON_NONE != destination_error_) {
1161 // Process destination error. If both |reason| and |destination_error_| 1161 // Process destination error. If both |reason| and |destination_error_|
1162 // refer to actual errors, we want to use the |destination_error_| as the 1162 // refer to actual errors, we want to use the |destination_error_| as the
1163 // argument to the Interrupt() routine, as it happened first. 1163 // argument to the Interrupt() routine, as it happened first.
1164 if (reason == DOWNLOAD_INTERRUPT_REASON_NONE)
1165 SetFullPath(full_path);
1164 Interrupt(destination_error_); 1166 Interrupt(destination_error_);
1165 destination_error_ = DOWNLOAD_INTERRUPT_REASON_NONE; 1167 destination_error_ = DOWNLOAD_INTERRUPT_REASON_NONE;
1166 } else if (DOWNLOAD_INTERRUPT_REASON_NONE != reason) { 1168 } else if (DOWNLOAD_INTERRUPT_REASON_NONE != reason) {
1167 Interrupt(reason); 1169 Interrupt(reason);
1168 // All file errors result in file deletion above; no need to cleanup. The 1170 // All file errors result in file deletion above; no need to cleanup. The
1169 // current_path_ should be empty. Resuming this download will force a 1171 // current_path_ should be empty. Resuming this download will force a
1170 // restart and a re-doing of filename determination. 1172 // restart and a re-doing of filename determination.
1171 DCHECK(current_path_.empty()); 1173 DCHECK(current_path_.empty());
1172 } else { 1174 } else {
1173 SetFullPath(full_path); 1175 SetFullPath(full_path);
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
1691 case RESUME_MODE_USER_CONTINUE: 1693 case RESUME_MODE_USER_CONTINUE:
1692 return "USER_CONTINUE"; 1694 return "USER_CONTINUE";
1693 case RESUME_MODE_USER_RESTART: 1695 case RESUME_MODE_USER_RESTART:
1694 return "USER_RESTART"; 1696 return "USER_RESTART";
1695 } 1697 }
1696 NOTREACHED() << "Unknown resume mode " << mode; 1698 NOTREACHED() << "Unknown resume mode " << mode;
1697 return "unknown"; 1699 return "unknown";
1698 } 1700 }
1699 1701
1700 } // namespace content 1702 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/download/download_item_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698