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

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: Created 4 years, 11 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 c527861287f8acf546e5822f8ae31c54ebae8f3a..b5b9fed34e2190a722f345ab30f6c9d73118018d 100644
--- a/content/browser/download/download_item_impl.h
+++ b/content/browser/download/download_item_impl.h
@@ -167,18 +167,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 -------------------
@@ -218,7 +218,8 @@ class CONTENT_EXPORT DownloadItemImpl
private:
// Fine grained states of a download. Note that active downloads are created
- // in IN_PROGRESS_INTERNAL state. However, downloads creates via history can
+ // in IN_PROGRESS_INTERNAL state. Failed downloads are created in
+ // INTERRUPTED_INTERNAL state. However, downloads creates via history can
// be created in COMPLETE_INTERNAL, CANCELLED_INTERNAL and
// INTERRUPTED_INTERNAL.
@@ -269,6 +270,7 @@ class CONTENT_EXPORT DownloadItemImpl
// IN_PROGRESS_INTERNAL
// RESUMING_INTERNAL
// <Initial creation> Interrupted persisted downloads.
+ // <Initial creation> Failed new downloads.
// Transitions to:
// RESUMING_INTERNAL On resumption.
INTERRUPTED_INTERNAL,
@@ -305,6 +307,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
@@ -316,9 +325,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);
@@ -343,14 +349,11 @@ 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.
- void Interrupt(DownloadInterruptReason reason);
+ void Interrupt(DownloadInterruptReason reason,
+ ShouldUpdateObservers should_update_observers);
Randy Smith (Not in Mondays) 2016/02/10 21:48:45 I'll just note that I thought of the internal/exte
asanka 2016/02/11 03:43:07 Good point. I removed the ShouldUpdateObservers lo
Randy Smith (Not in Mondays) 2016/02/11 22:08:08 *nod* I had forgotten that TransitionTo() had tha
asanka 2016/02/11 23:57:25 I think the problem is that having things like Tra
Randy Smith (Not in Mondays) 2016/02/12 18:01:18 SGTM. I'd like to be careful (at some point; I d
// Destroy the DownloadFile object. If |destroy_file| is true, the file is
// destroyed with it. Otherwise, DownloadFile::Detach() is called before
@@ -378,6 +381,13 @@ class CONTENT_EXPORT DownloadItemImpl
void ResumeInterruptedDownload();
+ void InvokeDelegateForResumption();
+
+ // 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