| 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 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ |
| 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ | 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 // These are listed in approximately chronological order. There are also | 401 // These are listed in approximately chronological order. There are also |
| 402 // public methods involved in normal download progression; see | 402 // public methods involved in normal download progression; see |
| 403 // the implementation ordering in download_item_impl.cc. | 403 // the implementation ordering in download_item_impl.cc. |
| 404 | 404 |
| 405 // Construction common to all constructors. |active| should be true for new | 405 // Construction common to all constructors. |active| should be true for new |
| 406 // downloads and false for downloads from the history. | 406 // downloads and false for downloads from the history. |
| 407 // |download_type| indicates to the net log system what kind of download | 407 // |download_type| indicates to the net log system what kind of download |
| 408 // this is. | 408 // this is. |
| 409 void Init(bool active, DownloadType download_type); | 409 void Init(bool active, DownloadType download_type); |
| 410 | 410 |
| 411 // Start a series of events that result in the file being downloaded. | |
| 412 void StartDownload(); | |
| 413 | |
| 414 // Callback from file thread when we initialize the DownloadFile. | 411 // Callback from file thread when we initialize the DownloadFile. |
| 415 void OnDownloadFileInitialized(DownloadInterruptReason result); | 412 void OnDownloadFileInitialized(DownloadInterruptReason result); |
| 416 | 413 |
| 417 // Called to determine the target path. Will cause OnDownloadTargetDetermined | 414 // Called to determine the target path. Will cause OnDownloadTargetDetermined |
| 418 // to be called when the target information is available. | 415 // to be called when the target information is available. |
| 419 void DetermineDownloadTarget(); | 416 void DetermineDownloadTarget(); |
| 420 | 417 |
| 421 // Called when the target path has been determined. |target_path| is the | 418 // Called when the target path has been determined. |target_path| is the |
| 422 // suggested target path. |disposition| indicates how the target path should | 419 // suggested target path. |disposition| indicates how the target path should |
| 423 // be used (see TargetDisposition). |danger_type| is the danger level of | 420 // be used (see TargetDisposition). |danger_type| is the danger level of |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 void AutoResumeIfValid(); | 497 void AutoResumeIfValid(); |
| 501 | 498 |
| 502 enum class ResumptionRequestSource { AUTOMATIC, USER }; | 499 enum class ResumptionRequestSource { AUTOMATIC, USER }; |
| 503 void ResumeInterruptedDownload(ResumptionRequestSource source); | 500 void ResumeInterruptedDownload(ResumptionRequestSource source); |
| 504 | 501 |
| 505 // Update origin information based on the response to a download resumption | 502 // Update origin information based on the response to a download resumption |
| 506 // request. Should only be called if the resumption request was successful. | 503 // request. Should only be called if the resumption request was successful. |
| 507 virtual void UpdateValidatorsOnResumption( | 504 virtual void UpdateValidatorsOnResumption( |
| 508 const DownloadCreateInfo& new_create_info); | 505 const DownloadCreateInfo& new_create_info); |
| 509 | 506 |
| 510 // Cancel a particular request that starts from |offset|. | |
| 511 void CancelRequestWithOffset(int64_t offset); | |
| 512 | |
| 513 static DownloadState InternalToExternalState( | 507 static DownloadState InternalToExternalState( |
| 514 DownloadInternalState internal_state); | 508 DownloadInternalState internal_state); |
| 515 static DownloadInternalState ExternalToInternalState( | 509 static DownloadInternalState ExternalToInternalState( |
| 516 DownloadState external_state); | 510 DownloadState external_state); |
| 517 | 511 |
| 518 // Debugging routines -------------------------------------------------------- | 512 // Debugging routines -------------------------------------------------------- |
| 519 static const char* DebugDownloadStateString(DownloadInternalState state); | 513 static const char* DebugDownloadStateString(DownloadInternalState state); |
| 520 static const char* DebugResumeModeString(ResumeMode mode); | 514 static const char* DebugResumeModeString(ResumeMode mode); |
| 521 static bool IsValidSavePackageStateTransition(DownloadInternalState from, | 515 static bool IsValidSavePackageStateTransition(DownloadInternalState from, |
| 522 DownloadInternalState to); | 516 DownloadInternalState to); |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 int64_t received_bytes_at_length_mismatch = -1; | 712 int64_t received_bytes_at_length_mismatch = -1; |
| 719 | 713 |
| 720 base::WeakPtrFactory<DownloadItemImpl> weak_ptr_factory_; | 714 base::WeakPtrFactory<DownloadItemImpl> weak_ptr_factory_; |
| 721 | 715 |
| 722 DISALLOW_COPY_AND_ASSIGN(DownloadItemImpl); | 716 DISALLOW_COPY_AND_ASSIGN(DownloadItemImpl); |
| 723 }; | 717 }; |
| 724 | 718 |
| 725 } // namespace content | 719 } // namespace content |
| 726 | 720 |
| 727 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ | 721 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ |
| OLD | NEW |