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

Unified Diff: chrome/browser/download/download_manager.h

Issue 6096003: Put history insertion for downloads processing inline. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Split state and data reception changes, got rid of pending_finished_downloads_. Created 9 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: chrome/browser/download/download_manager.h
diff --git a/chrome/browser/download/download_manager.h b/chrome/browser/download/download_manager.h
index 61b17be93c70045615ec40e3858d56d5bd76cba0..c00437a9b85357de49d5be21fc846c7654b0733f 100644
--- a/chrome/browser/download/download_manager.h
+++ b/chrome/browser/download/download_manager.h
@@ -125,6 +125,17 @@ class DownloadManager
void PauseDownload(int32 download_id, bool pause);
void RemoveDownload(int64 download_handle);
+ // Determine if the download is ready for completion, i.e. has had
+ // all data received, and completed the filename determination and
+ // history insertion.
+ bool IsDownloadReadyForCompletion(DownloadItem* download);
+
+ // If all pre-requisites have been met, complete download processing, i.e.
+ // do internal cleanup, file rename, and potentially auto-open.
+ // (Dangerous downloads still may block on user acceptance after this
+ // point.)
+ void MaybeCompleteDownload(DownloadItem* download);
+
// Called when the download is renamed to its final name.
void DownloadRenamedToFinalName(int download_id, const FilePath& full_path);
@@ -369,14 +380,6 @@ class DownloadManager
// user wants us to prompt for a save location for each download.
FilePath last_download_path_;
- // Keep track of downloads that are completed before the user selects the
- // destination, so that observers are appropriately notified of completion
- // after this determination is made.
- // The map is of download_id->remaining size (bytes), both of which are
- // required when calling OnAllDataSaved.
- typedef std::map<int32, int64> PendingFinishedMap;
- PendingFinishedMap pending_finished_downloads_;
-
// The "Save As" dialog box used to ask the user where a file should be
// saved.
scoped_refptr<SelectFileDialog> select_file_dialog_;

Powered by Google App Engine
This is Rietveld 408576698