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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
366 | 366 |
367 case COMPLETING_INTERNAL: | 367 case COMPLETING_INTERNAL: |
368 case COMPLETE_INTERNAL: | 368 case COMPLETE_INTERNAL: |
369 case CANCELLED_INTERNAL: | 369 case CANCELLED_INTERNAL: |
370 case RESUMING_INTERNAL: | 370 case RESUMING_INTERNAL: |
371 return; | 371 return; |
372 | 372 |
373 case INTERRUPTED_INTERNAL: | 373 case INTERRUPTED_INTERNAL: |
374 auto_resume_count_ = 0; // User input resets the counter. | 374 auto_resume_count_ = 0; // User input resets the counter. |
375 ResumeInterruptedDownload(); | 375 ResumeInterruptedDownload(); |
376 UpdateObservers(); | |
svaldez
2016/01/13 17:29:18
Does this need to go at the bottom of "AutoResumeI
asanka
2016/01/28 02:24:17
Nope. AutoResumeIfValid() may or may not resume th
| |
376 return; | 377 return; |
377 | 378 |
378 case MAX_DOWNLOAD_INTERNAL_STATE: | 379 case MAX_DOWNLOAD_INTERNAL_STATE: |
379 NOTREACHED(); | 380 NOTREACHED(); |
380 } | 381 } |
381 } | 382 } |
382 | 383 |
383 void DownloadItemImpl::Cancel(bool user_cancel) { | 384 void DownloadItemImpl::Cancel(bool user_cancel) { |
384 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 385 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
385 | 386 |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
886 mode = RESUME_MODE_USER_RESTART; | 887 mode = RESUME_MODE_USER_RESTART; |
887 else | 888 else |
888 mode = RESUME_MODE_IMMEDIATE_RESTART; | 889 mode = RESUME_MODE_IMMEDIATE_RESTART; |
889 break; | 890 break; |
890 | 891 |
891 case DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED: | 892 case DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED: |
892 case DOWNLOAD_INTERRUPT_REASON_NETWORK_DISCONNECTED: | 893 case DOWNLOAD_INTERRUPT_REASON_NETWORK_DISCONNECTED: |
893 case DOWNLOAD_INTERRUPT_REASON_NETWORK_SERVER_DOWN: | 894 case DOWNLOAD_INTERRUPT_REASON_NETWORK_SERVER_DOWN: |
894 case DOWNLOAD_INTERRUPT_REASON_NETWORK_INVALID_REQUEST: | 895 case DOWNLOAD_INTERRUPT_REASON_NETWORK_INVALID_REQUEST: |
895 case DOWNLOAD_INTERRUPT_REASON_SERVER_FAILED: | 896 case DOWNLOAD_INTERRUPT_REASON_SERVER_FAILED: |
897 case DOWNLOAD_INTERRUPT_REASON_SERVER_UNREACHABLE: | |
896 case DOWNLOAD_INTERRUPT_REASON_USER_SHUTDOWN: | 898 case DOWNLOAD_INTERRUPT_REASON_USER_SHUTDOWN: |
897 case DOWNLOAD_INTERRUPT_REASON_CRASH: | 899 case DOWNLOAD_INTERRUPT_REASON_CRASH: |
898 if (force_restart) | 900 if (force_restart) |
899 mode = RESUME_MODE_USER_RESTART; | 901 mode = RESUME_MODE_USER_RESTART; |
900 else | 902 else |
901 mode = RESUME_MODE_USER_CONTINUE; | 903 mode = RESUME_MODE_USER_CONTINUE; |
902 break; | 904 break; |
903 | 905 |
904 case DOWNLOAD_INTERRUPT_REASON_FILE_FAILED: | 906 case DOWNLOAD_INTERRUPT_REASON_FILE_FAILED: |
905 case DOWNLOAD_INTERRUPT_REASON_FILE_ACCESS_DENIED: | 907 case DOWNLOAD_INTERRUPT_REASON_FILE_ACCESS_DENIED: |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1411 void DownloadItemImpl::OnResumeRequestStarted( | 1413 void DownloadItemImpl::OnResumeRequestStarted( |
1412 DownloadItem* item, | 1414 DownloadItem* item, |
1413 DownloadInterruptReason interrupt_reason) { | 1415 DownloadInterruptReason interrupt_reason) { |
1414 // If |item| is not NULL, then Start() has been called already, and nothing | 1416 // If |item| is not NULL, then Start() has been called already, and nothing |
1415 // more needs to be done here. | 1417 // more needs to be done here. |
1416 if (item) { | 1418 if (item) { |
1417 DCHECK_EQ(DOWNLOAD_INTERRUPT_REASON_NONE, interrupt_reason); | 1419 DCHECK_EQ(DOWNLOAD_INTERRUPT_REASON_NONE, interrupt_reason); |
1418 DCHECK_EQ(static_cast<DownloadItem*>(this), item); | 1420 DCHECK_EQ(static_cast<DownloadItem*>(this), item); |
1419 return; | 1421 return; |
1420 } | 1422 } |
1423 | |
1421 // Otherwise, the request failed without passing through | 1424 // Otherwise, the request failed without passing through |
1422 // DownloadResourceHandler::OnResponseStarted. | 1425 // DownloadResourceHandler::OnResponseStarted. |
1423 DCHECK_NE(DOWNLOAD_INTERRUPT_REASON_NONE, interrupt_reason); | 1426 DCHECK_NE(DOWNLOAD_INTERRUPT_REASON_NONE, interrupt_reason); |
1424 Interrupt(interrupt_reason); | 1427 Interrupt(interrupt_reason); |
1425 } | 1428 } |
1426 | 1429 |
1427 // **** End of Download progression cascade | 1430 // **** End of Download progression cascade |
1428 | 1431 |
1429 // An error occurred somewhere. | 1432 // An error occurred somewhere. |
1430 void DownloadItemImpl::Interrupt(DownloadInterruptReason reason) { | 1433 void DownloadItemImpl::Interrupt(DownloadInterruptReason reason) { |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1786 case RESUME_MODE_USER_CONTINUE: | 1789 case RESUME_MODE_USER_CONTINUE: |
1787 return "USER_CONTINUE"; | 1790 return "USER_CONTINUE"; |
1788 case RESUME_MODE_USER_RESTART: | 1791 case RESUME_MODE_USER_RESTART: |
1789 return "USER_RESTART"; | 1792 return "USER_RESTART"; |
1790 } | 1793 } |
1791 NOTREACHED() << "Unknown resume mode " << mode; | 1794 NOTREACHED() << "Unknown resume mode " << mode; |
1792 return "unknown"; | 1795 return "unknown"; |
1793 } | 1796 } |
1794 | 1797 |
1795 } // namespace content | 1798 } // namespace content |
OLD | NEW |