Index: trunk/src/content/renderer/pepper/url_response_info_util.cc |
=================================================================== |
--- trunk/src/content/renderer/pepper/url_response_info_util.cc (revision 217031) |
+++ trunk/src/content/renderer/pepper/url_response_info_util.cc (working copy) |
@@ -7,10 +7,7 @@ |
#include "base/bind.h" |
#include "base/files/file_path.h" |
#include "base/message_loop/message_loop.h" |
-#include "content/public/renderer/renderer_ppapi_host.h" |
-#include "content/renderer/pepper/renderer_ppapi_host_impl.h" |
-#include "ipc/ipc_message.h" |
-#include "ppapi/proxy/ppapi_messages.h" |
+#include "content/renderer/pepper/ppb_file_ref_impl.h" |
#include "ppapi/shared_impl/url_response_info_data.h" |
#include "third_party/WebKit/public/platform/WebCString.h" |
#include "third_party/WebKit/public/platform/WebHTTPHeaderVisitor.h" |
@@ -46,23 +43,13 @@ |
return status >= 300 && status <= 399; |
} |
-void DidCreateResourceHost(const ppapi::URLResponseInfoData& in_data, |
- const base::FilePath& external_path, |
- const DataFromWebURLResponseCallback& callback, |
- int pending_resource_id) { |
- ppapi::URLResponseInfoData data = in_data; |
- data.body_as_file_ref = ppapi::MakeExternalFileRefCreateInfo( |
- external_path, std::string(), pending_resource_id); |
- callback.Run(data); |
-} |
- |
} // namespace |
-void DataFromWebURLResponse(RendererPpapiHostImpl* host_impl, |
- PP_Instance pp_instance, |
+void DataFromWebURLResponse(PP_Instance pp_instance, |
const WebURLResponse& response, |
const DataFromWebURLResponseCallback& callback) { |
ppapi::URLResponseInfoData data; |
+ |
data.url = response.url().spec(); |
data.status_code = response.httpStatusCode(); |
data.status_text = response.httpStatusText().utf8(); |
@@ -77,16 +64,18 @@ |
WebString file_path = response.downloadFilePath(); |
if (!file_path.isEmpty()) { |
- base::FilePath external_path = base::FilePath::FromUTF16Unsafe(file_path); |
- host_impl->CreateBrowserResourceHost( |
- pp_instance, |
- PpapiHostMsg_FileRef_CreateExternal(external_path), |
- base::Bind(&DidCreateResourceHost, data, external_path, callback)); |
- } else { |
- base::MessageLoop::current()->PostTask( |
- FROM_HERE, |
- base::Bind(callback, data)); |
+ scoped_refptr<PPB_FileRef_Impl> file_ref( |
+ PPB_FileRef_Impl::CreateExternal( |
+ pp_instance, |
+ base::FilePath::FromUTF16Unsafe(file_path), |
+ std::string())); |
+ data.body_as_file_ref = file_ref->GetCreateInfo(); |
+ file_ref->GetReference(); // The returned data has one ref for the plugin. |
} |
+ |
+ // We post data to a callback instead of returning it here because the new |
+ // implementation for FileRef is asynchronous when creating the resource. |
+ base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind(callback, data)); |
} |
} // namespace content |
Property changes on: trunk\src\content\renderer\pepper\url_response_info_util.cc |
___________________________________________________________________ |
Deleted: svn:mergeinfo |