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

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

Issue 8571023: Implemented ExternalData interface on DownloadItem and used it for SafeBrowsing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged to LKGR. Created 9 years 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 | « chrome/browser/download/download_item_unittest.cc ('k') | content/browser/download/download_item_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/download/download_item.h
diff --git a/content/browser/download/download_item.h b/content/browser/download/download_item.h
index c51f35e22e2499d236f6f980219704aa881a18c9..23350248a99e99050649320202f0050bc80e94db 100644
--- a/content/browser/download/download_item.h
+++ b/content/browser/download/download_item.h
@@ -18,6 +18,7 @@
#define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_H_
#pragma once
+#include <map>
#include <string>
#include "base/string16.h"
@@ -100,6 +101,13 @@ class CONTENT_EXPORT DownloadItem {
virtual ~Observer() {}
};
+ // Interface for data that can be stored associated with (and owned
+ // by) an object of this class via GetExternalData/SetExternalData.
+ class ExternalData {
+ public:
+ virtual ~ExternalData() {};
+ };
+
virtual ~DownloadItem();
virtual void AddObserver(DownloadItem::Observer* observer) = 0;
@@ -308,6 +316,21 @@ class CONTENT_EXPORT DownloadItem {
// rewrites of the DownloadManager queues.
virtual void OffThreadCancel(DownloadFileManager* file_manager) = 0;
+ // Manage data owned by other subsystems associated with the
+ // DownloadItem. By custom, key is the address of a
+ // static char subsystem_specific_string[] = ".."; defined
+ // in the subsystem, but the only requirement of this interface
+ // is that the key be unique over all data stored with this
+ // DownloadItem.
+ //
+ // Note that SetExternalData takes ownership of the
+ // passed object; it will be destroyed when the DownloadItem is.
+ // If an object is already held by the DownloadItem associated with
+ // the passed key, it will be destroyed if overwriten by a new pointer
+ // (overwrites by the same pointer are ignored).
+ virtual ExternalData* GetExternalData(const void* key) = 0;
+ virtual void SetExternalData(const void* key, ExternalData* data) = 0;
+
virtual std::string DebugString(bool verbose) const = 0;
virtual void MockDownloadOpenForTesting() = 0;
« no previous file with comments | « chrome/browser/download/download_item_unittest.cc ('k') | content/browser/download/download_item_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698