summaryrefslogtreecommitdiffstats
path: root/content/browser/browser_plugin/browser_plugin_guest.cc
diff options
context:
space:
mode:
authorfsamuel@chromium.org <fsamuel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-13 23:25:12 +0000
committerfsamuel@chromium.org <fsamuel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-13 23:25:12 +0000
commitfed0d1ca028c4715ab0dcba188596ae29d5e3ad3 (patch)
tree5ff8af79144cd07307e44cd1965dbdea276dfcde /content/browser/browser_plugin/browser_plugin_guest.cc
parent45c2428c0c3b8bda0f40aac07d1ef0f27e35fe2f (diff)
downloadchromium_src-fed0d1ca028c4715ab0dcba188596ae29d5e3ad3.zip
chromium_src-fed0d1ca028c4715ab0dcba188596ae29d5e3ad3.tar.gz
chromium_src-fed0d1ca028c4715ab0dcba188596ae29d5e3ad3.tar.bz2
Cleanup CanDownload WebContentsDelegate API
It seems we were passing an opaque request ID in WebContentsDelegate::CanDownload that wasn't used anywhere. Instead, for <webview>, we would simply like the URL that generated the download request. This CL simplifies the API and reduces cruft and code complexity BUG=364141, 330264 TBR=sgurun@chromium.org Review URL: https://codereview.chromium.org/286543002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@270242 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/browser_plugin/browser_plugin_guest.cc')
-rw-r--r--content/browser/browser_plugin/browser_plugin_guest.cc39
1 files changed, 3 insertions, 36 deletions
diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc
index 42f8ced..9d90519 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