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. |