summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authorraymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-21 23:31:36 +0000
committerraymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-21 23:31:36 +0000
commit6a77ef2c9b299c6e39919cabda9600680ca024c5 (patch)
tree951688c0eb5bbfbd54f6f27cd7ecaac6bd53bfae /ppapi
parentea6c4239e295ebf0c8e36199d425a482c7f5b3ac (diff)
downloadchromium_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')
-rw-r--r--ppapi/ppapi_shared.gypi1
-rw-r--r--ppapi/proxy/flash_resource.cc4
-rw-r--r--ppapi/proxy/flash_resource.h1
-rw-r--r--ppapi/proxy/interface_list.cc5
-rw-r--r--ppapi/proxy/ppapi_messages.h8
-rw-r--r--ppapi/proxy/ppb_flash_proxy.cc47
-rw-r--r--ppapi/proxy/ppb_flash_proxy.h8
-rw-r--r--ppapi/thunk/interfaces_ppb_private_flash.h21
-rw-r--r--ppapi/thunk/ppb_flash_functions_api.h2
-rw-r--r--ppapi/thunk/ppb_flash_print_thunk.cc34
10 files changed, 58 insertions, 73 deletions
diff --git a/ppapi/ppapi_shared.gypi b/ppapi/ppapi_shared.gypi
index 9033612..34ec95a 100644
--- a/ppapi/ppapi_shared.gypi
+++ b/ppapi/ppapi_shared.gypi
@@ -175,6 +175,7 @@
'thunk/ppb_flash_menu_thunk.cc',
'thunk/ppb_flash_message_loop_api.h',
'thunk/ppb_flash_message_loop_thunk.cc',
+ 'thunk/ppb_flash_print_thunk.cc',
'thunk/ppb_flash_thunk.cc',
'thunk/ppb_fullscreen_thunk.cc',
'thunk/ppb_gamepad_api.h',
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);
};
diff --git a/ppapi/thunk/interfaces_ppb_private_flash.h b/ppapi/thunk/interfaces_ppb_private_flash.h
index eb42315..a020a3a 100644
--- a/ppapi/thunk/interfaces_ppb_private_flash.h
+++ b/ppapi/thunk/interfaces_ppb_private_flash.h
@@ -7,26 +7,26 @@
#include "ppapi/thunk/interfaces_preamble.h"
-PROXIED_API(PPB_Flash)
-PROXIED_IFACE(PPB_Flash,
+PROXIED_IFACE(NoAPIName,
PPB_FLASH_INTERFACE_12_4,
- PPB_Flash_12_4)
-PROXIED_IFACE(PPB_Flash,
+ PPB_Flash_12_4)
+PROXIED_IFACE(NoAPIName,
PPB_FLASH_INTERFACE_12_5,
PPB_Flash_12_5)
-PROXIED_IFACE(PPB_Flash,
+PROXIED_IFACE(NoAPIName,
PPB_FLASH_INTERFACE_12_6,
PPB_Flash_12_6)
-PROXIED_IFACE(PPB_Flash,
+PROXIED_IFACE(NoAPIName,
PPB_FLASH_INTERFACE_13_0,
PPB_Flash_13_0)
-PROXIED_IFACE(PPB_Flash,
+PROXIED_IFACE(NoAPIName,
PPB_FLASH_FILE_MODULELOCAL_INTERFACE_3_0,
PPB_Flash_File_ModuleLocal_3_0)
-PROXIED_IFACE(PPB_Flash,
+PROXIED_IFACE(NoAPIName,
PPB_FLASH_FILE_FILEREF_INTERFACE,
PPB_Flash_File_FileRef)
+
PROXIED_IFACE(NoAPIName,
PPB_FLASH_CLIPBOARD_INTERFACE_4_0,
PPB_Flash_Clipboard_4_0)
@@ -34,7 +34,6 @@ PROXIED_IFACE(NoAPIName,
PPB_FLASH_CLIPBOARD_INTERFACE_5_0,
PPB_Flash_Clipboard_5_0)
-
PROXIED_IFACE(NoAPIName,
PPB_FLASH_DEVICEID_INTERFACE_1_0,
PPB_Flash_DeviceID_1_0)
@@ -52,4 +51,8 @@ PROXIED_IFACE(PPB_Flash_MessageLoop,
PPB_FLASH_MESSAGELOOP_INTERFACE_0_1,
PPB_Flash_MessageLoop_0_1)
+PROXIED_IFACE(NoAPIName,
+ PPB_FLASH_PRINT_INTERFACE_1_0,
+ PPB_Flash_Print_1_0)
+
#include "ppapi/thunk/interfaces_postamble.h"
diff --git a/ppapi/thunk/ppb_flash_functions_api.h b/ppapi/thunk/ppb_flash_functions_api.h
index c497286..9c54fca 100644
--- a/ppapi/thunk/ppb_flash_functions_api.h
+++ b/ppapi/thunk/ppb_flash_functions_api.h
@@ -47,8 +47,8 @@ class PPAPI_THUNK_EXPORT PPB_Flash_Functions_API {
PP_Resource request_info,
const char* target,
PP_Bool from_user_action) = 0;
-
virtual PP_Bool IsRectTopmost(PP_Instance instance, const PP_Rect* rect) = 0;
+ virtual void InvokePrinting(PP_Instance instance) = 0;
static const SingletonResourceID kSingletonResourceID = FLASH_SINGLETON_ID;
};
diff --git a/ppapi/thunk/ppb_flash_print_thunk.cc b/ppapi/thunk/ppb_flash_print_thunk.cc
new file mode 100644
index 0000000..1316784
--- /dev/null
+++ b/ppapi/thunk/ppb_flash_print_thunk.cc
@@ -0,0 +1,34 @@
+// 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/c/pp_instance.h"
+#include "ppapi/c/private/ppb_flash_print.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_flash_functions_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+void InvokePrinting(PP_Instance instance) {
+ EnterInstanceAPI<PPB_Flash_Functions_API> enter(instance);
+ if (enter.failed())
+ return;
+ enter.functions()->InvokePrinting(instance);
+}
+
+const PPB_Flash_Print_1_0 g_ppb_flash_print_1_0_thunk = {
+ &InvokePrinting,
+};
+
+} // namespace
+
+const PPB_Flash_Print_1_0* GetPPB_Flash_Print_1_0_Thunk() {
+ return &g_ppb_flash_print_1_0_thunk;
+}
+
+} // namespace thunk
+} // namespace ppapi