diff options
author | bbudge@chromium.org <bbudge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-19 18:42:32 +0000 |
---|---|---|
committer | bbudge@chromium.org <bbudge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-19 18:42:32 +0000 |
commit | 32938de1779d1e6c3d037cc71d3fed3ade02894d (patch) | |
tree | 00b7f0056c5cfbbd48633c93b36e0aae677fa40e /ppapi | |
parent | 84660601ee060e8390684b6c287c0aff7878e676 (diff) | |
download | chromium_src-32938de1779d1e6c3d037cc71d3fed3ade02894d.zip chromium_src-32938de1779d1e6c3d037cc71d3fed3ade02894d.tar.gz chromium_src-32938de1779d1e6c3d037cc71d3fed3ade02894d.tar.bz2 |
Add PPB_Testing_Dev GetDocumentURL to the NaCl IPC-based PPAPI proxy.
BUG=116317
TEST=browser_tests
Review URL: https://codereview.chromium.org/11190037
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@163036 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r-- | ppapi/proxy/ppapi_messages.h | 20 | ||||
-rw-r--r-- | ppapi/proxy/ppb_instance_proxy.cc | 49 | ||||
-rw-r--r-- | ppapi/proxy/ppb_instance_proxy.h | 10 | ||||
-rw-r--r-- | ppapi/proxy/ppb_testing_proxy.cc | 6 | ||||
-rw-r--r-- | ppapi/thunk/ppb_instance_api.h | 5 |
5 files changed, 52 insertions, 38 deletions
diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h index a8ae9b3..113c526 100644 --- a/ppapi/proxy/ppapi_messages.h +++ b/ppapi/proxy/ppapi_messages.h @@ -21,6 +21,7 @@ #include "ppapi/c/dev/pp_video_capture_dev.h" #include "ppapi/c/dev/pp_video_dev.h" #include "ppapi/c/dev/ppb_text_input_dev.h" +#include "ppapi/c/dev/ppb_url_util_dev.h" #include "ppapi/c/dev/ppp_printing_dev.h" #include "ppapi/c/pp_bool.h" #include "ppapi/c/pp_file_info.h" @@ -136,6 +137,22 @@ IPC_STRUCT_TRAITS_BEGIN(PP_PrintSettings_Dev) IPC_STRUCT_TRAITS_MEMBER(format) IPC_STRUCT_TRAITS_END() +IPC_STRUCT_TRAITS_BEGIN(PP_URLComponent_Dev) + IPC_STRUCT_TRAITS_MEMBER(begin) + IPC_STRUCT_TRAITS_MEMBER(len) +IPC_STRUCT_TRAITS_END() + +IPC_STRUCT_TRAITS_BEGIN(PP_URLComponents_Dev) + IPC_STRUCT_TRAITS_MEMBER(scheme) + IPC_STRUCT_TRAITS_MEMBER(username) + IPC_STRUCT_TRAITS_MEMBER(password) + IPC_STRUCT_TRAITS_MEMBER(host) + IPC_STRUCT_TRAITS_MEMBER(port) + IPC_STRUCT_TRAITS_MEMBER(path) + IPC_STRUCT_TRAITS_MEMBER(query) + IPC_STRUCT_TRAITS_MEMBER(ref) +IPC_STRUCT_TRAITS_END() + IPC_STRUCT_TRAITS_BEGIN(ppapi::DeviceRefData) IPC_STRUCT_TRAITS_MEMBER(type) IPC_STRUCT_TRAITS_MEMBER(name) @@ -1065,8 +1082,9 @@ IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBInstance_DocumentCanAccessDocument, PP_Instance /* active */, PP_Instance /* target */, PP_Bool /* result */) -IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBInstance_GetDocumentURL, +IPC_SYNC_MESSAGE_ROUTED1_2(PpapiHostMsg_PPBInstance_GetDocumentURL, PP_Instance /* active */, + PP_URLComponents_Dev /* components */, ppapi::proxy::SerializedVar /* result */) IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBInstance_GetPluginInstanceURL, PP_Instance /* active */, diff --git a/ppapi/proxy/ppb_instance_proxy.cc b/ppapi/proxy/ppb_instance_proxy.cc index fb71a93..1f35ccd 100644 --- a/ppapi/proxy/ppb_instance_proxy.cc +++ b/ppapi/proxy/ppb_instance_proxy.cc @@ -145,6 +145,8 @@ bool PPB_Instance_Proxy::OnMessageReceived(const IPC::Message& msg) { OnHostMsgCancelCompositionText) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_UpdateSurroundingText, OnHostMsgUpdateSurroundingText) + IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetDocumentURL, + OnHostMsgGetDocumentURL) #if !defined(OS_NACL) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ResolveRelativeToDocument, @@ -153,8 +155,6 @@ bool PPB_Instance_Proxy::OnMessageReceived(const IPC::Message& msg) { OnHostMsgDocumentCanRequest) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DocumentCanAccessDocument, OnHostMsgDocumentCanAccessDocument) - IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetDocumentURL, - OnHostMsgGetDocumentURL) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetPluginInstanceURL, OnHostMsgGetPluginInstanceURL) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_NeedKey, @@ -407,6 +407,17 @@ void PPB_Instance_Proxy::ZoomLimitsChanged(PP_Instance instance, NOTIMPLEMENTED(); } +PP_Var PPB_Instance_Proxy::GetDocumentURL(PP_Instance instance, + PP_URLComponents_Dev* components) { + ReceiveSerializedVarReturnValue result; + PP_URLComponents_Dev url_components; + dispatcher()->Send(new PpapiHostMsg_PPBInstance_GetDocumentURL( + API_ID_PPB_INSTANCE, instance, &url_components, &result)); + if (components) + *components = url_components; + return result.Return(dispatcher()); +} + #if !defined(OS_NACL) PP_Var PPB_Instance_Proxy::ResolveRelativeToDocument( PP_Instance instance, @@ -440,16 +451,6 @@ PP_Bool PPB_Instance_Proxy::DocumentCanAccessDocument(PP_Instance instance, return result; } -PP_Var PPB_Instance_Proxy::GetDocumentURL(PP_Instance instance, - PP_URLComponents_Dev* components) { - ReceiveSerializedVarReturnValue result; - dispatcher()->Send(new PpapiHostMsg_PPBInstance_GetDocumentURL( - API_ID_PPB_INSTANCE, instance, &result)); - return PPB_URLUtil_Shared::ConvertComponentsAndReturnURL( - result.Return(dispatcher()), - components); -} - PP_Var PPB_Instance_Proxy::GetPluginInstanceURL( PP_Instance instance, PP_URLComponents_Dev* components) { @@ -618,7 +619,6 @@ void PPB_Instance_Proxy::DeliverSamples( object->host_resource().host_resource(), serialized_block_info)); } - #endif // !defined(OS_NACL) void PPB_Instance_Proxy::PostMessage(PP_Instance instance, @@ -877,6 +877,18 @@ void PPB_Instance_Proxy::OnHostMsgUnlockMouse(PP_Instance instance) { enter.functions()->UnlockMouse(instance); } +void PPB_Instance_Proxy::OnHostMsgGetDocumentURL( + PP_Instance instance, + PP_URLComponents_Dev* components, + SerializedVarReturnValue result) { + EnterInstanceNoLock enter(instance); + if (enter.succeeded()) { + PP_Var document_url = enter.functions()->GetDocumentURL(instance, + components); + result.Return(dispatcher(), document_url); + } +} + #if !defined(OS_NACL) void PPB_Instance_Proxy::OnHostMsgResolveRelativeToDocument( PP_Instance instance, @@ -909,16 +921,6 @@ void PPB_Instance_Proxy::OnHostMsgDocumentCanAccessDocument(PP_Instance active, *result = enter.functions()->DocumentCanAccessDocument(active, target); } -void PPB_Instance_Proxy::OnHostMsgGetDocumentURL( - PP_Instance instance, - SerializedVarReturnValue result) { - EnterInstanceNoLock enter(instance); - if (enter.succeeded()) { - result.Return(dispatcher(), - enter.functions()->GetDocumentURL(instance, NULL)); - } -} - void PPB_Instance_Proxy::OnHostMsgGetPluginInstanceURL( PP_Instance instance, SerializedVarReturnValue result) { @@ -1053,7 +1055,6 @@ void PPB_Instance_Proxy::OnHostMsgDeliverSamples( if (enter.succeeded()) enter.functions()->DeliverSamples(instance, decrypted_samples, &block_info); } - #endif // !defined(OS_NACL) void PPB_Instance_Proxy::OnHostMsgSetCursor( diff --git a/ppapi/proxy/ppb_instance_proxy.h b/ppapi/proxy/ppb_instance_proxy.h index d84697f..a36d40c 100644 --- a/ppapi/proxy/ppb_instance_proxy.h +++ b/ppapi/proxy/ppb_instance_proxy.h @@ -104,7 +104,8 @@ class PPB_Instance_Proxy : public InterfaceProxy, const char* text, uint32_t caret, uint32_t anchor) OVERRIDE; - + virtual PP_Var GetDocumentURL(PP_Instance instance, + PP_URLComponents_Dev* components) OVERRIDE; #if !defined(OS_NACL) virtual PP_Var ResolveRelativeToDocument( PP_Instance instance, @@ -113,8 +114,6 @@ class PPB_Instance_Proxy : public InterfaceProxy, virtual PP_Bool DocumentCanRequest(PP_Instance instance, PP_Var url) OVERRIDE; virtual PP_Bool DocumentCanAccessDocument(PP_Instance instance, PP_Instance target) OVERRIDE; - virtual PP_Var GetDocumentURL(PP_Instance instance, - PP_URLComponents_Dev* components) OVERRIDE; virtual PP_Var GetPluginInstanceURL( PP_Instance instance, PP_URLComponents_Dev* components) OVERRIDE; @@ -208,6 +207,9 @@ class PPB_Instance_Proxy : public InterfaceProxy, const std::string& text, uint32_t caret, uint32_t anchor); + void OnHostMsgGetDocumentURL(PP_Instance instance, + PP_URLComponents_Dev* components, + SerializedVarReturnValue result); #if !defined(OS_NACL) void OnHostMsgResolveRelativeToDocument(PP_Instance instance, @@ -219,8 +221,6 @@ class PPB_Instance_Proxy : public InterfaceProxy, void OnHostMsgDocumentCanAccessDocument(PP_Instance active, PP_Instance target, PP_Bool* result); - void OnHostMsgGetDocumentURL(PP_Instance instance, - SerializedVarReturnValue result); void OnHostMsgGetPluginInstanceURL(PP_Instance instance, SerializedVarReturnValue result); virtual void OnHostMsgNeedKey(PP_Instance instance, diff --git a/ppapi/proxy/ppb_testing_proxy.cc b/ppapi/proxy/ppb_testing_proxy.cc index da2475a..b8c9ce0 100644 --- a/ppapi/proxy/ppb_testing_proxy.cc +++ b/ppapi/proxy/ppb_testing_proxy.cc @@ -93,16 +93,10 @@ void SimulateInputEvent(PP_Instance instance_id, PP_Resource input_event) { } PP_Var GetDocumentURL(PP_Instance instance, PP_URLComponents_Dev* components) { -#if !defined(OS_NACL) EnterInstance enter(instance); if (enter.failed()) return PP_MakeUndefined(); return enter.functions()->GetDocumentURL(instance, components); -#else - // TODO(nfullagar): Implement something better for the new NaCl IPC plugin. - // For now, this will at least allow some of the PPAPI tests to work. - return PP_MakeUndefined(); -#endif } // TODO(dmichael): Ideally we could get a way to check the number of vars in the diff --git a/ppapi/thunk/ppb_instance_api.h b/ppapi/thunk/ppb_instance_api.h index f238279..dc32b79 100644 --- a/ppapi/thunk/ppb_instance_api.h +++ b/ppapi/thunk/ppb_instance_api.h @@ -140,6 +140,9 @@ class PPB_Instance_API { virtual void ZoomLimitsChanged(PP_Instance instance, double minimum_factor, double maximium_factor) = 0; + // Testing and URLUtil. + virtual PP_Var GetDocumentURL(PP_Instance instance, + PP_URLComponents_Dev* components) = 0; #if !defined(OS_NACL) // Content Decryptor. virtual void NeedKey(PP_Instance instance, @@ -186,8 +189,6 @@ class PPB_Instance_API { virtual PP_Bool DocumentCanRequest(PP_Instance instance, PP_Var url) = 0; virtual PP_Bool DocumentCanAccessDocument(PP_Instance instance, PP_Instance target) = 0; - virtual PP_Var GetDocumentURL(PP_Instance instance, - PP_URLComponents_Dev* components) = 0; virtual PP_Var GetPluginInstanceURL(PP_Instance instance, PP_URLComponents_Dev* components) = 0; #endif // !defined(OS_NACL) |