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

Unified Diff: chrome/browser/download/download_item.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
« no previous file with comments | « no previous file | chrome/browser/download/download_item.cc » ('j') | chrome/browser/download/download_item.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/download/download_item.h
diff --git a/chrome/browser/download/download_item.h b/chrome/browser/download/download_item.h
index 7471994d06362483bb21f0343a59254aef42cbbf..ec6ef0dc4ab7f99917862a90edff76b11346019d 100644
--- a/chrome/browser/download/download_item.h
+++ b/chrome/browser/download/download_item.h
@@ -40,8 +40,19 @@ class DownloadItem {
public:
enum DownloadState {
IN_PROGRESS,
+
+ // Note that COMPLETE indicates that the download has gotten all of its
+ // data, has figured out its final destination file, has been entered
+ // into the history store, and has been shown in the UI. The only
+ // operations remaining are acceptance by the user of
+ // a dangerous download (if dangerous), renaming the file
+ // to the final name, and auto-opening it (if it auto-opens).
COMPLETE,
+
CANCELLED,
+
+ // This state indicates that the download item is about to be destroyed,
+ // and observers seeing this state should release all references.
REMOVING
};
@@ -128,9 +139,13 @@ class DownloadItem {
// when resuming a download (assuming the server supports byte ranges).
void Cancel(bool update_history);
- // Called when all data has been saved.
+ // Called when all data has been saved. Only has display effects.
void OnAllDataSaved(int64 size);
+ // Called when ready to consider the data received and move on to the
+ // next stage.
+ void OnDataReceptionAccepted();
+
// Called when the entire download operation (including renaming etc)
// is finished.
void Finished();
@@ -152,6 +167,9 @@ class DownloadItem {
// total size).
int PercentComplete() const;
+ // Whether or not this download has received all of its data.
+ bool AllDataReceived() const;
+
// Update the fields that may have changed in DownloadCreateInfo as a
// result of analyzing the file and figuring out its type, location, etc.
// May only be called once.
@@ -335,6 +353,9 @@ class DownloadItem {
// True if the item was downloaded temporarily.
bool is_temporary_;
+ // True if we've received all the data for the download.
+ bool all_data_received_;
+
// Did the user open the item either directly or indirectly (such as by
// setting always open files of this type)? The shelf also sets this field
// when the user closes the shelf before the item has been opened but should
« no previous file with comments | « no previous file | chrome/browser/download/download_item.cc » ('j') | chrome/browser/download/download_item.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698