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

Unified Diff: content/browser/browser_plugin/browser_plugin_guest.cc

Issue 286543002: Cleanup CanDownload WebContentsDelegate API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed Android build hopefully Created 6 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: content/browser/browser_plugin/browser_plugin_guest.cc
diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc
index 4fff465ee6a566bddae80e0ab0a78ada0bd5cce3..d1edaafe3ada7552137e97a7e7d40a1f6c9b49fe 100644
--- a/content/browser/browser_plugin/browser_plugin_guest.cc
+++ b/content/browser/browser_plugin/browser_plugin_guest.cc
@@ -153,20 +153,6 @@ std::string WindowOpenDispositionToString(
}
}
-// Called on IO thread.
-static GURL RetrieveDownloadURLFromRequestId(
- int render_process_id,
- int url_request_id) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
-
- GlobalRequestID global_id(render_process_id, url_request_id);
- net::URLRequest* url_request =
- ResourceDispatcherHostImpl::Get()->GetURLRequest(global_id);
- if (url_request)
- return url_request->url();
- return GURL();
-}
-
} // namespace
class BrowserPluginGuest::EmbedderWebContentsObserver
@@ -613,22 +599,15 @@ void BrowserPluginGuest::AddNewContents(WebContents* source,
void BrowserPluginGuest::CanDownload(
RenderViewHost* render_view_host,
- int request_id,
+ const GURL& url,
const std::string& request_method,
const base::Callback<void(bool)>& callback) {
- if (!delegate_) {
+ if (!delegate_ || !url.is_valid()) {
callback.Run(false);
return;
}
- BrowserThread::PostTaskAndReplyWithResult(
- BrowserThread::IO, FROM_HERE,
- base::Bind(&RetrieveDownloadURLFromRequestId,
- render_view_host->GetProcess()->GetID(), request_id),
- base::Bind(&BrowserPluginGuest::DidRetrieveDownloadURLFromRequestId,
- weak_ptr_factory_.GetWeakPtr(),
- request_method,
- callback));
+ delegate_->CanDownload(request_method, url, callback);
}
void BrowserPluginGuest::LoadProgressChanged(WebContents* contents,
@@ -1549,16 +1528,4 @@ void BrowserPluginGuest::OnImeCompositionRangeChanged(
}
#endif
-void BrowserPluginGuest::DidRetrieveDownloadURLFromRequestId(
- const std::string& request_method,
- const base::Callback<void(bool)>& callback,
- const GURL& url) {
- if (!url.is_valid()) {
- callback.Run(false);
- return;
- }
-
- delegate_->CanDownload(request_method, url, callback);
-}
-
} // namespace content
« no previous file with comments | « content/browser/browser_plugin/browser_plugin_guest.h ('k') | content/public/browser/web_contents_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698