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

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: dcheck 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..d40c164eb508271a0264681ec1825514adfd1076 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();
+ // Finalizes any pending removal (if there is one).
+ void FinalizeRemoval();
+
// 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_;
+ // The last download removed from this page. If no download has been removed
+ // or a download is revived, this will be DownloadItem::kInvalidId.
+ uint32 last_removed_id_;
+
base::WeakPtrFactory<DownloadsDOMHandler> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(DownloadsDOMHandler);

Powered by Google App Engine
This is Rietveld 408576698