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

Unified Diff: chrome/browser/ui/webui/md_downloads/md_downloads_dom_handler.h

Issue 2314903003: Improve download recovery flow: (Closed)
Patch Set: address final nits Created 4 years, 3 months 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/md_downloads/md_downloads_dom_handler.h
diff --git a/chrome/browser/ui/webui/md_downloads/md_downloads_dom_handler.h b/chrome/browser/ui/webui/md_downloads/md_downloads_dom_handler.h
index 029854b1a75918b7d9e51c7f64f12f2b1b4d8a64..71cc3b47ec981c9e18b24e0220fdda809690405f 100644
--- a/chrome/browser/ui/webui/md_downloads/md_downloads_dom_handler.h
+++ b/chrome/browser/ui/webui/md_downloads/md_downloads_dom_handler.h
@@ -28,6 +28,8 @@ class WebContents;
class WebUI;
}
+class Profile;
+
// The handler for Javascript messages related to the "downloads" view,
// also observes changes to the download manager.
class MdDownloadsDOMHandler : public content::WebContentsObserver,
@@ -102,6 +104,9 @@ class MdDownloadsDOMHandler : public content::WebContentsObserver,
// dangerous ones are immediately removed. Protected for testing.
void RemoveDownloads(const DownloadVector& to_remove);
+ // Helper function to handle save download event.
+ void SaveDownload(content::DownloadItem* download);
+
private:
using IdSet = std::set<uint32_t>;
@@ -119,11 +124,12 @@ class MdDownloadsDOMHandler : public content::WebContentsObserver,
// user accepts the dangerous download. The native prompt will observe
// |dangerous| until either the dialog is dismissed or |dangerous| is no
// longer an in-progress dangerous download.
- void ShowDangerPrompt(content::DownloadItem* dangerous);
+ virtual void ShowDangerPrompt(content::DownloadItem* dangerous);
// Conveys danger acceptance from the DownloadDangerPrompt to the
// DownloadItem.
- void DangerPromptDone(int download_id, DownloadDangerPrompt::Action action);
+ virtual void DangerPromptDone(int download_id,
+ DownloadDangerPrompt::Action action);
// Returns true if the records of any downloaded items are allowed (and able)
// to be deleted.
@@ -146,6 +152,9 @@ class MdDownloadsDOMHandler : public content::WebContentsObserver,
// IDs of downloads to remove when this handler gets deleted.
std::vector<IdSet> removals_;
+ // User profile that corresponds to this handler.
+ Profile* profile_;
+
base::WeakPtrFactory<MdDownloadsDOMHandler> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(MdDownloadsDOMHandler);

Powered by Google App Engine
This is Rietveld 408576698