diff options
author | raymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-21 23:31:36 +0000 |
---|---|---|
committer | raymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-21 23:31:36 +0000 |
commit | 6a77ef2c9b299c6e39919cabda9600680ca024c5 (patch) | |
tree | 951688c0eb5bbfbd54f6f27cd7ecaac6bd53bfae /ppapi/proxy | |
parent | ea6c4239e295ebf0c8e36199d425a482c7f5b3ac (diff) | |
download | chromium_src-6a77ef2c9b299c6e39919cabda9600680ca024c5.zip chromium_src-6a77ef2c9b299c6e39919cabda9600680ca024c5.tar.gz chromium_src-6a77ef2c9b299c6e39919cabda9600680ca024c5.tar.bz2 |
Refactor Flash Print to the new pepper resource model
This refactors PPB_Flash_Print to the new pepper resource model. This is the last function from the ppb_flash_proxy to be refactored. The old proxy is still full of stale #includes and can now be removed entirely but this will be done in a separate CL.
This was tested by printing from http://mycoloringbook.keasoftware.com/
Review URL: https://chromiumcodereview.appspot.com/11640033
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@174477 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/proxy')
-rw-r--r-- | ppapi/proxy/flash_resource.cc | 4 | ||||
-rw-r--r-- | ppapi/proxy/flash_resource.h | 1 | ||||
-rw-r--r-- | ppapi/proxy/interface_list.cc | 5 | ||||
-rw-r--r-- | ppapi/proxy/ppapi_messages.h | 8 | ||||
-rw-r--r-- | ppapi/proxy/ppb_flash_proxy.cc | 47 | ||||
-rw-r--r-- | ppapi/proxy/ppb_flash_proxy.h | 8 |
6 files changed, 10 insertions, 63 deletions
diff --git a/ppapi/proxy/flash_resource.cc b/ppapi/proxy/flash_resource.cc index 854996e..3f72e78 100644 --- a/ppapi/proxy/flash_resource.cc +++ b/ppapi/proxy/flash_resource.cc @@ -240,5 +240,9 @@ PP_Bool FlashResource::IsRectTopmost(PP_Instance instance, return PP_FromBool(result == PP_OK); } +void FlashResource::InvokePrinting(PP_Instance instance) { + Post(RENDERER, PpapiHostMsg_Flash_InvokePrinting()); +} + } // namespace proxy } // namespace ppapi diff --git a/ppapi/proxy/flash_resource.h b/ppapi/proxy/flash_resource.h index b8c819e..cfb6b1e 100644 --- a/ppapi/proxy/flash_resource.h +++ b/ppapi/proxy/flash_resource.h @@ -60,6 +60,7 @@ class FlashResource PP_Bool from_user_action) OVERRIDE; virtual PP_Bool IsRectTopmost(PP_Instance instance, const PP_Rect* rect) OVERRIDE; + virtual void InvokePrinting(PP_Instance instance) OVERRIDE; private: // Non-owning pointer to the PluginDispatcher that owns this object. diff --git a/ppapi/proxy/interface_list.cc b/ppapi/proxy/interface_list.cc index 719df25..51537f7a 100644 --- a/ppapi/proxy/interface_list.cc +++ b/ppapi/proxy/interface_list.cc @@ -224,11 +224,6 @@ InterfaceList::InterfaceList() { PPB_OpenGLES2_Shared::GetChromiumMapSubInterface(), PERMISSION_NONE); AddPPB(PPB_OPENGLES2_QUERY_INTERFACE_1_0, API_ID_NONE, PPB_OpenGLES2_Shared::GetQueryInterface(), PERMISSION_NONE); -#if !defined(OS_NACL) - AddPPB(PPB_FLASH_PRINT_INTERFACE_1_0, API_ID_PPB_FLASH, - PPB_Flash_Proxy::GetFlashPrintInterface(), - PERMISSION_FLASH); -#endif AddPPB(PPB_VAR_ARRAY_BUFFER_INTERFACE_1_0, API_ID_NONE, PPB_Var_Shared::GetVarArrayBufferInterface1_0(), PERMISSION_NONE); diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h index 82428d4..de7253a 100644 --- a/ppapi/proxy/ppapi_messages.h +++ b/ppapi/proxy/ppapi_messages.h @@ -1247,10 +1247,6 @@ IPC_MESSAGE_ROUTED1(PpapiHostMsg_PPBVideoDecoder_Reset, IPC_SYNC_MESSAGE_ROUTED1_0(PpapiHostMsg_PPBVideoDecoder_Destroy, ppapi::HostResource /* video_decoder */) -// PPB_Flash. -IPC_MESSAGE_ROUTED1(PpapiHostMsg_PPBFlash_InvokePrinting, - PP_Instance /* instance */) - // PPB_Flash_MessageLoop. IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBFlashMessageLoop_Create, PP_Instance /* instance */, @@ -1625,6 +1621,10 @@ IPC_MESSAGE_CONTROL3(PpapiHostMsg_Flash_Navigate, IPC_MESSAGE_CONTROL1(PpapiHostMsg_Flash_IsRectTopmost, PP_Rect /* rect */) +// Notifies the renderer to invoke printing for the given plugin instance. No +// reply is sent. +IPC_MESSAGE_CONTROL0(PpapiHostMsg_Flash_InvokePrinting) + // DeviceEnumeration ----------------------------------------------------------- // Device enumeration messages used by audio input and video capture. IPC_MESSAGE_CONTROL0(PpapiHostMsg_DeviceEnumeration_EnumerateDevices) diff --git a/ppapi/proxy/ppb_flash_proxy.cc b/ppapi/proxy/ppb_flash_proxy.cc index cacd863..0fa79c5 100644 --- a/ppapi/proxy/ppb_flash_proxy.cc +++ b/ppapi/proxy/ppb_flash_proxy.cc @@ -39,26 +39,6 @@ using ppapi::thunk::EnterResourceNoLock; namespace ppapi { namespace proxy { -namespace { - -void InvokePrinting(PP_Instance instance) { - ProxyAutoLock lock; - - PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); - if (dispatcher) { - dispatcher->Send(new PpapiHostMsg_PPBFlash_InvokePrinting( - API_ID_PPB_FLASH, instance)); - } -} - -const PPB_Flash_Print_1_0 g_flash_print_interface = { - &InvokePrinting -}; - -} // namespace - -// ----------------------------------------------------------------------------- - PPB_Flash_Proxy::PPB_Flash_Proxy(Dispatcher* dispatcher) : InterfaceProxy(dispatcher) { } @@ -66,33 +46,8 @@ PPB_Flash_Proxy::PPB_Flash_Proxy(Dispatcher* dispatcher) PPB_Flash_Proxy::~PPB_Flash_Proxy() { } -// static -const PPB_Flash_Print_1_0* PPB_Flash_Proxy::GetFlashPrintInterface() { - return &g_flash_print_interface; -} - bool PPB_Flash_Proxy::OnMessageReceived(const IPC::Message& msg) { - if (!dispatcher()->permissions().HasPermission(PERMISSION_FLASH)) - return false; - - bool handled = true; - IPC_BEGIN_MESSAGE_MAP(PPB_Flash_Proxy, msg) - IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_InvokePrinting, - OnHostMsgInvokePrinting) - IPC_MESSAGE_UNHANDLED(handled = false) - IPC_END_MESSAGE_MAP() - // TODO(brettw) handle bad messages! - return handled; -} - -void PPB_Flash_Proxy::OnHostMsgInvokePrinting(PP_Instance instance) { - // This function is actually implemented in the PPB_Flash_Print interface. - // It's rarely used enough that we just request this interface when needed. - const PPB_Flash_Print_1_0* print_interface = - static_cast<const PPB_Flash_Print_1_0*>( - dispatcher()->local_get_interface()(PPB_FLASH_PRINT_INTERFACE_1_0)); - if (print_interface) - print_interface->InvokePrinting(instance); + return false; } } // namespace proxy diff --git a/ppapi/proxy/ppb_flash_proxy.h b/ppapi/proxy/ppb_flash_proxy.h index e7c773a..89fcb6e 100644 --- a/ppapi/proxy/ppb_flash_proxy.h +++ b/ppapi/proxy/ppb_flash_proxy.h @@ -39,20 +39,12 @@ class PPB_Flash_Proxy : public InterfaceProxy, public thunk::PPB_Flash_API { explicit PPB_Flash_Proxy(Dispatcher* dispatcher); virtual ~PPB_Flash_Proxy(); - // This flash proxy also proxies the PPB_Flash_Print interface. This one - // doesn't use the regular thunk system because the _impl side is actually in - // Chrome rather than with the rest of the interface implementations. - static const PPB_Flash_Print_1_0* GetFlashPrintInterface(); - // InterfaceProxy implementation. virtual bool OnMessageReceived(const IPC::Message& msg); static const ApiID kApiID = API_ID_PPB_FLASH; private: - // Message handlers. - void OnHostMsgInvokePrinting(PP_Instance instance); - DISALLOW_COPY_AND_ASSIGN(PPB_Flash_Proxy); }; |