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

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

Issue 148133007: [Downloads] Always call DM::StartDownload() for explicit downloads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ketchup with upstream. Created 4 years, 10 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 cd73d4b7544fd177bf39566e852296b0ddfc8e45..f9ae4e1085cb70fcfe1419943b9c6eb077ee6ffb 100644
--- a/content/browser/download/download_item_impl.h
+++ b/content/browser/download/download_item_impl.h
@@ -73,6 +73,8 @@ class CONTENT_EXPORT DownloadItemImpl
// Constructing for a regular download.
// |bound_net_log| is constructed externally for our use.
+ // TODO(asanka): Get rid of the DownloadCreateInfo parameter since active
+ // downloads end up at Start() immediately after creation.
DownloadItemImpl(DownloadItemImplDelegate* delegate,
uint32_t id,
const DownloadCreateInfo& info,
@@ -167,18 +169,18 @@ class CONTENT_EXPORT DownloadItemImpl
// INTERRUPTED state.
virtual ResumeMode GetResumeMode() const;
- // Notify the download item that new origin information is available due to a
- // resumption request receiving a response.
- virtual void MergeOriginInfoOnResume(
- const DownloadCreateInfo& new_create_info);
-
// State transition operations on regular downloads --------------------------
// Start the download.
// |download_file| is the associated file on the storage medium.
// |req_handle| is the new request handle associated with the download.
+ // |new_create_info| is a DownloadCreateInfo containing the new response
+ // parameters. It may be different from the DownloadCreateInfo used to create
+ // the DownloadItem if Start() is being called in response for a download
+ // resumption request.
virtual void Start(scoped_ptr<DownloadFile> download_file,
- scoped_ptr<DownloadRequestHandleInterface> req_handle);
+ scoped_ptr<DownloadRequestHandleInterface> req_handle,
+ const DownloadCreateInfo& new_create_info);
// Needed because of intertwining with DownloadManagerImpl -------------------
@@ -258,6 +260,8 @@ class CONTENT_EXPORT DownloadItemImpl
// <n/a> SavePackage downloads never reach this state.
TARGET_PENDING_INTERNAL,
+ INTERRUPTED_TARGET_PENDING_INTERNAL,
Randy Smith (Not in Mondays) 2016/02/11 22:08:09 (Discussed offline, noting for online record) Need
asanka 2016/02/11 23:57:25 Done.
+
// Embedder has completed target determination. It is now safe to resolve
// the download target as well as process deferred DestinationError events.
// This state is differs from TARGET_PENDING_INTERNAL due to it being
@@ -345,13 +349,6 @@ class CONTENT_EXPORT DownloadItemImpl
MAX_DOWNLOAD_INTERNAL_STATE,
};
- // Used with TransitionTo() to indicate whether or not to call
- // UpdateObservers() after the state transition.
- enum ShouldUpdateObservers {
- UPDATE_OBSERVERS,
- DONT_UPDATE_OBSERVERS
- };
-
// Normal progression of a download ------------------------------------------
// These are listed in approximately chronological order. There are also
@@ -364,6 +361,13 @@ class CONTENT_EXPORT DownloadItemImpl
// this is.
void Init(bool active, DownloadType download_type);
+ // Callback from file thread when we initialize the DownloadFile.
+ void OnDownloadFileInitialized(DownloadInterruptReason result);
+
+ // Called to determine the target path. Will cause OnDownloadTargetDetermined
+ // to be called when the target information is available.
+ void DetermineDownloadTarget();
+
// Called when the target path has been determined. |target_path| is the
// suggested target path. |disposition| indicates how the target path should
// be used (see TargetDisposition). |danger_type| is the danger level of
@@ -375,9 +379,6 @@ class CONTENT_EXPORT DownloadItemImpl
DownloadDangerType danger_type,
const base::FilePath& intermediate_path);
- // Callback from file thread when we initialize the DownloadFile.
- void OnDownloadFileInitialized(DownloadInterruptReason result);
-
void OnDownloadRenamedToIntermediateName(
DownloadInterruptReason reason, const base::FilePath& full_path);
@@ -402,10 +403,6 @@ class CONTENT_EXPORT DownloadItemImpl
// is completed.
void Completed();
- // Callback invoked when the URLRequest for a download resumption has started.
- void OnResumeRequestStarted(DownloadItem* item,
- DownloadInterruptReason interrupt_reason);
-
// Helper routines -----------------------------------------------------------
// Indicate that an error has occurred on the download.
@@ -425,8 +422,7 @@ class CONTENT_EXPORT DownloadItemImpl
// Call to transition state; all state transitions should go through this.
// |notify_action| specifies whether or not to call UpdateObservers() after
// the state transition.
- void TransitionTo(DownloadInternalState new_state,
- ShouldUpdateObservers notify_action);
+ void TransitionTo(DownloadInternalState new_state);
// Set the |danger_type_| and invoke obserers if necessary.
void SetDangerType(DownloadDangerType danger_type);
@@ -437,6 +433,11 @@ class CONTENT_EXPORT DownloadItemImpl
void ResumeInterruptedDownload();
+ // Update origin information based on the response to a download resumption
+ // request. Should only be called if the resumption request was successful.
+ virtual void UpdateValidatorsOnResumption(
+ const DownloadCreateInfo& new_create_info);
+
static DownloadState InternalToExternalState(
DownloadInternalState internal_state);
static DownloadInternalState ExternalToInternalState(

Powered by Google App Engine
This is Rietveld 408576698