summaryrefslogtreecommitdiff
path: root/content/browser/download/download_item_impl.h
diff options
context:
space:
mode:
authorTorne (Richard Coles) <torne@google.com>2013-05-29 14:40:03 +0100
committerTorne (Richard Coles) <torne@google.com>2013-05-29 14:40:03 +0100
commit90dce4d38c5ff5333bea97d859d4e484e27edf0c (patch)
tree9c51c7dd97d24b15befa97a3482c51851e5383a1 /content/browser/download/download_item_impl.h
parent1515035f5917d10d363b0888a3615d581ad8b83f (diff)
downloadchromium_org-90dce4d38c5ff5333bea97d859d4e484e27edf0c.tar.gz
Merge from Chromium at DEPS revision r202854
This commit was generated by merge_to_master.py. Change-Id: Idca323f71ef844a9e04f454d4f070b1e398f2deb
Diffstat (limited to 'content/browser/download/download_item_impl.h')
-rw-r--r--content/browser/download/download_item_impl.h85
1 files changed, 60 insertions, 25 deletions
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:
+ // <Initial creation> 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.
+ // <Initial creation> Completed persisted downloads.
+ // Transitions to:
+ // <none> Terminal state.
COMPLETE_INTERNAL,
// User has cancelled the download.
- // Only incoming transition IN_PROGRESS->
+ // Transitions from:
+ // IN_PROGRESS_INTERNAL
+ // INTERRUPTED_INTERNAL
+ // RESUMING_INTERNAL
+ // <Initial creation> Canceleld persisted downloads.
+ // Transitions to:
+ // <none> Terminal state.
CANCELLED_INTERNAL,
// An error has interrupted the download.
- // Only incoming transition IN_PROGRESS->
+ // Transitions from:
+ // IN_PROGRESS_INTERNAL
+ // RESUMING_INTERNAL
+ // <Initial creation> 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.