summaryrefslogtreecommitdiffstats
path: root/ppapi/proxy
diff options
context:
space:
mode:
Diffstat (limited to 'ppapi/proxy')
-rw-r--r--ppapi/proxy/interface_list.cc1
-rw-r--r--ppapi/proxy/ppapi_messages.h24
-rw-r--r--ppapi/proxy/ppb_url_loader_proxy.cc40
-rw-r--r--ppapi/proxy/ppb_url_loader_proxy.h4
-rw-r--r--ppapi/proxy/ppb_url_response_info_proxy.cc132
-rw-r--r--ppapi/proxy/ppb_url_response_info_proxy.h55
-rw-r--r--ppapi/proxy/resource_creation_proxy.cc10
-rw-r--r--ppapi/proxy/resource_creation_proxy.h4
-rw-r--r--ppapi/proxy/url_response_info_resource.cc82
-rw-r--r--ppapi/proxy/url_response_info_resource.h53
10 files changed, 194 insertions, 211 deletions
diff --git a/ppapi/proxy/interface_list.cc b/ppapi/proxy/interface_list.cc
index d0efc1f..6f2ca2b 100644
--- a/ppapi/proxy/interface_list.cc
+++ b/ppapi/proxy/interface_list.cc
@@ -100,7 +100,6 @@
#include "ppapi/proxy/ppb_testing_proxy.h"
#include "ppapi/proxy/ppb_udp_socket_private_proxy.h"
#include "ppapi/proxy/ppb_url_loader_proxy.h"
-#include "ppapi/proxy/ppb_url_response_info_proxy.h"
#include "ppapi/proxy/ppb_var_deprecated_proxy.h"
#include "ppapi/proxy/ppb_video_decoder_proxy.h"
#include "ppapi/proxy/ppb_x509_certificate_private_proxy.h"
diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h
index 95384e2e..275a550 100644
--- a/ppapi/proxy/ppapi_messages.h
+++ b/ppapi/proxy/ppapi_messages.h
@@ -56,6 +56,7 @@
#include "ppapi/shared_impl/private/ppb_host_resolver_shared.h"
#include "ppapi/shared_impl/private/ppb_x509_certificate_private_shared.h"
#include "ppapi/shared_impl/url_request_info_data.h"
+#include "ppapi/shared_impl/url_response_info_data.h"
#undef IPC_MESSAGE_EXPORT
#define IPC_MESSAGE_EXPORT PPAPI_PROXY_EXPORT
@@ -255,6 +256,15 @@ IPC_STRUCT_TRAITS_BEGIN(ppapi::URLRequestInfoData::BodyItem)
IPC_STRUCT_TRAITS_MEMBER(expected_last_modified_time)
IPC_STRUCT_TRAITS_END()
+IPC_STRUCT_TRAITS_BEGIN(ppapi::URLResponseInfoData)
+ IPC_STRUCT_TRAITS_MEMBER(url)
+ IPC_STRUCT_TRAITS_MEMBER(headers)
+ IPC_STRUCT_TRAITS_MEMBER(status_code)
+ IPC_STRUCT_TRAITS_MEMBER(status_text)
+ IPC_STRUCT_TRAITS_MEMBER(redirect_url)
+ IPC_STRUCT_TRAITS_MEMBER(body_as_file_ref)
+IPC_STRUCT_TRAITS_END()
+
IPC_STRUCT_TRAITS_BEGIN(ppapi::NetworkInfo)
IPC_STRUCT_TRAITS_MEMBER(name)
IPC_STRUCT_TRAITS_MEMBER(type)
@@ -1066,10 +1076,11 @@ IPC_MESSAGE_ROUTED2(PpapiHostMsg_PPBURLLoader_Open,
ppapi::URLRequestInfoData /* request_data */)
IPC_MESSAGE_ROUTED1(PpapiHostMsg_PPBURLLoader_FollowRedirect,
ppapi::HostResource /* loader */)
-IPC_SYNC_MESSAGE_ROUTED1_1(
+IPC_SYNC_MESSAGE_ROUTED1_2(
PpapiHostMsg_PPBURLLoader_GetResponseInfo,
ppapi::HostResource /* loader */,
- ppapi::HostResource /* response_info_out */)
+ bool /* success */,
+ ppapi::URLResponseInfoData /* result */)
IPC_MESSAGE_ROUTED2(PpapiHostMsg_PPBURLLoader_ReadResponseBody,
ppapi::HostResource /* loader */,
int32_t /* bytes_to_read */)
@@ -1080,15 +1091,6 @@ IPC_MESSAGE_ROUTED1(PpapiHostMsg_PPBURLLoader_Close,
IPC_MESSAGE_ROUTED1(PpapiHostMsg_PPBURLLoader_GrantUniversalAccess,
ppapi::HostResource /* loader */)
-// PPB_URLResponseInfo.
-IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBURLResponseInfo_GetProperty,
- ppapi::HostResource /* response */,
- int32_t /* property */,
- ppapi::proxy::SerializedVar /* result */)
-IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBURLResponseInfo_GetBodyAsFileRef,
- ppapi::HostResource /* response */,
- ppapi::PPB_FileRef_CreateInfo /* result */)
-
// PPB_Var.
IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBVar_AddRefObject,
int64 /* object_id */,
diff --git a/ppapi/proxy/ppb_url_loader_proxy.cc b/ppapi/proxy/ppb_url_loader_proxy.cc
index 1f398ce..91c1bba 100644
--- a/ppapi/proxy/ppb_url_loader_proxy.cc
+++ b/ppapi/proxy/ppb_url_loader_proxy.cc
@@ -22,7 +22,7 @@
#include "ppapi/proxy/plugin_dispatcher.h"
#include "ppapi/proxy/plugin_resource_tracker.h"
#include "ppapi/proxy/ppapi_messages.h"
-#include "ppapi/proxy/ppb_url_response_info_proxy.h"
+#include "ppapi/proxy/ppb_file_ref_proxy.h"
#include "ppapi/shared_impl/scoped_pp_resource.h"
#include "ppapi/shared_impl/tracked_callback.h"
#include "ppapi/thunk/enter.h"
@@ -114,6 +114,7 @@ class URLLoader : public Resource, public PPB_URLLoader_API {
virtual void GrantUniversalAccess() OVERRIDE;
virtual void SetStatusCallback(
PP_URLLoaderTrusted_StatusCallback cb) OVERRIDE;
+ virtual bool GetResponseInfoData(URLResponseInfoData* data) OVERRIDE;
// Called when the browser has new up/download progress to report.
void UpdateProgress(const PPBURLLoader_UpdateProgress_Params& params);
@@ -249,14 +250,24 @@ PP_Bool URLLoader::GetDownloadProgress(
PP_Resource URLLoader::GetResponseInfo() {
if (!response_info_) {
- HostResource response_id;
+ bool success = false;
+ URLResponseInfoData data;
GetDispatcher()->Send(new PpapiHostMsg_PPBURLLoader_GetResponseInfo(
- API_ID_PPB_URL_LOADER, host_resource(), &response_id));
- if (response_id.is_null())
+ API_ID_PPB_URL_LOADER, host_resource(), &success, &data));
+ if (!success)
return 0;
- response_info_ = PPB_URLResponseInfo_Proxy::CreateResponseForResource(
- response_id);
+ // Create a proxy resource for the the file ref host resource if needed.
+ PP_Resource body_as_file_ref = 0;
+ if (!data.body_as_file_ref.resource.is_null()) {
+ body_as_file_ref =
+ PPB_FileRef_Proxy::DeserializeFileRef(data.body_as_file_ref);
+ }
+
+ // Assumes ownership of body_as_file_ref.
+ thunk::EnterResourceCreationNoLock enter(pp_instance());
+ response_info_ = enter.functions()->CreateURLResponseInfo(
+ pp_instance(), data, body_as_file_ref);
}
// The caller expects to get a ref, and we want to keep holding ours.
@@ -319,6 +330,12 @@ void URLLoader::SetStatusCallback(
// proxy itself in the host.
}
+bool URLLoader::GetResponseInfoData(URLResponseInfoData* data) {
+ // Not implemented in the proxied version, this is for implementing the
+ // proxy itself in the host.
+ return false;
+}
+
void URLLoader::UpdateProgress(
const PPBURLLoader_UpdateProgress_Params& params) {
bytes_sent_ = params.bytes_sent;
@@ -484,12 +501,13 @@ void PPB_URLLoader_Proxy::OnMsgFollowRedirect(
}
void PPB_URLLoader_Proxy::OnMsgGetResponseInfo(const HostResource& loader,
- HostResource* result) {
+ bool* success,
+ URLResponseInfoData* result) {
EnterHostFromHostResource<PPB_URLLoader_API> enter(loader);
- if (enter.succeeded()) {
- result->SetHostResource(loader.instance(),
- enter.object()->GetResponseInfo());
- }
+ if (enter.succeeded())
+ *success = enter.object()->GetResponseInfoData(result);
+ else
+ *success = false;
}
void PPB_URLLoader_Proxy::OnMsgReadResponseBody(
diff --git a/ppapi/proxy/ppb_url_loader_proxy.h b/ppapi/proxy/ppb_url_loader_proxy.h
index 5e4e759..f4c5bc5 100644
--- a/ppapi/proxy/ppb_url_loader_proxy.h
+++ b/ppapi/proxy/ppb_url_loader_proxy.h
@@ -21,6 +21,7 @@
namespace ppapi {
struct URLRequestInfoData;
+struct URLResponseInfoData;
namespace proxy {
@@ -61,7 +62,8 @@ class PPB_URLLoader_Proxy : public InterfaceProxy {
const URLRequestInfoData& data);
void OnMsgFollowRedirect(const HostResource& loader);
void OnMsgGetResponseInfo(const HostResource& loader,
- HostResource* result);
+ bool* success,
+ URLResponseInfoData* result);
void OnMsgReadResponseBody(const HostResource& loader,
int32_t bytes_to_read);
void OnMsgFinishStreamingToFile(const HostResource& loader);
diff --git a/ppapi/proxy/ppb_url_response_info_proxy.cc b/ppapi/proxy/ppb_url_response_info_proxy.cc
deleted file mode 100644
index 1d90386..0000000
--- a/ppapi/proxy/ppb_url_response_info_proxy.cc
+++ /dev/null
@@ -1,132 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ppapi/proxy/ppb_url_response_info_proxy.h"
-
-#include "ppapi/c/ppb_url_response_info.h"
-#include "ppapi/proxy/enter_proxy.h"
-#include "ppapi/proxy/host_dispatcher.h"
-#include "ppapi/proxy/plugin_dispatcher.h"
-#include "ppapi/proxy/ppapi_messages.h"
-#include "ppapi/proxy/ppb_file_ref_proxy.h"
-#include "ppapi/proxy/serialized_var.h"
-#include "ppapi/shared_impl/resource.h"
-#include "ppapi/thunk/ppb_url_response_info_api.h"
-#include "ppapi/thunk/thunk.h"
-
-using ppapi::thunk::PPB_URLResponseInfo_API;
-
-namespace ppapi {
-namespace proxy {
-
-// URLResponseInfo -------------------------------------------------------------
-
-class URLResponseInfo : public Resource, public PPB_URLResponseInfo_API {
- public:
- URLResponseInfo(const HostResource& resource);
- virtual ~URLResponseInfo();
-
- // Resource override.
- virtual PPB_URLResponseInfo_API* AsPPB_URLResponseInfo_API() OVERRIDE;
-
- // PPB_URLResponseInfo_API implementation.
- virtual PP_Var GetProperty(PP_URLResponseProperty property) OVERRIDE;
- virtual PP_Resource GetBodyAsFileRef() OVERRIDE;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(URLResponseInfo);
-};
-
-URLResponseInfo::URLResponseInfo(const HostResource& resource)
- : Resource(OBJECT_IS_PROXY, resource) {
-}
-
-URLResponseInfo::~URLResponseInfo() {
-}
-
-PPB_URLResponseInfo_API* URLResponseInfo::AsPPB_URLResponseInfo_API() {
- return this;
-}
-
-PP_Var URLResponseInfo::GetProperty(PP_URLResponseProperty property) {
- PluginDispatcher* dispatcher = PluginDispatcher::GetForResource(this);
- ReceiveSerializedVarReturnValue result;
- dispatcher->Send(new PpapiHostMsg_PPBURLResponseInfo_GetProperty(
- API_ID_PPB_URL_RESPONSE_INFO, host_resource(), property, &result));
- return result.Return(dispatcher);
-}
-
-PP_Resource URLResponseInfo::GetBodyAsFileRef() {
- // This could be more efficient by having the host automatically send us the
- // file ref when the request is streaming to a file and it's in the state
- // where the file is ready. This will prevent us from having to do this sync
- // IPC here.
- PPB_FileRef_CreateInfo create_info;
- PluginDispatcher::GetForResource(this)->Send(
- new PpapiHostMsg_PPBURLResponseInfo_GetBodyAsFileRef(
- API_ID_PPB_URL_RESPONSE_INFO, host_resource(), &create_info));
- return PPB_FileRef_Proxy::DeserializeFileRef(create_info);
-}
-
-// PPB_URLResponseInfo_Proxy ---------------------------------------------------
-
-PPB_URLResponseInfo_Proxy::PPB_URLResponseInfo_Proxy(Dispatcher* dispatcher)
- : InterfaceProxy(dispatcher) {
-}
-
-PPB_URLResponseInfo_Proxy::~PPB_URLResponseInfo_Proxy() {
-}
-
-// static
-PP_Resource PPB_URLResponseInfo_Proxy::CreateResponseForResource(
- const HostResource& resource) {
- return (new URLResponseInfo(resource))->GetReference();
-}
-
-bool PPB_URLResponseInfo_Proxy::OnMessageReceived(const IPC::Message& msg) {
- bool handled = true;
- IPC_BEGIN_MESSAGE_MAP(PPB_URLResponseInfo_Proxy, msg)
-#if !defined(OS_NACL)
- IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBURLResponseInfo_GetProperty,
- OnMsgGetProperty)
- IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBURLResponseInfo_GetBodyAsFileRef,
- OnMsgGetBodyAsFileRef)
-#endif
- IPC_MESSAGE_UNHANDLED(handled = false)
- IPC_END_MESSAGE_MAP()
- // TODO(brettw): handle bad messages.
- return handled;
-}
-
-#if !defined(OS_NACL)
-void PPB_URLResponseInfo_Proxy::OnMsgGetProperty(
- const HostResource& response,
- int32_t property,
- SerializedVarReturnValue result) {
- EnterHostFromHostResource<PPB_URLResponseInfo_API> enter(response);
- PP_Var result_var = PP_MakeUndefined();
- if (enter.succeeded()) {
- result_var = enter.object()->GetProperty(
- static_cast<PP_URLResponseProperty>(property));
- }
- result.Return(dispatcher(), result_var);
-}
-
-void PPB_URLResponseInfo_Proxy::OnMsgGetBodyAsFileRef(
- const HostResource& response,
- PPB_FileRef_CreateInfo* result) {
- EnterHostFromHostResource<PPB_URLResponseInfo_API> enter(response);
- PP_Resource file_ref = 0;
- if (enter.succeeded())
- file_ref = enter.object()->GetBodyAsFileRef();
-
- // Use the FileRef proxy to serialize.
- PPB_FileRef_Proxy* file_ref_proxy = static_cast<PPB_FileRef_Proxy*>(
- dispatcher()->GetInterfaceProxy(API_ID_PPB_FILE_REF));
- file_ref_proxy->SerializeFileRef(file_ref, result);
-}
-#endif // !defined(OS_NACL)
-
-} // namespace proxy
-} // namespace ppapi
diff --git a/ppapi/proxy/ppb_url_response_info_proxy.h b/ppapi/proxy/ppb_url_response_info_proxy.h
deleted file mode 100644
index 86c27fb..0000000
--- a/ppapi/proxy/ppb_url_response_info_proxy.h
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef PPAPI_PROXY_PPB_URL_RESPONSE_INFO_PROXY_H_
-#define PPAPI_PROXY_PPB_URL_RESPONSE_INFO_PROXY_H_
-
-#include "base/basictypes.h"
-#include "ppapi/c/pp_instance.h"
-#include "ppapi/c/pp_module.h"
-#include "ppapi/c/pp_resource.h"
-#include "ppapi/proxy/interface_proxy.h"
-#include "ppapi/shared_impl/host_resource.h"
-
-namespace ppapi {
-
-struct PPB_FileRef_CreateInfo;
-
-namespace proxy {
-
-class SerializedVarReturnValue;
-
-class PPB_URLResponseInfo_Proxy : public InterfaceProxy {
- public:
- PPB_URLResponseInfo_Proxy(Dispatcher* dispatcher);
- virtual ~PPB_URLResponseInfo_Proxy();
-
- // URLResponseInfo objects are actually created and returned by the
- // URLLoader. This function allows the URLLoader to convert a new
- // HostResource representing a response info to a properly tracked
- // URLReponseInfo Resource. Returns the plugin resource ID for the
- // new resource.
- static PP_Resource CreateResponseForResource(
- const ppapi::HostResource& resource);
-
- // InterfaceProxy implementation.
- virtual bool OnMessageReceived(const IPC::Message& msg);
-
- static const ApiID kApiID = API_ID_PPB_URL_RESPONSE_INFO;
-
- private:
- // Message handlers.
- void OnMsgGetProperty(const ppapi::HostResource& response,
- int32_t property,
- SerializedVarReturnValue result);
- void OnMsgGetBodyAsFileRef(const ppapi::HostResource& response,
- PPB_FileRef_CreateInfo* result);
-
- DISALLOW_COPY_AND_ASSIGN(PPB_URLResponseInfo_Proxy);
-};
-
-} // namespace proxy
-} // namespace ppapi
-
-#endif // PPAPI_PROXY_PPB_URL_RESPONSE_INFO_PROXY_H_
diff --git a/ppapi/proxy/resource_creation_proxy.cc b/ppapi/proxy/resource_creation_proxy.cc
index 2b8836a..bb103c3 100644
--- a/ppapi/proxy/resource_creation_proxy.cc
+++ b/ppapi/proxy/resource_creation_proxy.cc
@@ -39,6 +39,7 @@
#include "ppapi/proxy/ppb_x509_certificate_private_proxy.h"
#include "ppapi/proxy/printing_resource.h"
#include "ppapi/proxy/url_request_info_resource.h"
+#include "ppapi/proxy/url_response_info_resource.h"
#include "ppapi/proxy/video_capture_resource.h"
#include "ppapi/proxy/websocket_resource.h"
#include "ppapi/shared_impl/api_id.h"
@@ -153,6 +154,15 @@ PP_Resource ResourceCreationProxy::CreateURLRequestInfo(
instance, data))->GetReference();
}
+PP_Resource ResourceCreationProxy::CreateURLResponseInfo(
+ PP_Instance instance,
+ const URLResponseInfoData& data,
+ PP_Resource file_ref_resource) {
+ return (new URLResponseInfoResource(GetConnection(), instance,
+ data,
+ file_ref_resource))->GetReference();
+}
+
PP_Resource ResourceCreationProxy::CreateWheelInputEvent(
PP_Instance instance,
PP_TimeTicks time_stamp,
diff --git a/ppapi/proxy/resource_creation_proxy.h b/ppapi/proxy/resource_creation_proxy.h
index b748b84..612ff2ba 100644
--- a/ppapi/proxy/resource_creation_proxy.h
+++ b/ppapi/proxy/resource_creation_proxy.h
@@ -79,6 +79,10 @@ class ResourceCreationProxy : public InterfaceProxy,
virtual PP_Resource CreateURLRequestInfo(
PP_Instance instance,
const URLRequestInfoData& data) OVERRIDE;
+ virtual PP_Resource CreateURLResponseInfo(
+ PP_Instance instance,
+ const URLResponseInfoData& data,
+ PP_Resource file_ref_resource) OVERRIDE;
virtual PP_Resource CreateWheelInputEvent(
PP_Instance instance,
PP_TimeTicks time_stamp,
diff --git a/ppapi/proxy/url_response_info_resource.cc b/ppapi/proxy/url_response_info_resource.cc
new file mode 100644
index 0000000..91c9990
--- /dev/null
+++ b/ppapi/proxy/url_response_info_resource.cc
@@ -0,0 +1,82 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/proxy/url_response_info_resource.h"
+
+#include "ppapi/proxy/ppb_file_ref_proxy.h"
+#include "ppapi/shared_impl/var.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/resource_creation_api.h"
+
+namespace ppapi {
+namespace proxy {
+
+namespace {
+
+bool IsRedirect(int32_t status) {
+ return status >= 300 && status <= 399;
+}
+
+} // namespace
+
+URLResponseInfoResource::URLResponseInfoResource(
+ Connection connection,
+ PP_Instance instance,
+ const URLResponseInfoData& data,
+ PP_Resource file_ref_resource)
+ : PluginResource(connection, instance),
+ data_(data),
+ body_as_file_ref_(ScopedPPResource::PassRef(), file_ref_resource) {
+}
+
+URLResponseInfoResource::~URLResponseInfoResource() {
+}
+
+thunk::PPB_URLResponseInfo_API*
+URLResponseInfoResource::AsPPB_URLResponseInfo_API() {
+ return this;
+}
+
+PP_Var URLResponseInfoResource::GetProperty(PP_URLResponseProperty property) {
+ switch (property) {
+ case PP_URLRESPONSEPROPERTY_URL:
+ return StringVar::StringToPPVar(data_.url);
+ case PP_URLRESPONSEPROPERTY_REDIRECTURL:
+ if (IsRedirect(data_.status_code))
+ return StringVar::StringToPPVar(data_.redirect_url);
+ break;
+ case PP_URLRESPONSEPROPERTY_REDIRECTMETHOD:
+ if (IsRedirect(data_.status_code))
+ return StringVar::StringToPPVar(data_.status_text);
+ break;
+ case PP_URLRESPONSEPROPERTY_STATUSCODE:
+ return PP_MakeInt32(data_.status_code);
+ case PP_URLRESPONSEPROPERTY_STATUSLINE:
+ return StringVar::StringToPPVar(data_.status_text);
+ case PP_URLRESPONSEPROPERTY_HEADERS:
+ return StringVar::StringToPPVar(data_.headers);
+ }
+ // The default is to return an undefined PP_Var.
+ return PP_MakeUndefined();
+}
+
+PP_Resource URLResponseInfoResource::GetBodyAsFileRef() {
+ if (!body_as_file_ref_.get())
+ return 0;
+ PpapiGlobals::Get()->GetResourceTracker()->AddRefResource(
+ body_as_file_ref_.get());
+ return body_as_file_ref_.get();
+}
+
+URLResponseInfoData URLResponseInfoResource::GetData() {
+ // One ref is passed to the caller if there's a file ref.
+ if (body_as_file_ref_.get()) {
+ PpapiGlobals::Get()->GetResourceTracker()->AddRefResource(
+ body_as_file_ref_.get());
+ }
+ return data_;
+}
+
+} // namespace proxy
+} // namespace ppapi
diff --git a/ppapi/proxy/url_response_info_resource.h b/ppapi/proxy/url_response_info_resource.h
new file mode 100644
index 0000000..d3902d8
--- /dev/null
+++ b/ppapi/proxy/url_response_info_resource.h
@@ -0,0 +1,53 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_PROXY_URL_RESPONSE_INFO_RESOURCE_H_
+#define PPAPI_PROXY_URL_RESPONSE_INFO_RESOURCE_H_
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "ppapi/proxy/plugin_resource.h"
+#include "ppapi/proxy/ppapi_proxy_export.h"
+#include "ppapi/shared_impl/scoped_pp_resource.h"
+#include "ppapi/shared_impl/url_response_info_data.h"
+#include "ppapi/thunk/ppb_url_response_info_api.h"
+
+namespace ppapi {
+namespace proxy {
+
+class PPAPI_PROXY_EXPORT URLResponseInfoResource
+ : public PluginResource,
+ public NON_EXPORTED_BASE(thunk::PPB_URLResponseInfo_API) {
+ public:
+ // The file_ref_resource should be the body_as_file_ref host resource in the
+ // |data| converted to a resource valid in the current process (if we're
+ // downloading to a file; it will be 0 if we're not). A reference
+ // is passed from the caller and is taken over by this object.
+ URLResponseInfoResource(Connection connection,
+ PP_Instance instance,
+ const URLResponseInfoData& data,
+ PP_Resource file_ref_resource);
+ virtual ~URLResponseInfoResource();
+
+ // Resource override.
+ virtual PPB_URLResponseInfo_API* AsPPB_URLResponseInfo_API() OVERRIDE;
+
+ // PPB_URLResponseInfo_API implementation.
+ virtual PP_Var GetProperty(PP_URLResponseProperty property) OVERRIDE;
+ virtual PP_Resource GetBodyAsFileRef() OVERRIDE;
+ virtual URLResponseInfoData GetData() OVERRIDE;
+
+ private:
+ URLResponseInfoData data_;
+
+ // Non-zero when the load is being streamed to a file.
+ ScopedPPResource body_as_file_ref_;
+
+ DISALLOW_COPY_AND_ASSIGN(URLResponseInfoResource);
+};
+
+} // namespace proxy
+} // namespace ppapi
+
+#endif // PPAPI_PROXY_URL_RESPONSE_INFO_RESOURCE_H_