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

Unified Diff: chrome/browser/chrome_plugin_message_filter.cc

Issue 8851007: WIP / Do not commit (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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
« no previous file with comments | « chrome/browser/chrome_plugin_message_filter.h ('k') | chrome/browser/external_tab_container_win.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chrome_plugin_message_filter.cc
diff --git a/chrome/browser/chrome_plugin_message_filter.cc b/chrome/browser/chrome_plugin_message_filter.cc
index 9d9677be58b3ca5c2c2006ce63413c2230e308e7..0db4658ceaf7ee0155b390640886290d7bddfdd0 100644
--- a/chrome/browser/chrome_plugin_message_filter.cc
+++ b/chrome/browser/chrome_plugin_message_filter.cc
@@ -67,31 +67,41 @@ void ChromePluginMessageFilter::OnDownloadUrl(const std::string& url,
render_process_id));
}
+// static
void ChromePluginMessageFilter::OnDownloadUrlOnUIThread(
const std::string& url,
gfx::NativeWindow caller_window,
int render_process_id) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
content::RenderProcessHost* host =
content::RenderProcessHost::FromID(render_process_id);
if (!host) {
return;
}
- BrowserThread::PostTask(
- BrowserThread::FILE, FROM_HERE,
- base::Bind(&ChromePluginMessageFilter::OnDownloadUrlOnFileThread,
- url, caller_window,
- host->GetBrowserContext()->GetRequestContext()));
+ PluginDownloadUrlHelper* download_url_helper =
+ new PluginDownloadUrlHelper(url);
+ download_url_helper->InitiateDownload(
+ host->GetBrowserContext()->GetRequestContext(),
+ base::Bind(&ChromePluginMessageFilter::OnPluginDownloadFinished,
+ caller_window));
}
-void ChromePluginMessageFilter::OnDownloadUrlOnFileThread(
- const std::string& url,
+// static
+void ChromePluginMessageFilter::OnPluginDownloadFinished(
gfx::NativeWindow caller_window,
- net::URLRequestContextGetter* context) {
- PluginDownloadUrlHelper* download_url_helper =
- new PluginDownloadUrlHelper(url, caller_window, NULL);
- download_url_helper->InitiateDownload(
- context,
- BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE));
+ const FilePath& response_file) {
+ FilePath::StringType path = response_file.value();
+ COPYDATASTRUCT download_file_data = {0};
+ download_file_data.cbData =
+ static_cast<unsigned long>((path.length() + 1) *
+ sizeof(FilePath::CharType));
+ download_file_data.lpData = const_cast<FilePath::CharType *>(path.c_str());
+ download_file_data.dwData = success;
+
+ if (::IsWindow(caller_window)) {
+ ::SendMessage(caller_window, WM_COPYDATA, NULL,
+ reinterpret_cast<LPARAM>(&download_file_data));
+ }
}
#endif
« no previous file with comments | « chrome/browser/chrome_plugin_message_filter.h ('k') | chrome/browser/external_tab_container_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698