From 90dce4d38c5ff5333bea97d859d4e484e27edf0c Mon Sep 17 00:00:00 2001 From: "Torne (Richard Coles)" Date: Wed, 29 May 2013 14:40:03 +0100 Subject: Merge from Chromium at DEPS revision r202854 This commit was generated by merge_to_master.py. Change-Id: Idca323f71ef844a9e04f454d4f070b1e398f2deb --- content/browser/download/download_item_impl.h | 85 +++++++++++++++++++-------- 1 file changed, 60 insertions(+), 25 deletions(-) (limited to 'content/browser/download/download_item_impl.h') diff --git a/content/browser/download/download_item_impl.h b/content/browser/download/download_item_impl.h index 083a1591ab..0acc83022b 100644 --- a/content/browser/download/download_item_impl.h +++ b/content/browser/download/download_item_impl.h @@ -104,6 +104,7 @@ class CONTENT_EXPORT DownloadItemImpl virtual DownloadInterruptReason GetLastReason() const OVERRIDE; virtual bool IsPaused() const OVERRIDE; virtual bool IsTemporary() const OVERRIDE; + virtual bool CanResume() const OVERRIDE; virtual bool IsPartialDownload() const OVERRIDE; virtual bool IsInProgress() const OVERRIDE; virtual bool IsCancelled() const OVERRIDE; @@ -126,7 +127,6 @@ class CONTENT_EXPORT DownloadItemImpl virtual const base::FilePath& GetFullPath() const OVERRIDE; virtual const base::FilePath& GetTargetFilePath() const OVERRIDE; virtual const base::FilePath& GetForcedFilePath() const OVERRIDE; - virtual base::FilePath GetUserVerifiedFilePath() const OVERRIDE; virtual base::FilePath GetFileNameToReportUser() const OVERRIDE; virtual TargetDisposition GetTargetDisposition() const OVERRIDE; virtual const std::string& GetHash() const OVERRIDE; @@ -196,57 +196,89 @@ class CONTENT_EXPORT DownloadItemImpl // Called by SavePackage to set the total number of bytes on the item. virtual void SetTotalBytes(int64 total_bytes); - // Indicate progress in saving data to its destination. - // |bytes_so_far| is the number of bytes received so far. - // |hash_state| is the current hash state. - virtual void UpdateProgress(int64 bytes_so_far, - int64 bytes_per_sec, - const std::string& hash_state); - virtual void OnAllDataSaved(const std::string& final_hash); // Called by SavePackage to display progress when the DownloadItem // should be considered complete. virtual void MarkAsComplete(); + // DownloadDestinationObserver + virtual void DestinationUpdate(int64 bytes_so_far, + int64 bytes_per_sec, + const std::string& hash_state) OVERRIDE; + virtual void DestinationError(DownloadInterruptReason reason) OVERRIDE; + virtual void DestinationCompleted(const std::string& final_hash) OVERRIDE; + private: - // Fine grained states of a download. - enum DownloadInternalState { - // Unless otherwise specified, state transitions are linear forward - // in this list. + // Fine grained states of a download. Note that active downloads are created + // in IN_PROGRESS_INTERNAL state. However, downloads creates via history can + // be created in COMPLETE_INTERNAL, CANCELLED_INTERNAL and + // INTERRUPTED_INTERNAL. - // Includes both before and after file name determination. + enum DownloadInternalState { + // Includes both before and after file name determination, and paused + // downloads. // TODO(rdsmith): Put in state variable for file name determination. + // Transitions from: + // Active downloads are created in this state. + // RESUMING_INTERNAL + // Transitions to: + // COMPLETING_INTERNAL On final rename completion. + // CANCELLED_INTERNAL On cancel. + // INTERRUPTED_INTERNAL On interrupt. + // COMPLETE_INTERNAL On SavePackage download completion. IN_PROGRESS_INTERNAL, // Between commit point (dispatch of download file release) and completed. - // Embedder may be opening the file in this state. Note that the - // DownloadItem may be deleted (by shutdown) or interrupted (e.g. due to a - // failure during AnnotateWithSourceInformation()) in this state. + // Embedder may be opening the file in this state. + // Transitions from: + // IN_PROGRESS_INTERNAL + // Transitions to: + // COMPLETE_INTERNAL On successful completion. COMPLETING_INTERNAL, // After embedder has had a chance to auto-open. User may now open // or auto-open based on extension. + // Transitions from: + // COMPLETING_INTERNAL + // IN_PROGRESS_INTERNAL SavePackage only. + // Completed persisted downloads. + // Transitions to: + // Terminal state. COMPLETE_INTERNAL, // User has cancelled the download. - // Only incoming transition IN_PROGRESS-> + // Transitions from: + // IN_PROGRESS_INTERNAL + // INTERRUPTED_INTERNAL + // RESUMING_INTERNAL + // Canceleld persisted downloads. + // Transitions to: + // Terminal state. CANCELLED_INTERNAL, // An error has interrupted the download. - // Only incoming transition IN_PROGRESS-> + // Transitions from: + // IN_PROGRESS_INTERNAL + // RESUMING_INTERNAL + // Interrupted persisted downloads. + // Transitions to: + // RESUMING_INTERNAL On resumption. INTERRUPTED_INTERNAL, + // A request to resume this interrupted download is in progress. + // Transitions from: + // INTERRUPTED_INTERNAL + // Transitions to: + // IN_PROGRESS_INTERNAL Once a server response is received from a + // resumption. + // INTERRUPTED_INTERNAL If the resumption request fails. + // CANCELLED_INTERNAL On cancel. + RESUMING_INTERNAL, + MAX_DOWNLOAD_INTERNAL_STATE, }; - // DownloadDestinationObserver - virtual void DestinationUpdate(int64 bytes_so_far, - int64 bytes_per_sec, - const std::string& hash_state) OVERRIDE; - virtual void DestinationError(DownloadInterruptReason reason) OVERRIDE; - virtual void DestinationCompleted(const std::string& final_hash) OVERRIDE; - // Normal progression of a download ------------------------------------------ // These are listed in approximately chronological order. There are also @@ -297,6 +329,9 @@ class CONTENT_EXPORT DownloadItemImpl // is completed. void Completed(); + // Callback invoked when the URLRequest for a download resumption has started. + void OnResumeRequestStarted(DownloadItem* item, net::Error error); + // Helper routines ----------------------------------------------------------- // Indicate that an error has occurred on the download. -- cgit v1.2.3