Index: ppapi/proxy/ppb_flash_proxy.cc |
diff --git a/ppapi/proxy/ppb_flash_proxy.cc b/ppapi/proxy/ppb_flash_proxy.cc |
index 3ea9c220075244ba31e440bfe532d00b80c8435d..2fac7f5058d335d3db1ad1ab6532bf9eb04cae3f 100644 |
--- a/ppapi/proxy/ppb_flash_proxy.cc |
+++ b/ppapi/proxy/ppb_flash_proxy.cc |
@@ -15,7 +15,9 @@ |
#include "ppapi/c/pp_errors.h" |
#include "ppapi/c/pp_resource.h" |
#include "ppapi/c/private/ppb_flash.h" |
+#include "ppapi/c/private/ppb_flash_font.h" |
#include "ppapi/c/private/ppb_flash_print.h" |
+#include "ppapi/c/private/ppb_pdf.h" |
#include "ppapi/proxy/host_dispatcher.h" |
#include "ppapi/proxy/pepper_file_messages.h" |
#include "ppapi/proxy/plugin_dispatcher.h" |
@@ -39,6 +41,7 @@ |
#include "ppapi/thunk/resource_creation_api.h" |
using ppapi::thunk::EnterInstanceNoLock; |
+using ppapi::thunk::EnterResource; |
using ppapi::thunk::EnterResourceNoLock; |
namespace ppapi { |
@@ -59,7 +62,45 @@ IPC::PlatformFileForTransit PlatformFileToPlatformFileForTransit( |
return out_handle; |
} |
+PP_Resource GetFontFileWithFallback( |
+ PP_Instance instance, |
+ const PP_FontDescription_Dev* description, |
+ PP_PrivateFontCharset charset) { |
+ ProxyAutoLock lock; |
+ |
+ PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); |
+ if (!dispatcher) |
+ return 0; |
+ |
+ const PPB_PDF* ppb_pdf = static_cast<const PPB_PDF*>( |
+ dispatcher->GetBrowserInterface(PPB_PDF_INTERFACE)); |
+ return CallWhileUnlocked(ppb_pdf->GetFontFileWithFallback, instance, |
+ description, charset); |
+} |
+ |
+PP_Bool GetFontTableForPrivateFontFile(PP_Resource font_file, |
+ uint32_t table, |
+ void* output, |
+ uint32_t* output_length) { |
+ EnterResource<ppapi::thunk::PPB_PDFFont_API> enter(font_file, true); |
+ if (enter.failed()) |
+ return PP_FALSE; |
+ |
+ PluginDispatcher* dispatcher = PluginDispatcher::GetForResource( |
+ enter.resource()); |
+ if (!dispatcher) |
+ return PP_FALSE; |
+ |
+ const PPB_PDF* ppb_pdf = static_cast<const PPB_PDF*>( |
+ dispatcher->GetBrowserInterface(PPB_PDF_INTERFACE)); |
+ return PP_FromBool(CallWhileUnlocked( |
+ ppb_pdf->GetFontTableForPrivateFontFile, font_file, table, output, |
+ output_length)); |
+} |
+ |
void InvokePrinting(PP_Instance instance) { |
+ ProxyAutoLock lock; |
+ |
PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); |
if (dispatcher) { |
dispatcher->Send(new PpapiHostMsg_PPBFlash_InvokePrinting( |
@@ -67,6 +108,11 @@ void InvokePrinting(PP_Instance instance) { |
} |
} |
+const PPB_Flash_Font_0_1 g_flash_font_interface = { |
+ &GetFontFileWithFallback, |
+ &GetFontTableForPrivateFontFile |
+}; |
+ |
const PPB_Flash_Print_1_0 g_flash_print_interface = { |
&InvokePrinting |
}; |
@@ -83,6 +129,11 @@ PPB_Flash_Proxy::~PPB_Flash_Proxy() { |
} |
// static |
+const PPB_Flash_Font_0_1* PPB_Flash_Proxy::GetFlashFontInterface() { |
+ return &g_flash_font_interface; |
+} |
+ |
+// static |
const PPB_Flash_Print_1_0* PPB_Flash_Proxy::GetFlashPrintInterface() { |
return &g_flash_print_interface; |
} |