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

Unified Diff: chrome/browser/ui/webui/downloads_dom_handler.h

Issue 722953002: downloads: add the ability to undo download removal. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment Created 6 years, 1 month 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/ui/webui/downloads_dom_handler.h
diff --git a/chrome/browser/ui/webui/downloads_dom_handler.h b/chrome/browser/ui/webui/downloads_dom_handler.h
index 30c42e387b37da8ced1c1b5c89791ee5f2586693..4f0c2da6d4253088c8bed919a1607622c96efd6b 100644
--- a/chrome/browser/ui/webui/downloads_dom_handler.h
+++ b/chrome/browser/ui/webui/downloads_dom_handler.h
@@ -88,6 +88,9 @@ class DownloadsDOMHandler : public content::WebUIMessageHandler,
// folder.
void HandleOpenDownloadsFolder(const base::ListValue* args);
+ // Callback for the "undoRemove" message. Undoes any previous removal.
+ void HandleUndoRemove(const base::ListValue* args);
+
protected:
// These methods are for mocking so that most of this class does not actually
// depend on WebUI. The other methods that depend on WebUI are
@@ -124,6 +127,9 @@ class DownloadsDOMHandler : public content::WebUIMessageHandler,
// to be deleted.
bool IsDeletingHistoryAllowed();
+ // Returns the download with ID of |download_id|.
+ content::DownloadItem* GetDownloadById(uint32 download_id);
+
// Returns the download that is referred to in a given value.
content::DownloadItem* GetDownloadByValue(const base::ListValue* args);
@@ -140,6 +146,10 @@ class DownloadsDOMHandler : public content::WebUIMessageHandler,
// Whether a call to SendCurrentDownloads() is currently scheduled.
bool update_scheduled_;
+ // IDs of downloads that have been removed from this page. These IDs are
+ // purged and the downloads are actually removed on destruction.
+ std::vector<uint32> removed_ids_;
+
base::WeakPtrFactory<DownloadsDOMHandler> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(DownloadsDOMHandler);

Powered by Google App Engine
This is Rietveld 408576698