Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(609)

Unified Diff: content/browser/download/download_item_impl.h

Issue 10950015: Shift "commit point" for when a download will no longer accept cancels. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync'd to LKGR. Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: 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 ad8ed4db2fe8bc2d999a1149777831f7503bc0b2..93293cb2bb6f8758d5e22e8c6c1a7d1a8d96cfb0 100644
--- a/content/browser/download/download_item_impl.h
+++ b/content/browser/download/download_item_impl.h
@@ -207,6 +207,34 @@ class CONTENT_EXPORT DownloadItemImpl : public content::DownloadItem {
virtual void SetDbHandle(int64 handle);
private:
+ // Fine grained states of a download.
+ enum DownloadInternalState {
+ // Unless otherwise specified, state transitions are linear forward
+ // in this list.
+
+ // Includes both before and after file name determination.
+ // TODO(rdsmith): Put in state variable for file name determination.
+ IN_PROGRESS_INTERNAL,
+
+ // Between commit point (dispatch of download file release) and
+ // completed. Embedder may be opening the file in this state.
+ COMPLETING_INTERNAL,
+
+ // After embedder has had a chance to auto-open. User may now open
+ // or auto-open based on extension.
+ COMPLETE_INTERNAL,
+
+ // User has cancelled the download.
+ // Only incoming transition IN_PROGRESS->
+ CANCELLED_INTERNAL,
+
+ // An error has interrupted the download.
+ // Only incoming transition IN_PROGRESS->
+ INTERRUPTED_INTERNAL,
+
+ MAX_DOWNLOAD_INTERNAL_STATE,
+ };
+
// Normal progression of a download ------------------------------------------
// These are listed in approximately chronological order. There are also
@@ -249,13 +277,22 @@ class CONTENT_EXPORT DownloadItemImpl : public content::DownloadItem {
const std::string& final_hash);
// Call to transition state; all state transitions should go through this.
- void TransitionTo(DownloadState new_state);
+ void TransitionTo(DownloadInternalState new_state);
// Set the |danger_type_| and invoke obserers if necessary.
void SetDangerType(content::DownloadDangerType danger_type);
void SetFullPath(const FilePath& new_path);
+ // Mapping between internal and external states.
+ static DownloadState InternalToExternalState(
+ DownloadInternalState internal_state);
+ static DownloadInternalState ExternalToInternalState(
+ DownloadState external_state);
+
+ // Debugging routines --------------------------------------------------------
+ static const char* DebugDownloadStateString(DownloadInternalState state);
+
// The handle to the request information. Used for operations outside the
// download system.
scoped_ptr<DownloadRequestHandleInterface> request_handle_;
@@ -353,7 +390,7 @@ class CONTENT_EXPORT DownloadItemImpl : public content::DownloadItem {
base::TimeTicks start_tick_;
// The current state of this download.
- DownloadState state_;
+ DownloadInternalState state_;
// Current danger type for the download.
content::DownloadDangerType danger_type_;
« no previous file with comments | « content/browser/download/download_file_manager_unittest.cc ('k') | content/browser/download/download_item_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698