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

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

Issue 1229933010: move file access permission logic to DownloadResourceThrottle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressing asanka's comments Created 5 years, 5 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.cc
diff --git a/chrome/browser/download/download_request_limiter.cc b/chrome/browser/download/download_request_limiter.cc
index fb83530036b1a2689245190a69dcf66fa2ebc21c..76ea02e237b14fa35021b6f80fc1f9528a1d6344 100644
--- a/chrome/browser/download/download_request_limiter.cc
+++ b/chrome/browser/download/download_request_limiter.cc
@@ -279,22 +279,6 @@ DownloadRequestLimiter::GetDownloadStatus(content::WebContents* web_contents) {
return state ? state->download_status() : ALLOW_ONE_DOWNLOAD;
}
-void DownloadRequestLimiter::CanDownloadOnIOThread(
- int render_process_host_id,
- int render_view_id,
- const GURL& url,
- const std::string& request_method,
- const Callback& callback) {
- // This is invoked on the IO thread. Schedule the task to run on the UI
- // thread so that we can query UI state.
- DCHECK_CURRENTLY_ON(BrowserThread::IO);
- BrowserThread::PostTask(
- BrowserThread::UI, FROM_HERE,
- base::Bind(&DownloadRequestLimiter::CanDownload, this,
- render_process_host_id, render_view_id, url,
- request_method, callback));
-}
-
DownloadRequestLimiter::TabDownloadState*
DownloadRequestLimiter::GetDownloadState(
content::WebContents* web_contents,
@@ -325,12 +309,12 @@ void DownloadRequestLimiter::CanDownload(int render_process_host_id,
tab_util::GetWebContentsByID(render_process_host_id, render_view_id);
if (!originating_contents) {
// The WebContents was closed, don't allow the download.
- ScheduleNotification(callback, false);
+ callback.Run(false);
return;
}
if (!originating_contents->GetDelegate()) {
- ScheduleNotification(callback, false);
+ callback.Run(false);
return;
}
@@ -360,7 +344,7 @@ void DownloadRequestLimiter::OnCanDownloadDecided(
content::WebContents* originating_contents =
tab_util::GetWebContentsByID(render_process_host_id, render_view_id);
if (!originating_contents || !allow) {
- ScheduleNotification(orig_callback, false);
+ orig_callback.Run(false);
return;
}
@@ -388,18 +372,18 @@ void DownloadRequestLimiter::CanDownloadImpl(
if (state->download_count() && !(state->download_count() %
DownloadRequestLimiter::kMaxDownloadsAtOnce))
state->set_download_status(PROMPT_BEFORE_DOWNLOAD);
- ScheduleNotification(callback, true);
+ callback.Run(true);
state->increment_download_count();
break;
case ALLOW_ONE_DOWNLOAD:
state->set_download_status(PROMPT_BEFORE_DOWNLOAD);
- ScheduleNotification(callback, true);
+ callback.Run(true);
state->increment_download_count();
break;
case DOWNLOADS_NOT_ALLOWED:
- ScheduleNotification(callback, false);
+ callback.Run(false);
break;
case PROMPT_BEFORE_DOWNLOAD: {
@@ -419,7 +403,7 @@ void DownloadRequestLimiter::CanDownloadImpl(
originating_contents);
if (settings)
settings->SetDownloadsBlocked(false);
- ScheduleNotification(callback, true);
+ callback.Run(true);
state->increment_download_count();
return;
}
@@ -429,7 +413,7 @@ void DownloadRequestLimiter::CanDownloadImpl(
originating_contents);
if (settings)
settings->SetDownloadsBlocked(true);
- ScheduleNotification(callback, false);
+ callback.Run(false);
return;
}
case CONTENT_SETTING_DEFAULT:

Powered by Google App Engine
This is Rietveld 408576698