| 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
|
|
|
|
|