Chromium Code Reviews| 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 // 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 1430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1441 last_reason_ = reason; | 1441 last_reason_ = reason; |
| 1442 | 1442 |
| 1443 ResumeMode resume_mode = GetResumeMode(); | 1443 ResumeMode resume_mode = GetResumeMode(); |
| 1444 | 1444 |
| 1445 if (state_ == IN_PROGRESS_INTERNAL) { | 1445 if (state_ == IN_PROGRESS_INTERNAL) { |
| 1446 // Cancel (delete file) if we're going to restart; no point in leaving | 1446 // Cancel (delete file) if we're going to restart; no point in leaving |
| 1447 // data around we aren't going to use. Also cancel if resumption isn't | 1447 // data around we aren't going to use. Also cancel if resumption isn't |
| 1448 // enabled for the same reason. | 1448 // enabled for the same reason. |
| 1449 ReleaseDownloadFile(resume_mode == RESUME_MODE_IMMEDIATE_RESTART || | 1449 ReleaseDownloadFile(resume_mode == RESUME_MODE_IMMEDIATE_RESTART || |
| 1450 resume_mode == RESUME_MODE_USER_RESTART || | 1450 resume_mode == RESUME_MODE_USER_RESTART || |
| 1451 (resume_mode == RESUME_MODE_INVALID && | |
|
asanka
2014/03/04 21:17:49
You can just check for resume_mode == RESUME_MODE_
| |
| 1452 last_reason_ != DOWNLOAD_INTERRUPT_REASON_NONE) || | |
| 1451 !IsDownloadResumptionEnabled()); | 1453 !IsDownloadResumptionEnabled()); |
| 1452 | 1454 |
| 1453 // Cancel the originating URL request. | 1455 // Cancel the originating URL request. |
| 1454 request_handle_->CancelRequest(); | 1456 request_handle_->CancelRequest(); |
| 1455 } else { | 1457 } else { |
| 1456 DCHECK(!download_file_.get()); | 1458 DCHECK(!download_file_.get()); |
| 1457 } | 1459 } |
| 1458 | 1460 |
| 1459 // Reset all data saved, as even if we did save all the data we're going | 1461 // Reset all data saved, as even if we did save all the data we're going |
| 1460 // to go through another round of downloading when we resume. | 1462 // to go through another round of downloading when we resume. |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1782 case RESUME_MODE_USER_CONTINUE: | 1784 case RESUME_MODE_USER_CONTINUE: |
| 1783 return "USER_CONTINUE"; | 1785 return "USER_CONTINUE"; |
| 1784 case RESUME_MODE_USER_RESTART: | 1786 case RESUME_MODE_USER_RESTART: |
| 1785 return "USER_RESTART"; | 1787 return "USER_RESTART"; |
| 1786 } | 1788 } |
| 1787 NOTREACHED() << "Unknown resume mode " << mode; | 1789 NOTREACHED() << "Unknown resume mode " << mode; |
| 1788 return "unknown"; | 1790 return "unknown"; |
| 1789 } | 1791 } |
| 1790 | 1792 |
| 1791 } // namespace content | 1793 } // namespace content |
| OLD | NEW |