Index: chrome/browser/extensions/extension_downloads_api.h |
diff --git a/chrome/browser/extensions/extension_downloads_api.h b/chrome/browser/extensions/extension_downloads_api.h |
index b0cf0e90cc3db310d6ae215aa9250fcfbb2156c4..5000f9ab62b74027d8b9e6cc6b88f392454d3faa 100644 |
--- a/chrome/browser/extensions/extension_downloads_api.h |
+++ b/chrome/browser/extensions/extension_downloads_api.h |
@@ -12,6 +12,7 @@ |
#include "base/file_path.h" |
#include "base/memory/singleton.h" |
+#include "base/stl_util.h" |
#include "base/string16.h" |
#include "chrome/browser/extensions/extension_function.h" |
#include "content/browser/download/download_item.h" |
@@ -255,22 +256,31 @@ class DownloadsDragFunction : public AsyncDownloadsFunction { |
DISALLOW_COPY_AND_ASSIGN(DownloadsDragFunction); |
}; |
-class ExtensionDownloadsEventRouter : public DownloadManager::Observer { |
+// Observes a single DownloadManager and many DownloadItems and dispatches |
+// onCreated and onErased events. |
+class ExtensionDownloadsEventRouter : public DownloadManager::Observer, |
+ public DownloadItem::Observer { |
public: |
explicit ExtensionDownloadsEventRouter(Profile* profile); |
virtual ~ExtensionDownloadsEventRouter(); |
virtual void ModelChanged() OVERRIDE; |
virtual void ManagerGoingDown() OVERRIDE; |
+ virtual void OnDownloadUpdated(DownloadItem* download) OVERRIDE; |
+ virtual void OnDownloadOpened(DownloadItem* download) OVERRIDE; |
private: |
- void DispatchEvent(const char* event_name, base::Value* json_arg); |
- typedef base::hash_map<int, DownloadItem*> ItemMap; |
typedef std::set<int> DownloadIdSet; |
Randy Smith (Not in Mondays)
2011/10/13 23:42:59
This doesn't look like it's used in this file--sho
benjhayden
2011/10/17 19:14:00
Done.
|
+ typedef base::hash_map<int, DownloadItem*> ItemMap; |
+ typedef base::hash_map<int, base::DictionaryValue*> ItemJsonMap; |
+ |
+ void DispatchEvent(const char* event_name, base::Value* json_arg); |
Profile* profile_; |
DownloadManager* manager_; |
- DownloadIdSet downloads_; |
+ ItemMap downloads_; |
+ ItemJsonMap item_jsons_; |
+ STLValueDeleter<ItemJsonMap> delete_item_jsons_; |
DISALLOW_COPY_AND_ASSIGN(ExtensionDownloadsEventRouter); |
}; |