| Index: chrome/browser/download/download_request_limiter.cc
|
| diff --git a/chrome/browser/download/download_request_limiter.cc b/chrome/browser/download/download_request_limiter.cc
|
| index 238bcbd42b6e825bec53b20f9d3131e98accbda6..fde54ce43db56beaa07fc1f4cae54608693543f3 100644
|
| --- a/chrome/browser/download/download_request_limiter.cc
|
| +++ b/chrome/browser/download/download_request_limiter.cc
|
| @@ -306,15 +306,14 @@ DownloadRequestLimiter::GetDownloadState(
|
| return state;
|
| }
|
|
|
| -void DownloadRequestLimiter::CanDownload(int render_process_host_id,
|
| - int render_view_id,
|
| - const GURL& url,
|
| - const std::string& request_method,
|
| - const Callback& callback) {
|
| +void DownloadRequestLimiter::CanDownload(
|
| + const base::Callback<content::WebContents*(void)>& web_contents_getter,
|
| + const GURL& url,
|
| + const std::string& request_method,
|
| + const Callback& callback) {
|
| DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
|
|
| - content::WebContents* originating_contents =
|
| - tab_util::GetWebContentsByID(render_process_host_id, render_view_id);
|
| + content::WebContents* originating_contents = web_contents_getter.Run();
|
| if (!originating_contents) {
|
| // The WebContents was closed, don't allow the download.
|
| callback.Run(false);
|
| @@ -330,12 +329,8 @@ void DownloadRequestLimiter::CanDownload(int render_process_host_id,
|
| // OnCanDownloadDecided is invoked, we look it up by |render_process_host_id|
|
| // and |render_view_id|.
|
| base::Callback<void(bool)> can_download_callback = base::Bind(
|
| - &DownloadRequestLimiter::OnCanDownloadDecided,
|
| - factory_.GetWeakPtr(),
|
| - render_process_host_id,
|
| - render_view_id,
|
| - request_method,
|
| - callback);
|
| + &DownloadRequestLimiter::OnCanDownloadDecided, factory_.GetWeakPtr(),
|
| + web_contents_getter, request_method, callback);
|
|
|
| originating_contents->GetDelegate()->CanDownload(
|
| url,
|
| @@ -344,13 +339,12 @@ void DownloadRequestLimiter::CanDownload(int render_process_host_id,
|
| }
|
|
|
| void DownloadRequestLimiter::OnCanDownloadDecided(
|
| - int render_process_host_id,
|
| - int render_view_id,
|
| + const base::Callback<content::WebContents*(void)>& web_contents_getter,
|
| const std::string& request_method,
|
| - const Callback& orig_callback, bool allow) {
|
| + const Callback& orig_callback,
|
| + bool allow) {
|
| DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
| - content::WebContents* originating_contents =
|
| - tab_util::GetWebContentsByID(render_process_host_id, render_view_id);
|
| + content::WebContents* originating_contents = web_contents_getter.Run();
|
| if (!originating_contents || !allow) {
|
| orig_callback.Run(false);
|
| return;
|
|
|