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

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

Issue 1781983002: [Downloads] Introduce GUIDs for downloads. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 4 years, 9 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 | « content/browser/download/download_item_impl.cc ('k') | content/browser/download/download_manager_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/download/download_manager_impl.h
diff --git a/content/browser/download/download_manager_impl.h b/content/browser/download/download_manager_impl.h
index bbd348cdbe8a547a2326c1dacf16169369b7e68a..7b61149cdfd0ccafee46ce3481e55fb445571840 100644
--- a/content/browser/download/download_manager_impl.h
+++ b/content/browser/download/download_manager_impl.h
@@ -82,6 +82,7 @@ class CONTENT_EXPORT DownloadManagerImpl : public DownloadManager,
void AddObserver(Observer* observer) override;
void RemoveObserver(Observer* observer) override;
content::DownloadItem* CreateDownloadItem(
+ const std::string& guid,
uint32_t id,
const base::FilePath& current_path,
const base::FilePath& target_path,
@@ -104,6 +105,7 @@ class CONTENT_EXPORT DownloadManagerImpl : public DownloadManager,
BrowserContext* GetBrowserContext() const override;
void CheckForHistoryFilesRemoval() override;
DownloadItem* GetDownload(uint32_t id) override;
+ DownloadItem* GetDownloadByGuid(const std::string& guid) override;
// For testing; specifically, accessed from TestFileErrorInjector.
void SetDownloadItemFactoryForTesting(
@@ -117,6 +119,7 @@ class CONTENT_EXPORT DownloadManagerImpl : public DownloadManager,
private:
using DownloadSet = std::set<DownloadItem*>;
using DownloadMap = std::unordered_map<uint32_t, DownloadItemImpl*>;
+ using DownloadGuidMap = std::unordered_map<std::string, DownloadItemImpl*>;
using DownloadItemImplVector = std::vector<DownloadItemImpl*>;
using DownloadRemover = base::Callback<bool(const DownloadItemImpl*)>;
@@ -186,8 +189,16 @@ class CONTENT_EXPORT DownloadManagerImpl : public DownloadManager,
// DownloadManager. This includes downloads started by the user in
// this session, downloads initialized from the history system, and
// "save page as" downloads.
+ // TODO(asanka): Remove this container in favor of downloads_by_guid_ as a
+ // part of http://crbug.com/593020.
DownloadMap downloads_;
+ // Same as the above, but maps from GUID to download item. Note that the
+ // container is case sensitive. Hence the key needs to be normalized to
+ // upper-case when inserting new elements here. Fortunately for us,
+ // DownloadItemImpl already normalizes the string GUID.
+ DownloadGuidMap downloads_by_guid_;
+
int history_size_;
// True if the download manager has been initialized and requires a shutdown.
« no previous file with comments | « content/browser/download/download_item_impl.cc ('k') | content/browser/download/download_manager_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698