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

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

Issue 795353002: downloads: prevent "Clear all" from removing in progress downloads (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 6 years 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 | « chrome/browser/ui/webui/downloads_dom_handler_browsertest.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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 407
408 RecordDownloadCount(CANCELLED_COUNT); 408 RecordDownloadCount(CANCELLED_COUNT);
409 409
410 // TODO(rdsmith/benjhayden): Remove condition as part of 410 // TODO(rdsmith/benjhayden): Remove condition as part of
411 // |SavePackage| integration. 411 // |SavePackage| integration.
412 // |download_file_| can be NULL if Interrupt() is called after the 412 // |download_file_| can be NULL if Interrupt() is called after the
413 // download file has been released. 413 // download file has been released.
414 if (!is_save_package_download_ && download_file_) 414 if (!is_save_package_download_ && download_file_)
415 ReleaseDownloadFile(true); 415 ReleaseDownloadFile(true);
416 416
417 if (state_ == IN_PROGRESS_INTERNAL) { 417 // |request_handle_| may be NULL during tests.
418 if (state_ == IN_PROGRESS_INTERNAL && request_handle_) {
benjhayden 2014/12/11 23:36:24 Should this be checked everywhere that request_han
Dan Beam 2014/12/12 00:07:02 we talked about this on chat -- adding a way to mo
418 // Cancel the originating URL request unless it's already been cancelled 419 // Cancel the originating URL request unless it's already been cancelled
419 // by interrupt. 420 // by interrupt.
420 request_handle_->CancelRequest(); 421 request_handle_->CancelRequest();
421 } 422 }
422 423
423 // Remove the intermediate file if we are cancelling an interrupted download. 424 // Remove the intermediate file if we are cancelling an interrupted download.
424 // Continuable interruptions leave the intermediate file around. 425 // Continuable interruptions leave the intermediate file around.
425 if ((state_ == INTERRUPTED_INTERNAL || state_ == RESUMING_INTERNAL) && 426 if ((state_ == INTERRUPTED_INTERNAL || state_ == RESUMING_INTERNAL) &&
426 !current_path_.empty()) { 427 !current_path_.empty()) {
427 BrowserThread::PostTask( 428 BrowserThread::PostTask(
(...skipping 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after
1804 case RESUME_MODE_USER_CONTINUE: 1805 case RESUME_MODE_USER_CONTINUE:
1805 return "USER_CONTINUE"; 1806 return "USER_CONTINUE";
1806 case RESUME_MODE_USER_RESTART: 1807 case RESUME_MODE_USER_RESTART:
1807 return "USER_RESTART"; 1808 return "USER_RESTART";
1808 } 1809 }
1809 NOTREACHED() << "Unknown resume mode " << mode; 1810 NOTREACHED() << "Unknown resume mode " << mode;
1810 return "unknown"; 1811 return "unknown";
1811 } 1812 }
1812 1813
1813 } // namespace content 1814 } // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/downloads_dom_handler_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698