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

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

Issue 230103002: [Downloads] Ask DownloadHistory if a download was from history. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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_history.h
diff --git a/chrome/browser/download/download_history.h b/chrome/browser/download/download_history.h
index e983c90964ff7cd3ab05215d9787b43e041e9c3f..8f998b9dc2778b0c6243e5e9030f3369e4f4437a 100644
--- a/chrome/browser/download/download_history.h
+++ b/chrome/browser/download/download_history.h
@@ -67,8 +67,11 @@ class DownloadHistory : public AllDownloadItemNotifier::Observer {
virtual void OnDownloadHistoryDestroyed() {}
};
- // Returns true if the item is persisted.
- static bool IsPersisted(content::DownloadItem* item);
+ // Returns true if the download is persisted. Not reliable when called from
+ // within a DownloadManager::Observer::OnDownloadCreated handler since the
+ // persisted state may not have been updated yet a download that were restored
Randy Smith (Not in Mondays) 2014/04/10 18:03:23 nit: "yet *for* a download"?
asanka 2014/04/17 21:16:10 Done.
+ // from history.
+ static bool IsPersisted(const content::DownloadItem* item);
// Neither |manager| nor |history| may be NULL.
// DownloadService creates DownloadHistory some time after DownloadManager is
@@ -82,6 +85,14 @@ class DownloadHistory : public AllDownloadItemNotifier::Observer {
void AddObserver(Observer* observer);
void RemoveObserver(Observer* observer);
+ // Returns true if the download was restored from history. Safe to call from
+ // within a DownloadManager::Observer::OnDownloadCreated handler and can be
+ // used to distinguish between downloads that were created due to new requests
+ // vs. downloads that were created due to being restored from history. Note
+ // that the return value is only reliable for downloads that were restored by
+ // this specific DownloadHistory instance.
Randy Smith (Not in Mondays) 2014/04/10 18:03:23 Hmmm. Not relevant for this CL, but I'm inclined
asanka 2014/04/17 21:16:10 Yeah. Currently there's nothing that prevents mult
+ bool WasRestoredFromHistory(const content::DownloadItem* item) const;
+
private:
typedef std::set<content::DownloadItem*> ItemSet;
« no previous file with comments | « no previous file | chrome/browser/download/download_history.cc » ('j') | chrome/browser/download/download_ui_controller.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698