diff options
author | raymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-13 03:35:35 +0000 |
---|---|---|
committer | raymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-13 03:35:35 +0000 |
commit | caf16c7156876a462d4e213279fa6baa1735bc08 (patch) | |
tree | 0268a0d20f4b194b55f23df25611a3a52221e648 /ppapi | |
parent | 9cef770978192902cc3d75979f3b2b3eb6d827ee (diff) | |
download | chromium_src-caf16c7156876a462d4e213279fa6baa1735bc08.zip chromium_src-caf16c7156876a462d4e213279fa6baa1735bc08.tar.gz chromium_src-caf16c7156876a462d4e213279fa6baa1735bc08.tar.bz2 |
Refactor 4 PPB_Flash functions to the new PPAPI resource model.
The functions being refactored are:
-SetInstanceAlwaysOnTop
-DrawGlyphs
-GetProxyForURL
-Navigate
Each of these functions was manually tested with a Flash movie that uses it.
Review URL: https://chromiumcodereview.appspot.com/11510008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@172806 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r-- | ppapi/proxy/flash_resource.cc | 76 | ||||
-rw-r--r-- | ppapi/proxy/flash_resource.h | 26 | ||||
-rw-r--r-- | ppapi/proxy/ppapi_messages.h | 47 | ||||
-rw-r--r-- | ppapi/proxy/ppb_flash_proxy.cc | 171 | ||||
-rw-r--r-- | ppapi/proxy/ppb_flash_proxy.h | 40 | ||||
-rw-r--r-- | ppapi/proxy/serialized_structs.h | 2 | ||||
-rw-r--r-- | ppapi/thunk/ppb_flash_api.h | 31 | ||||
-rw-r--r-- | ppapi/thunk/ppb_flash_functions_api.h | 21 | ||||
-rw-r--r-- | ppapi/thunk/ppb_flash_thunk.cc | 18 |
9 files changed, 161 insertions, 271 deletions
diff --git a/ppapi/proxy/flash_resource.cc b/ppapi/proxy/flash_resource.cc index be5acd3..7c278c1 100644 --- a/ppapi/proxy/flash_resource.cc +++ b/ppapi/proxy/flash_resource.cc @@ -6,9 +6,15 @@ #include "ppapi/c/pp_errors.h" #include "ppapi/c/private/ppb_flash.h" +#include "ppapi/c/trusted/ppb_browser_font_trusted.h" #include "ppapi/proxy/plugin_globals.h" #include "ppapi/proxy/ppapi_messages.h" +#include "ppapi/proxy/serialized_structs.h" #include "ppapi/shared_impl/var.h" +#include "ppapi/thunk/enter.h" +#include "ppapi/thunk/ppb_url_request_info_api.h" + +using ppapi::thunk::EnterResourceNoLock; namespace ppapi { namespace proxy { @@ -56,5 +62,75 @@ PP_Bool FlashResource::SetCrashData(PP_Instance instance, return PP_FALSE; } +void FlashResource::SetInstanceAlwaysOnTop(PP_Instance instance, + PP_Bool on_top) { + Post(RENDERER, PpapiHostMsg_Flash_SetInstanceAlwaysOnTop(PP_ToBool(on_top))); +} + +PP_Bool FlashResource::DrawGlyphs( + PP_Instance instance, + PP_Resource pp_image_data, + const PP_BrowserFont_Trusted_Description* font_desc, + uint32_t color, + const PP_Point* position, + const PP_Rect* clip, + const float transformation[3][3], + PP_Bool allow_subpixel_aa, + uint32_t glyph_count, + const uint16_t glyph_indices[], + const PP_Point glyph_advances[]) { + EnterResourceNoLock<thunk::PPB_ImageData_API> enter(pp_image_data, true); + if (enter.failed()) + return PP_FALSE; + // The instance parameter isn't strictly necessary but we check that it + // matches anyway. + if (enter.resource()->pp_instance() != instance) + return PP_FALSE; + + PPBFlash_DrawGlyphs_Params params; + params.image_data = enter.resource()->host_resource(); + params.font_desc.SetFromPPBrowserFontDescription(*font_desc); + params.color = color; + params.position = *position; + params.clip = *clip; + for (int i = 0; i < 3; i++) { + for (int j = 0; j < 3; j++) + params.transformation[i][j] = transformation[i][j]; + } + params.allow_subpixel_aa = allow_subpixel_aa; + + params.glyph_indices.insert(params.glyph_indices.begin(), + &glyph_indices[0], + &glyph_indices[glyph_count]); + params.glyph_advances.insert(params.glyph_advances.begin(), + &glyph_advances[0], + &glyph_advances[glyph_count]); + + // This has to be synchronous because the caller may want to composite on + // top of the resulting text after the call is complete. + int32_t result = SyncCall<IPC::Message>(RENDERER, + PpapiHostMsg_Flash_DrawGlyphs(params)); + return PP_FromBool(result == PP_OK); +} + +int32_t FlashResource::Navigate(PP_Instance instance, + PP_Resource request_info, + const char* target, + PP_Bool from_user_action) { + thunk::EnterResourceNoLock<thunk::PPB_URLRequestInfo_API> enter(request_info, + true); + if (enter.failed()) + return PP_ERROR_BADRESOURCE; + return SyncCall<IPC::Message>(RENDERER, PpapiHostMsg_Flash_Navigate( + enter.object()->GetData(), target, PP_ToBool(from_user_action))); +} + +PP_Bool FlashResource::IsRectTopmost(PP_Instance instance, + const PP_Rect* rect) { + int32_t result = SyncCall<IPC::Message>(RENDERER, + PpapiHostMsg_Flash_IsRectTopmost(*rect)); + return PP_FromBool(result == PP_OK); +} + } // namespace proxy } // namespace ppapi diff --git a/ppapi/proxy/flash_resource.h b/ppapi/proxy/flash_resource.h index f970aed..d4656a1 100644 --- a/ppapi/proxy/flash_resource.h +++ b/ppapi/proxy/flash_resource.h @@ -10,15 +10,14 @@ #include "ppapi/c/private/ppb_flash.h" #include "ppapi/proxy/connection.h" #include "ppapi/proxy/plugin_resource.h" -#include "ppapi/proxy/ppapi_proxy_export.h" #include "ppapi/thunk/ppb_flash_functions_api.h" namespace ppapi { namespace proxy { -class PPAPI_PROXY_EXPORT FlashResource +class FlashResource : public PluginResource, - public NON_EXPORTED_BASE(thunk::PPB_Flash_Functions_API) { + public thunk::PPB_Flash_Functions_API { public: FlashResource(Connection connection, PP_Instance instance); virtual ~FlashResource(); @@ -33,6 +32,27 @@ class PPAPI_PROXY_EXPORT FlashResource virtual PP_Bool SetCrashData(PP_Instance instance, PP_FlashCrashKey key, PP_Var value) OVERRIDE; + virtual void SetInstanceAlwaysOnTop(PP_Instance instance, + PP_Bool on_top) OVERRIDE; + virtual PP_Bool DrawGlyphs( + PP_Instance instance, + PP_Resource pp_image_data, + const PP_BrowserFont_Trusted_Description* font_desc, + uint32_t color, + const PP_Point* position, + const PP_Rect* clip, + const float transformation[3][3], + PP_Bool allow_subpixel_aa, + uint32_t glyph_count, + const uint16_t glyph_indices[], + const PP_Point glyph_advances[]) OVERRIDE; + virtual int32_t Navigate(PP_Instance instance, + PP_Resource request_info, + const char* target, + PP_Bool from_user_action) OVERRIDE; + virtual PP_Bool IsRectTopmost(PP_Instance instance, + const PP_Rect* rect) OVERRIDE; + private: DISALLOW_COPY_AND_ASSIGN(FlashResource); }; diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h index 87f369d..7fa30fe 100644 --- a/ppapi/proxy/ppapi_messages.h +++ b/ppapi/proxy/ppapi_messages.h @@ -1257,30 +1257,10 @@ IPC_SYNC_MESSAGE_ROUTED1_0(PpapiHostMsg_PPBVideoDecoder_Destroy, ppapi::HostResource /* video_decoder */) // PPB_Flash. -IPC_MESSAGE_ROUTED2(PpapiHostMsg_PPBFlash_SetInstanceAlwaysOnTop, - PP_Instance /* instance */, - PP_Bool /* on_top */) -// This has to be synchronous becuase the caller may want to composite on -// top of the resulting text after the call is complete. -IPC_SYNC_MESSAGE_ROUTED2_1( - PpapiHostMsg_PPBFlash_DrawGlyphs, - PP_Instance /* instance */, - ppapi::proxy::PPBFlash_DrawGlyphs_Params /* params */, - PP_Bool /* result */) -IPC_SYNC_MESSAGE_ROUTED4_1(PpapiHostMsg_PPBFlash_Navigate, - PP_Instance /* instance */, - ppapi::URLRequestInfoData /* request_data */, - std::string /* target */, - PP_Bool /* from_user_action */, - int32_t /* result */) IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBFlash_GetLocalTimeZoneOffset, PP_Instance /* instance */, PP_Time /* t */, double /* offset */) -IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBFlash_IsRectTopmost, - PP_Instance /* instance */, - PP_Rect /* rect */, - PP_Bool /* result */) IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBFlash_GetSetting, PP_Instance /* instance */, PP_FlashSetting /* setting */, @@ -1613,6 +1593,33 @@ IPC_MESSAGE_CONTROL1(PpapiHostMsg_Flash_GetProxyForURL, std::string /* url */) IPC_MESSAGE_CONTROL1(PpapiPluginMsg_Flash_GetProxyForURLReply, std::string /* proxy */) +// Notifies the renderer whether the Flash instance is in windowed mode. No +// reply is sent. +IPC_MESSAGE_CONTROL1(PpapiHostMsg_Flash_SetInstanceAlwaysOnTop, + bool /* on_top */) + +// Notifies the renderer to draw text to the given PP_ImageData resource. All +// parmeters for drawing (including the resource to draw to) are contianed in +// the PPBFlash_DrawGlyphs_Params structure. An error code is sent in a reply +// message indicating success. +IPC_MESSAGE_CONTROL1(PpapiHostMsg_Flash_DrawGlyphs, + ppapi::proxy::PPBFlash_DrawGlyphs_Params /* params */) + +// Notifies the renderer to navigate to the given URL contained in the +// URLRequestInfoData. An error code is sent in a reply message indicating +// success. +IPC_MESSAGE_CONTROL3(PpapiHostMsg_Flash_Navigate, + ppapi::URLRequestInfoData /* data */, + std::string /* target */, + bool /* from_user_action */) + +// Queries the renderer on whether the plugin instance is the topmost element +// in the area of the instance specified by the given PP_Rect. PP_OK is sent as +// the error code in a reply message if the rect is topmost otherwise +// PP_ERROR_FAILED is sent. +IPC_MESSAGE_CONTROL1(PpapiHostMsg_Flash_IsRectTopmost, + PP_Rect /* rect */) + // Device enumeration messages used by audio input and video capture. IPC_MESSAGE_CONTROL0(PpapiHostMsg_DeviceEnumeration_EnumerateDevices) IPC_MESSAGE_CONTROL1(PpapiPluginMsg_DeviceEnumeration_EnumerateDevicesReply, diff --git a/ppapi/proxy/ppb_flash_proxy.cc b/ppapi/proxy/ppb_flash_proxy.cc index 9e06ede..43f9989 100644 --- a/ppapi/proxy/ppb_flash_proxy.cc +++ b/ppapi/proxy/ppb_flash_proxy.cc @@ -100,15 +100,8 @@ bool PPB_Flash_Proxy::OnMessageReceived(const IPC::Message& msg) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(PPB_Flash_Proxy, msg) - IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_SetInstanceAlwaysOnTop, - OnHostMsgSetInstanceAlwaysOnTop) - IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_DrawGlyphs, - OnHostMsgDrawGlyphs) - IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_Navigate, OnHostMsgNavigate) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_GetLocalTimeZoneOffset, OnHostMsgGetLocalTimeZoneOffset) - IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_IsRectTopmost, - OnHostMsgIsRectTopmost) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_InvokePrinting, OnHostMsgInvokePrinting) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_GetSetting, @@ -119,80 +112,6 @@ bool PPB_Flash_Proxy::OnMessageReceived(const IPC::Message& msg) { return handled; } -void PPB_Flash_Proxy::SetInstanceAlwaysOnTop(PP_Instance instance, - PP_Bool on_top) { - dispatcher()->Send(new PpapiHostMsg_PPBFlash_SetInstanceAlwaysOnTop( - API_ID_PPB_FLASH, instance, on_top)); -} - -PP_Bool PPB_Flash_Proxy::DrawGlyphs( - PP_Instance instance, - PP_Resource pp_image_data, - const PP_BrowserFont_Trusted_Description* font_desc, - uint32_t color, - const PP_Point* position, - const PP_Rect* clip, - const float transformation[3][3], - PP_Bool allow_subpixel_aa, - uint32_t glyph_count, - const uint16_t glyph_indices[], - const PP_Point glyph_advances[]) { - Resource* image_data = - PpapiGlobals::Get()->GetResourceTracker()->GetResource(pp_image_data); - if (!image_data) - return PP_FALSE; - // The instance parameter isn't strictly necessary but we check that it - // matches anyway. - if (image_data->pp_instance() != instance) - return PP_FALSE; - - PPBFlash_DrawGlyphs_Params params; - params.image_data = image_data->host_resource(); - params.font_desc.SetFromPPBrowserFontDescription(*font_desc); - params.color = color; - params.position = *position; - params.clip = *clip; - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 3; j++) - params.transformation[i][j] = transformation[i][j]; - } - params.allow_subpixel_aa = allow_subpixel_aa; - - params.glyph_indices.insert(params.glyph_indices.begin(), - &glyph_indices[0], - &glyph_indices[glyph_count]); - params.glyph_advances.insert(params.glyph_advances.begin(), - &glyph_advances[0], - &glyph_advances[glyph_count]); - - PP_Bool result = PP_FALSE; - dispatcher()->Send(new PpapiHostMsg_PPBFlash_DrawGlyphs( - API_ID_PPB_FLASH, instance, params, &result)); - return result; -} - -int32_t PPB_Flash_Proxy::Navigate(PP_Instance instance, - PP_Resource request_info, - const char* target, - PP_Bool from_user_action) { - thunk::EnterResourceNoLock<thunk::PPB_URLRequestInfo_API> enter( - request_info, true); - if (enter.failed()) - return PP_ERROR_BADRESOURCE; - return Navigate(instance, enter.object()->GetData(), target, - from_user_action); -} - -int32_t PPB_Flash_Proxy::Navigate(PP_Instance instance, - const URLRequestInfoData& data, - const char* target, - PP_Bool from_user_action) { - int32_t result = PP_ERROR_FAILED; - dispatcher()->Send(new PpapiHostMsg_PPBFlash_Navigate( - API_ID_PPB_FLASH, instance, data, target, from_user_action, &result)); - return result; -} - double PPB_Flash_Proxy::GetLocalTimeZoneOffset(PP_Instance instance, PP_Time t) { LocalTimeZoneOffsetCache& cache = g_local_time_zone_offset_cache.Get(); @@ -244,14 +163,6 @@ double PPB_Flash_Proxy::GetLocalTimeZoneOffset(PP_Instance instance, return cache_entry.offset; } -PP_Bool PPB_Flash_Proxy::IsRectTopmost(PP_Instance instance, - const PP_Rect* rect) { - PP_Bool result = PP_FALSE; - dispatcher()->Send(new PpapiHostMsg_PPBFlash_IsRectTopmost( - API_ID_PPB_FLASH, instance, *rect, &result)); - return result; -} - PP_Var PPB_Flash_Proxy::GetSetting(PP_Instance instance, PP_FlashSetting setting) { PluginDispatcher* plugin_dispatcher = @@ -280,77 +191,9 @@ PP_Var PPB_Flash_Proxy::GetSetting(PP_Instance instance, return PP_MakeUndefined(); } -void PPB_Flash_Proxy::OnHostMsgSetInstanceAlwaysOnTop(PP_Instance instance, - PP_Bool on_top) { - EnterInstanceNoLock enter(instance); - if (enter.succeeded()) - enter.functions()->GetFlashAPI()->SetInstanceAlwaysOnTop(instance, on_top); -} - -void PPB_Flash_Proxy::OnHostMsgDrawGlyphs( - PP_Instance instance, - const PPBFlash_DrawGlyphs_Params& params, - PP_Bool* result) { - *result = PP_FALSE; - EnterInstanceNoLock enter(instance); - if (enter.failed()) - return; - - if (params.glyph_indices.size() != params.glyph_advances.size() || - params.glyph_indices.empty()) - return; - - PP_BrowserFont_Trusted_Description font_desc; - params.font_desc.SetToPPBrowserFontDescription(&font_desc); - - *result = enter.functions()->GetFlashAPI()->DrawGlyphs( - 0, // Unused instance param. - params.image_data.host_resource(), &font_desc, - params.color, ¶ms.position, ¶ms.clip, - const_cast<float(*)[3]>(params.transformation), - params.allow_subpixel_aa, - static_cast<uint32_t>(params.glyph_indices.size()), - const_cast<uint16_t*>(¶ms.glyph_indices[0]), - const_cast<PP_Point*>(¶ms.glyph_advances[0])); - - // SetToPPFontDescription() creates a var which is owned by the caller. - PpapiGlobals::Get()->GetVarTracker()->ReleaseVar(font_desc.face); -} - -void PPB_Flash_Proxy::OnHostMsgNavigate(PP_Instance instance, - const URLRequestInfoData& data, - const std::string& target, - PP_Bool from_user_action, - int32_t* result) { - EnterInstanceNoLock enter_instance(instance); - if (enter_instance.failed()) { - *result = PP_ERROR_BADARGUMENT; - return; - } - DCHECK(!dispatcher()->IsPlugin()); - - // Validate the PP_Instance since we'll be constructing resources on its - // behalf. - HostDispatcher* host_dispatcher = static_cast<HostDispatcher*>(dispatcher()); - if (HostDispatcher::GetForInstance(instance) != host_dispatcher) { - NOTREACHED(); - *result = PP_ERROR_BADARGUMENT; - return; - } - - // We need to allow re-entrancy here, because this may call into Javascript - // (e.g. with a "javascript:" URL), or do things like navigate away from the - // page, either one of which will need to re-enter into the plugin. - // It is safe, because it is essentially equivalent to NPN_GetURL, where Flash - // would expect re-entrancy. When running in-process, it does re-enter here. - host_dispatcher->set_allow_plugin_reentrancy(); - *result = enter_instance.functions()->GetFlashAPI()->Navigate( - instance, data, target.c_str(), from_user_action); -} - void PPB_Flash_Proxy::OnHostMsgGetLocalTimeZoneOffset(PP_Instance instance, - PP_Time t, - double* result) { + PP_Time t, + double* result) { EnterInstanceNoLock enter(instance); if (enter.succeeded()) { *result = enter.functions()->GetFlashAPI()->GetLocalTimeZoneOffset( @@ -360,16 +203,6 @@ void PPB_Flash_Proxy::OnHostMsgGetLocalTimeZoneOffset(PP_Instance instance, } } -void PPB_Flash_Proxy::OnHostMsgIsRectTopmost(PP_Instance instance, - PP_Rect rect, - PP_Bool* result) { - EnterInstanceNoLock enter(instance); - if (enter.succeeded()) - *result = enter.functions()->GetFlashAPI()->IsRectTopmost(instance, &rect); - else - *result = PP_FALSE; -} - void PPB_Flash_Proxy::OnHostMsgGetSetting(PP_Instance instance, PP_FlashSetting setting, SerializedVarReturnValue id) { diff --git a/ppapi/proxy/ppb_flash_proxy.h b/ppapi/proxy/ppb_flash_proxy.h index 63cc506..71dfe19 100644 --- a/ppapi/proxy/ppb_flash_proxy.h +++ b/ppapi/proxy/ppb_flash_proxy.h @@ -49,32 +49,8 @@ class PPB_Flash_Proxy : public InterfaceProxy, public thunk::PPB_Flash_API { virtual bool OnMessageReceived(const IPC::Message& msg); // PPB_Flash_API implementation. - virtual void SetInstanceAlwaysOnTop(PP_Instance instance, - PP_Bool on_top) OVERRIDE; - virtual PP_Bool DrawGlyphs( - PP_Instance instance, - PP_Resource pp_image_data, - const PP_BrowserFont_Trusted_Description* font_desc, - uint32_t color, - const PP_Point* position, - const PP_Rect* clip, - const float transformation[3][3], - PP_Bool allow_subpixel_aa, - uint32_t glyph_count, - const uint16_t glyph_indices[], - const PP_Point glyph_advances[]) OVERRIDE; - virtual int32_t Navigate(PP_Instance instance, - PP_Resource request_info, - const char* target, - PP_Bool from_user_action) OVERRIDE; - virtual int32_t Navigate(PP_Instance instance, - const URLRequestInfoData& data, - const char* target, - PP_Bool from_user_action) OVERRIDE; virtual double GetLocalTimeZoneOffset(PP_Instance instance, PP_Time t) OVERRIDE; - virtual PP_Bool IsRectTopmost(PP_Instance instance, - const PP_Rect* rect) OVERRIDE; virtual PP_Var GetSetting(PP_Instance instance, PP_FlashSetting setting) OVERRIDE; @@ -82,21 +58,9 @@ class PPB_Flash_Proxy : public InterfaceProxy, public thunk::PPB_Flash_API { private: // Message handlers. - void OnHostMsgSetInstanceAlwaysOnTop(PP_Instance instance, - PP_Bool on_top); - void OnHostMsgDrawGlyphs(PP_Instance instance, - const PPBFlash_DrawGlyphs_Params& params, - PP_Bool* result); - void OnHostMsgNavigate(PP_Instance instance, - const URLRequestInfoData& data, - const std::string& target, - PP_Bool from_user_action, - int32_t* result); - void OnHostMsgGetLocalTimeZoneOffset(PP_Instance instance, PP_Time t, + void OnHostMsgGetLocalTimeZoneOffset(PP_Instance instance, + PP_Time t, double* result); - void OnHostMsgIsRectTopmost(PP_Instance instance, - PP_Rect rect, - PP_Bool* result); void OnHostMsgGetSetting(PP_Instance instance, PP_FlashSetting setting, SerializedVarReturnValue result); diff --git a/ppapi/proxy/serialized_structs.h b/ppapi/proxy/serialized_structs.h index bdc1b678..5c5dcab 100644 --- a/ppapi/proxy/serialized_structs.h +++ b/ppapi/proxy/serialized_structs.h @@ -62,7 +62,7 @@ struct SerializedDirEntry { bool is_dir; }; -struct PPBFlash_DrawGlyphs_Params { +struct PPAPI_PROXY_EXPORT PPBFlash_DrawGlyphs_Params { PPBFlash_DrawGlyphs_Params(); ~PPBFlash_DrawGlyphs_Params(); diff --git a/ppapi/thunk/ppb_flash_api.h b/ppapi/thunk/ppb_flash_api.h index d41acd9..7e509f1 100644 --- a/ppapi/thunk/ppb_flash_api.h +++ b/ppapi/thunk/ppb_flash_api.h @@ -6,13 +6,9 @@ #define PPAPI_THUNK_PPB_FLASH_API_H_ #include "ppapi/c/private/ppb_flash.h" -#include "ppapi/c/private/ppb_flash_file.h" #include "ppapi/thunk/ppapi_thunk_export.h" namespace ppapi { - -struct URLRequestInfoData; - namespace thunk { /////////////////////////// WARNING:DEPRECTATED //////////////////////////////// @@ -28,34 +24,7 @@ class PPAPI_THUNK_EXPORT PPB_Flash_API { virtual ~PPB_Flash_API() {} // Flash. - virtual void SetInstanceAlwaysOnTop(PP_Instance instance, PP_Bool on_top) = 0; - virtual PP_Bool DrawGlyphs( - PP_Instance instance, - PP_Resource pp_image_data, - const PP_BrowserFont_Trusted_Description* font_desc, - uint32_t color, - const PP_Point* position, - const PP_Rect* clip, - const float transformation[3][3], - PP_Bool allow_subpixel_aa, - uint32_t glyph_count, - const uint16_t glyph_indices[], - const PP_Point glyph_advances[]) = 0; - - // External function that takes a PPB_URLRequestInfo resource. - virtual int32_t Navigate(PP_Instance instance, - PP_Resource request_info, - const char* target, - PP_Bool from_user_action) = 0; - - // Internal navigate function that takes a URLRequestInfoData. - virtual int32_t Navigate(PP_Instance instance, - const URLRequestInfoData& data, - const char* target, - PP_Bool from_user_action) = 0; - virtual double GetLocalTimeZoneOffset(PP_Instance instance, PP_Time t) = 0; - virtual PP_Bool IsRectTopmost(PP_Instance instance, const PP_Rect* rect) = 0; virtual PP_Var GetSetting(PP_Instance instance, PP_FlashSetting setting) = 0; }; diff --git a/ppapi/thunk/ppb_flash_functions_api.h b/ppapi/thunk/ppb_flash_functions_api.h index 4aa3fec..c514f06 100644 --- a/ppapi/thunk/ppb_flash_functions_api.h +++ b/ppapi/thunk/ppb_flash_functions_api.h @@ -11,6 +11,8 @@ #include "ppapi/shared_impl/singleton_resource_id.h" #include "ppapi/thunk/ppapi_thunk_export.h" +struct PP_BrowserFont_Trusted_Description; + namespace ppapi { namespace thunk { @@ -27,6 +29,25 @@ class PPAPI_THUNK_EXPORT PPB_Flash_Functions_API { virtual PP_Bool SetCrashData(PP_Instance instance, PP_FlashCrashKey key, PP_Var value) = 0; + virtual void SetInstanceAlwaysOnTop(PP_Instance instance, PP_Bool on_top) = 0; + virtual PP_Bool DrawGlyphs( + PP_Instance instance, + PP_Resource pp_image_data, + const PP_BrowserFont_Trusted_Description* font_desc, + uint32_t color, + const PP_Point* position, + const PP_Rect* clip, + const float transformation[3][3], + PP_Bool allow_subpixel_aa, + uint32_t glyph_count, + const uint16_t glyph_indices[], + const PP_Point glyph_advances[]) = 0; + virtual int32_t Navigate(PP_Instance instance, + 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; static const SingletonResourceID kSingletonResourceID = FLASH_SINGLETON_ID; }; diff --git a/ppapi/thunk/ppb_flash_thunk.cc b/ppapi/thunk/ppb_flash_thunk.cc index 9aac0ac..02b4174 100644 --- a/ppapi/thunk/ppb_flash_thunk.cc +++ b/ppapi/thunk/ppb_flash_thunk.cc @@ -22,10 +22,10 @@ namespace thunk { namespace { void SetInstanceAlwaysOnTop(PP_Instance instance, PP_Bool on_top) { - EnterInstance enter(instance); + EnterInstanceAPI<PPB_Flash_Functions_API> enter(instance); if (enter.failed()) return; - enter.functions()->GetFlashAPI()->SetInstanceAlwaysOnTop(instance, on_top); + enter.functions()->SetInstanceAlwaysOnTop(instance, on_top); } PP_Bool DrawGlyphs(PP_Instance instance, @@ -39,10 +39,10 @@ PP_Bool DrawGlyphs(PP_Instance instance, uint32_t glyph_count, const uint16_t glyph_indices[], const PP_Point glyph_advances[]) { - EnterInstance enter(instance); + EnterInstanceAPI<PPB_Flash_Functions_API> enter(instance); if (enter.failed()) return PP_FALSE; - return enter.functions()->GetFlashAPI()->DrawGlyphs( + return enter.functions()->DrawGlyphs( instance, pp_image_data, font_desc, color, position, clip, transformation, allow_subpixel_aa, glyph_count, glyph_indices, glyph_advances); } @@ -67,11 +67,11 @@ int32_t Navigate(PP_Resource request_id, instance = enter.resource()->pp_instance(); } - EnterInstance enter(instance); + EnterInstanceAPI<PPB_Flash_Functions_API> enter(instance); if (enter.failed()) return PP_ERROR_BADARGUMENT; - return enter.functions()->GetFlashAPI()->Navigate(instance, request_id, - target, from_user_action); + return enter.functions()->Navigate(instance, request_id, target, + from_user_action); } void RunMessageLoop(PP_Instance instance) { @@ -107,10 +107,10 @@ void PreLoadFontWin(const void* logfontw) { } PP_Bool IsRectTopmost(PP_Instance instance, const PP_Rect* rect) { - EnterInstance enter(instance); + EnterInstanceAPI<PPB_Flash_Functions_API> enter(instance); if (enter.failed()) return PP_FALSE; - return enter.functions()->GetFlashAPI()->IsRectTopmost(instance, rect); + return enter.functions()->IsRectTopmost(instance, rect); } int32_t InvokePrinting(PP_Instance instance) { |