diff options
Diffstat (limited to 'ppapi/proxy')
-rw-r--r-- | ppapi/proxy/interface_list.cc | 2 | ||||
-rw-r--r-- | ppapi/proxy/ppapi_messages.h | 3 | ||||
-rw-r--r-- | ppapi/proxy/ppb_file_ref_proxy.cc | 38 | ||||
-rw-r--r-- | ppapi/proxy/ppb_file_ref_proxy.h | 6 |
4 files changed, 49 insertions, 0 deletions
diff --git a/ppapi/proxy/interface_list.cc b/ppapi/proxy/interface_list.cc index 96ee6bc..8893168 100644 --- a/ppapi/proxy/interface_list.cc +++ b/ppapi/proxy/interface_list.cc @@ -42,6 +42,7 @@ #include "ppapi/c/ppb_var.h" #include "ppapi/c/pp_errors.h" #include "ppapi/c/ppp_instance.h" +#include "ppapi/c/private/ppb_file_ref_private.h" #include "ppapi/c/private/ppb_flash_clipboard.h" #include "ppapi/c/private/ppb_flash_file.h" #include "ppapi/c/private/ppb_flash_fullscreen.h" @@ -180,6 +181,7 @@ InterfaceList::InterfaceList() { AddPPB(PPB_Testing_Proxy::GetInfo()); AddPPB(PPB_URLLoader_Proxy::GetTrustedInfo()); AddPPB(PPB_Var_Deprecated_Proxy::GetInfo()); + AddPPB(PPB_FileRef_Proxy::GetPrivateInfo()); // PPP (plugin) interfaces. AddPPP(PPP_Graphics3D_Proxy::GetInfo()); diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h index 758e040..01c8d50 100644 --- a/ppapi/proxy/ppapi_messages.h +++ b/ppapi/proxy/ppapi_messages.h @@ -631,6 +631,9 @@ IPC_MESSAGE_ROUTED3(PpapiHostMsg_PPBFileRef_Rename, ppapi::HostResource /* file_ref */, ppapi::HostResource /* new_file_ref */, int /* callback_id */) +IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBFileRef_GetAbsolutePath, + ppapi::HostResource /* file_ref */, + ppapi::proxy::SerializedVar /* result */) // PPB_FileSystem. IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBFileSystem_Create, diff --git a/ppapi/proxy/ppb_file_ref_proxy.cc b/ppapi/proxy/ppb_file_ref_proxy.cc index e6a8b94..55ef63b 100644 --- a/ppapi/proxy/ppb_file_ref_proxy.cc +++ b/ppapi/proxy/ppb_file_ref_proxy.cc @@ -9,6 +9,7 @@ #include "base/bind.h" #include "ppapi/c/pp_errors.h" #include "ppapi/c/ppb_file_ref.h" +#include "ppapi/c/private/ppb_file_ref_private.h" #include "ppapi/c/private/ppb_proxy_private.h" #include "ppapi/proxy/enter_proxy.h" #include "ppapi/proxy/host_dispatcher.h" @@ -42,6 +43,7 @@ class FileRef : public FileRefImpl { virtual int32_t Delete(PP_CompletionCallback callback) OVERRIDE; virtual int32_t Rename(PP_Resource new_file_ref, PP_CompletionCallback callback) OVERRIDE; + virtual PP_Var GetAbsolutePath() OVERRIDE; // Executes the pending callback with the given ID. See pending_callbacks_. void ExecuteCallback(int callback_id, int32_t result); @@ -144,6 +146,13 @@ int32_t FileRef::Rename(PP_Resource new_file_ref, return PP_OK_COMPLETIONPENDING; } +PP_Var FileRef::GetAbsolutePath() { + ReceiveSerializedVarReturnValue result; + GetDispatcher()->Send(new PpapiHostMsg_PPBFileRef_GetAbsolutePath( + API_ID_PPB_FILE_REF, host_resource(), &result)); + return result.Return(GetDispatcher()); +} + void FileRef::ExecuteCallback(int callback_id, int32_t result) { PendingCallbackMap::iterator found = pending_callbacks_.find(callback_id); if (found == pending_callbacks_.end()) { @@ -171,6 +180,14 @@ int FileRef::SendCallback(PP_CompletionCallback callback) { return next_callback_id_++; } +namespace { + +InterfaceProxy* CreateFileRefProxy(Dispatcher* dispatcher) { + return new PPB_FileRef_Proxy(dispatcher); +} + +} // namespace + PPB_FileRef_Proxy::PPB_FileRef_Proxy(Dispatcher* dispatcher) : InterfaceProxy(dispatcher), callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { @@ -180,6 +197,18 @@ PPB_FileRef_Proxy::~PPB_FileRef_Proxy() { } // static +const InterfaceProxy::Info* PPB_FileRef_Proxy::GetPrivateInfo() { + static const Info info = { + thunk::GetPPB_FileRefPrivate_Thunk(), + PPB_FILEREFPRIVATE_INTERFACE, + API_ID_NONE, // URL_LOADER is the canonical one. + false, + &CreateFileRefProxy + }; + return &info; +} + +// static PP_Resource PPB_FileRef_Proxy::CreateProxyResource(PP_Resource file_system, const char* path) { Resource* file_system_object = @@ -205,6 +234,8 @@ bool PPB_FileRef_Proxy::OnMessageReceived(const IPC::Message& msg) { IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileRef_Touch, OnMsgTouch) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileRef_Delete, OnMsgDelete) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileRef_Rename, OnMsgRename) + IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileRef_GetAbsolutePath, + OnMsgGetAbsolutePath) IPC_MESSAGE_HANDLER(PpapiMsg_PPBFileRef_CallbackComplete, OnMsgCallbackComplete) @@ -294,6 +325,13 @@ void PPB_FileRef_Proxy::OnMsgRename(const HostResource& file_ref, } } +void PPB_FileRef_Proxy::OnMsgGetAbsolutePath(const HostResource& host_resource, + SerializedVarReturnValue result) { + EnterHostFromHostResource<PPB_FileRef_API> enter(host_resource); + if (enter.succeeded()) + result.Return(dispatcher(), enter.object()->GetAbsolutePath()); +} + void PPB_FileRef_Proxy::OnMsgCallbackComplete( const HostResource& host_resource, int callback_id, diff --git a/ppapi/proxy/ppb_file_ref_proxy.h b/ppapi/proxy/ppb_file_ref_proxy.h index 83fee18..200d7cf 100644 --- a/ppapi/proxy/ppb_file_ref_proxy.h +++ b/ppapi/proxy/ppb_file_ref_proxy.h @@ -22,11 +22,15 @@ struct PPB_FileRef_CreateInfo; namespace proxy { +class SerializedVarReturnValue; + class PPB_FileRef_Proxy : public InterfaceProxy { public: explicit PPB_FileRef_Proxy(Dispatcher* dispatcher); virtual ~PPB_FileRef_Proxy(); + static const Info* GetPrivateInfo(); + static PP_Resource CreateProxyResource(PP_Resource file_system, const char* path); @@ -76,6 +80,8 @@ class PPB_FileRef_Proxy : public InterfaceProxy { void OnMsgRename(const HostResource& file_ref, const HostResource& new_file_ref, int callback_id); + void OnMsgGetAbsolutePath(const HostResource& host_resource, + SerializedVarReturnValue result); // Host -> Plugin message handlers. void OnMsgCallbackComplete(const HostResource& host_resource, |