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

Unified Diff: chrome/browser/download/download_request_limiter_observer.cc

Issue 10412061: Fix crashes in DownloadRequestLimiter when extension popups/bubbles initiate downloads automatically (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comment Created 8 years, 7 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/download/download_request_limiter_observer.cc
diff --git a/chrome/browser/download/download_request_limiter_observer.cc b/chrome/browser/download/download_request_limiter_observer.cc
index c5bd6e72293cab5a16a53c13e8f6e5704a699537..60df9ac72b282816eea1c8c569c05b753e178199 100644
--- a/chrome/browser/download/download_request_limiter_observer.cc
+++ b/chrome/browser/download/download_request_limiter_observer.cc
@@ -10,8 +10,10 @@
using content::WebContents;
DownloadRequestLimiterObserver::DownloadRequestLimiterObserver(
- WebContents* web_contents)
- : content::WebContentsObserver(web_contents) {
+ WebContents* web_contents,
+ const DownloadRequestLimiterObserver::DestroyedCallback& on_destroyed)
+ : content::WebContentsObserver(web_contents),
+ on_destroyed_(on_destroyed) {
}
DownloadRequestLimiterObserver::~DownloadRequestLimiterObserver() {
@@ -22,3 +24,10 @@ void DownloadRequestLimiterObserver::DidGetUserGesture() {
return; // NULL in unitests.
g_browser_process->download_request_limiter()->OnUserGesture(web_contents());
}
+
+void DownloadRequestLimiterObserver::WebContentsDestroyed(
+ WebContents* contents) {
+ if (!on_destroyed_.is_null())
+ on_destroyed_.Run(this);
+ delete this;
+}

Powered by Google App Engine
This is Rietveld 408576698