Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(312)

Unified Diff: ppapi/proxy/flash_resource.cc

Issue 11510008: Refactor 4 PPB_Flash functions to the new PPAPI resource model. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/proxy/flash_resource.h ('k') | ppapi/proxy/ppapi_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/flash_resource.cc
diff --git a/ppapi/proxy/flash_resource.cc b/ppapi/proxy/flash_resource.cc
index 886024768cf5efb12b384fd7faec1ad86c3ed3ed..854996e6dd71da4497e86f4c4b62ec76060a0947 100644
--- a/ppapi/proxy/flash_resource.cc
+++ b/ppapi/proxy/flash_resource.cc
@@ -11,14 +11,19 @@
#include "base/time.h"
#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_dispatcher.h"
#include "ppapi/proxy/plugin_globals.h"
#include "ppapi/proxy/ppapi_messages.h"
+#include "ppapi/proxy/serialized_structs.h"
#include "ppapi/shared_impl/ppapi_preferences.h"
#include "ppapi/shared_impl/scoped_pp_var.h"
#include "ppapi/shared_impl/time_conversion.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 {
@@ -165,5 +170,75 @@ PP_Var FlashResource::GetSetting(PP_Instance instance,
return PP_MakeUndefined();
}
+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) {
+ 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
« no previous file with comments | « ppapi/proxy/flash_resource.h ('k') | ppapi/proxy/ppapi_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698