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

Unified Diff: chrome/browser/download/download_request_limiter.h

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.h
diff --git a/chrome/browser/download/download_request_limiter.h b/chrome/browser/download/download_request_limiter.h
index 457de30e5caa4ee737c9855c5803ac1396c9b362..c0e1fae74745b276bbc86c90a7e8c6281448b414 100644
--- a/chrome/browser/download/download_request_limiter.h
+++ b/chrome/browser/download/download_request_limiter.h
@@ -17,6 +17,7 @@
#include "content/public/browser/notification_registrar.h"
class DownloadRequestInfoBarDelegate;
+class DownloadRequestLimiterObserver;
class TabContentsWrapper;
namespace content {
@@ -224,7 +225,7 @@ class DownloadRequestLimiter
// Does the work of updating the download status on the UI thread and
// potentially prompting the user.
- void CanDownloadImpl(TabContentsWrapper* originating_tab,
+ void CanDownloadImpl(content::WebContents* originating_contents,
int request_id,
const std::string& request_method,
const Callback& callback);
@@ -238,6 +239,9 @@ class DownloadRequestLimiter
// ALLOW_ONE_DOWNLOAD.
void Remove(TabDownloadState* state);
+ void RemoveObserver(content::WebContents* web_contents,
+ DownloadRequestLimiterObserver* observer);
+
// Maps from tab to download state. The download state for a tab only exists
// if the state is other than ALLOW_ONE_DOWNLOAD. Similarly once the state
// transitions from anything but ALLOW_ONE_DOWNLOAD back to ALLOW_ONE_DOWNLOAD
@@ -245,6 +249,10 @@ class DownloadRequestLimiter
typedef std::map<content::NavigationController*, TabDownloadState*> StateMap;
StateMap state_map_;
+ typedef std::map<content::WebContents*, DownloadRequestLimiterObserver*>
+ ObserverMap;
+ ObserverMap observer_map_;
+
static TestingDelegate* delegate_;
DISALLOW_COPY_AND_ASSIGN(DownloadRequestLimiter);

Powered by Google App Engine
This is Rietveld 408576698