diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-02 22:36:48 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-02 22:36:48 +0000 |
commit | 5f251761d671533e50548a7662d61f1f364413cd (patch) | |
tree | 6315c17099ddcdfb596f3df06f7b5180e3e7f260 /ppapi | |
parent | 674f70bc0bb29e55efffd4fabbb1d09c5f6cd784 (diff) | |
download | chromium_src-5f251761d671533e50548a7662d61f1f364413cd.zip chromium_src-5f251761d671533e50548a7662d61f1f364413cd.tar.gz chromium_src-5f251761d671533e50548a7662d61f1f364413cd.tar.bz2 |
Add URLLoaderTrusted proxy, hook up Flash proxy. This actually starts using
the disallow_trusted_interfaces_ flag which I hardcoded to false. In the
future, we can use this to lock down the proxy more if necessary.
This also fixes a bug where I swapped two arguments in the audio proxy.
TEST=none
BUG=none
Review URL: http://codereview.chromium.org/5549004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68088 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r-- | ppapi/proxy/dispatcher.cc | 17 | ||||
-rw-r--r-- | ppapi/proxy/interface_id.h | 1 | ||||
-rw-r--r-- | ppapi/proxy/ppapi_messages_internal.h | 4 | ||||
-rw-r--r-- | ppapi/proxy/ppb_audio_proxy.cc | 4 | ||||
-rw-r--r-- | ppapi/proxy/ppb_url_loader_proxy.cc | 47 | ||||
-rw-r--r-- | ppapi/proxy/ppb_url_loader_proxy.h | 21 |
6 files changed, 88 insertions, 6 deletions
diff --git a/ppapi/proxy/dispatcher.cc b/ppapi/proxy/dispatcher.cc index d27fbda..072134d 100644 --- a/ppapi/proxy/dispatcher.cc +++ b/ppapi/proxy/dispatcher.cc @@ -32,6 +32,7 @@ #include "ppapi/c/ppb_url_request_info.h" #include "ppapi/c/ppb_url_response_info.h" #include "ppapi/c/ppp_instance.h" +#include "ppapi/c/trusted/ppb_url_loader_trusted.h" #include "ppapi/proxy/ppapi_messages.h" #include "ppapi/proxy/ppb_audio_config_proxy.h" #include "ppapi/proxy/ppb_audio_proxy.h" @@ -39,6 +40,7 @@ #include "ppapi/proxy/ppb_char_set_proxy.h" #include "ppapi/proxy/ppb_core_proxy.h" #include "ppapi/proxy/ppb_cursor_control_proxy.h" +#include "ppapi/proxy/ppb_flash_proxy.h" #include "ppapi/proxy/ppb_font_proxy.h" #include "ppapi/proxy/ppb_fullscreen_proxy.h" #include "ppapi/proxy/ppb_graphics_2d_proxy.h" @@ -54,6 +56,7 @@ #include "ppapi/proxy/ppp_instance_proxy.h" #include "ppapi/proxy/var_serialization_rules.h" #include "webkit/glue/plugins/ppb_private.h" +#include "webkit/glue/plugins/ppb_private2.h" namespace pp { namespace proxy { @@ -62,7 +65,7 @@ Dispatcher::Dispatcher(base::ProcessHandle remote_process_handle, GetInterfaceFunc local_get_interface) : pp_module_(0), remote_process_handle_(remote_process_handle), - disallow_trusted_interfaces_(true), + disallow_trusted_interfaces_(false), // TODO(brettw) make this settable. local_get_interface_(local_get_interface), declared_supported_remote_interfaces_(false), callback_tracker_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { @@ -244,8 +247,6 @@ InterfaceProxy* Dispatcher::CreateProxyForInterface( return new PPB_ImageData_Proxy(this, interface_functions); if (interface_name == PPB_INSTANCE_INTERFACE) return new PPB_Instance_Proxy(this, interface_functions); - if (interface_name == PPB_PRIVATE_INTERFACE) - return new PPB_Pdf_Proxy(this, interface_functions); if (interface_name == PPB_TESTING_DEV_INTERFACE) return new PPB_Testing_Proxy(this, interface_functions); if (interface_name == PPB_URLLOADER_INTERFACE) @@ -259,6 +260,16 @@ InterfaceProxy* Dispatcher::CreateProxyForInterface( if (interface_name == PPP_INSTANCE_INTERFACE) return new PPP_Instance_Proxy(this, interface_functions); + // Trusted interfaces. + if (!disallow_trusted_interfaces_) { + if (interface_name == PPB_PRIVATE2_INTERFACE) + return new PPB_Flash_Proxy(this, interface_functions); + if (interface_name == PPB_PRIVATE_INTERFACE) + return new PPB_Pdf_Proxy(this, interface_functions); + if (interface_name == PPB_URLLOADERTRUSTED_INTERFACE) + return new PPB_URLLoaderTrusted_Proxy(this, interface_functions); + } + return NULL; } diff --git a/ppapi/proxy/interface_id.h b/ppapi/proxy/interface_id.h index 8d85f03..aca2016 100644 --- a/ppapi/proxy/interface_id.h +++ b/ppapi/proxy/interface_id.h @@ -27,6 +27,7 @@ enum InterfaceID { INTERFACE_ID_PPB_PDF, INTERFACE_ID_PPB_TESTING, INTERFACE_ID_PPB_URL_LOADER, + INTERFACE_ID_PPB_URL_LOADER_TRUSTED, INTERFACE_ID_PPB_URL_REQUEST_INFO, INTERFACE_ID_PPB_URL_RESPONSE_INFO, INTERFACE_ID_PPB_VAR, diff --git a/ppapi/proxy/ppapi_messages_internal.h b/ppapi/proxy/ppapi_messages_internal.h index d7f317e..00534f4 100644 --- a/ppapi/proxy/ppapi_messages_internal.h +++ b/ppapi/proxy/ppapi_messages_internal.h @@ -424,6 +424,10 @@ IPC_BEGIN_MESSAGES(PpapiHost) IPC_MESSAGE_ROUTED1(PpapiHostMsg_PPBURLLoader_Close, PP_Resource /* loader */) + // PPB_URLLoaderTrusted. + IPC_MESSAGE_ROUTED1(PpapiHostMsg_PPBURLLoaderTrusted_GrantUniversalAccess, + PP_Resource /* loader */) + // PPB_URLRequestInfo. IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBURLRequestInfo_Create, PP_Module /* module */, diff --git a/ppapi/proxy/ppb_audio_proxy.cc b/ppapi/proxy/ppb_audio_proxy.cc index bb40693..84db37a 100644 --- a/ppapi/proxy/ppb_audio_proxy.cc +++ b/ppapi/proxy/ppb_audio_proxy.cc @@ -219,8 +219,8 @@ void PPB_Audio_Proxy::AudioChannelConnected(int32_t result, // us, as long as the remote side always closes the handles it receives // (in OnMsgNotifyAudioStreamCreated), even in the failure case. dispatcher()->Send(new PpapiMsg_PPBAudio_NotifyAudioStreamCreated( - INTERFACE_ID_PPB_AUDIO, resource, result_code, shared_memory, - socket_handle, shared_memory_length)); + INTERFACE_ID_PPB_AUDIO, resource, result_code, socket_handle, + shared_memory, shared_memory_length)); } int32_t PPB_Audio_Proxy::GetAudioConnectedHandles( diff --git a/ppapi/proxy/ppb_url_loader_proxy.cc b/ppapi/proxy/ppb_url_loader_proxy.cc index 55409fb..0d5bbb2 100644 --- a/ppapi/proxy/ppb_url_loader_proxy.cc +++ b/ppapi/proxy/ppb_url_loader_proxy.cc @@ -12,6 +12,7 @@ #include "ppapi/c/pp_errors.h" #include "ppapi/c/pp_resource.h" #include "ppapi/c/ppb_url_loader.h" +#include "ppapi/c/trusted/ppb_url_loader_trusted.h" #include "ppapi/proxy/host_dispatcher.h" #include "ppapi/proxy/plugin_dispatcher.h" #include "ppapi/proxy/plugin_resource.h" @@ -63,7 +64,7 @@ URLLoader::~URLLoader() { namespace { -// Plugin interface implmentation ---------------------------------------------- +// Plugin PPB_URLLoader implmentation ------------------------------------------ PP_Resource Create(PP_Instance instance_id) { PluginDispatcher* dispatcher = PluginDispatcher::Get(); @@ -201,6 +202,19 @@ const PPB_URLLoader ppb_urlloader = { &Close }; +// Plugin URLLoaderTrusted implementation -------------------------------------- + +void GrantUniversalAccess(PP_Resource loader) { + PluginDispatcher::Get()->Send( + new PpapiHostMsg_PPBURLLoaderTrusted_GrantUniversalAccess( + INTERFACE_ID_PPB_URL_LOADER_TRUSTED, loader)); +} + +const PPB_URLLoaderTrusted ppb_urlloader_trusted = { + &GrantUniversalAccess, + NULL, // RegisterStatusCallback is used internally by the proxy only. +}; + } // namespace // PPB_URLLoader_Proxy --------------------------------------------------------- @@ -394,5 +408,36 @@ void PPB_URLLoader_Proxy::OnReadCallback(int32_t result, delete info; } +// PPB_URLLoaderTrusted_Proxy -------------------------------------------------- + +PPB_URLLoaderTrusted_Proxy::PPB_URLLoaderTrusted_Proxy( + Dispatcher* dispatcher, + const void* target_interface) + : InterfaceProxy(dispatcher, target_interface) { +} + +PPB_URLLoaderTrusted_Proxy::~PPB_URLLoaderTrusted_Proxy() { +} + +const void* PPB_URLLoaderTrusted_Proxy::GetSourceInterface() const { + return &ppb_urlloader_trusted; +} + +InterfaceID PPB_URLLoaderTrusted_Proxy::GetInterfaceId() const { + return INTERFACE_ID_PPB_URL_LOADER_TRUSTED; +} + +void PPB_URLLoaderTrusted_Proxy::OnMessageReceived(const IPC::Message& msg) { + IPC_BEGIN_MESSAGE_MAP(PPB_URLLoaderTrusted_Proxy, msg) + IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBURLLoaderTrusted_GrantUniversalAccess, + OnMsgGrantUniversalAccess) + IPC_END_MESSAGE_MAP(); + // TODO(brettw) handle bad messages! +} + +void PPB_URLLoaderTrusted_Proxy::OnMsgGrantUniversalAccess(PP_Resource loader) { + ppb_url_loader_trusted_target()->GrantUniversalAccess(loader); +} + } // namespace proxy } // namespace pp diff --git a/ppapi/proxy/ppb_url_loader_proxy.h b/ppapi/proxy/ppb_url_loader_proxy.h index b5671ef..ca9a83d 100644 --- a/ppapi/proxy/ppb_url_loader_proxy.h +++ b/ppapi/proxy/ppb_url_loader_proxy.h @@ -16,6 +16,7 @@ #include "ppapi/proxy/proxy_non_thread_safe_ref_count.h" struct PPB_URLLoader; +struct PPB_URLLoaderTrusted; namespace pp { namespace proxy { @@ -78,6 +79,26 @@ class PPB_URLLoader_Proxy : public InterfaceProxy { ProxyNonThreadSafeRefCount> callback_factory_; }; +class PPB_URLLoaderTrusted_Proxy : public InterfaceProxy { + public: + PPB_URLLoaderTrusted_Proxy(Dispatcher* dispatcher, + const void* target_interface); + virtual ~PPB_URLLoaderTrusted_Proxy(); + + const PPB_URLLoaderTrusted* ppb_url_loader_trusted_target() const { + return reinterpret_cast<const PPB_URLLoaderTrusted*>(target_interface()); + } + + // InterfaceProxy implementation. + virtual const void* GetSourceInterface() const; + virtual InterfaceID GetInterfaceId() const; + virtual void OnMessageReceived(const IPC::Message& msg); + + private: + // Plugin->renderer message handlers. + void OnMsgGrantUniversalAccess(PP_Resource loader); +}; + } // namespace proxy } // namespace pp |