summaryrefslogtreecommitdiffstats
path: root/ppapi/proxy
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-15 00:03:35 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-15 00:03:35 +0000
commit2e4361ae9dfaff3359914a89e2ff66771a10c955 (patch)
tree73567e3307c6cf2f64e7322ac4678278a1486fce /ppapi/proxy
parente5aea01b2a4bf4363be6b77995c388202038018c (diff)
downloadchromium_src-2e4361ae9dfaff3359914a89e2ff66771a10c955.zip
chromium_src-2e4361ae9dfaff3359914a89e2ff66771a10c955.tar.gz
chromium_src-2e4361ae9dfaff3359914a89e2ff66771a10c955.tar.bz2
Rev the Flash interface to add new functionality.
This adds support for IDL in the private directory. Some of the interfaces there don't actually work, they were a work in progress and this breaks everything, so I moved the broken files to a new subdirectory. Everything left in the api/private directory can be autogenerated now. BUG= TEST= Review URL: http://codereview.chromium.org/8930023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114534 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/proxy')
-rw-r--r--ppapi/proxy/interface_list.cc6
-rw-r--r--ppapi/proxy/ppapi_messages.h2
-rw-r--r--ppapi/proxy/ppapi_param_traits.cc2
-rw-r--r--ppapi/proxy/ppb_flash_proxy.cc73
-rw-r--r--ppapi/proxy/ppb_flash_proxy.h8
-rw-r--r--ppapi/proxy/serialized_structs.h1
6 files changed, 72 insertions, 20 deletions
diff --git a/ppapi/proxy/interface_list.cc b/ppapi/proxy/interface_list.cc
index 2d5b90b..9cd3e07 100644
--- a/ppapi/proxy/interface_list.cc
+++ b/ppapi/proxy/interface_list.cc
@@ -248,8 +248,10 @@ const void* InterfaceList::GetInterfaceForPPP(const std::string& name) const {
void InterfaceList::AddFlashInterfaces() {
AddProxy(API_ID_PPB_FLASH, &ProxyFactory<PPB_Flash_Proxy>);
- AddPPB(PPB_FLASH_INTERFACE, API_ID_PPB_FLASH,
- PPB_Flash_Proxy::GetInterface());
+ AddPPB(PPB_FLASH_INTERFACE_11_0, API_ID_PPB_FLASH,
+ PPB_Flash_Proxy::GetInterface11());
+ AddPPB(PPB_FLASH_INTERFACE_12_0, API_ID_PPB_FLASH,
+ PPB_Flash_Proxy::GetInterface12());
AddProxy(API_ID_PPB_FLASH_CLIPBOARD,
&ProxyFactory<PPB_Flash_Clipboard_Proxy>);
diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h
index 67d0166..c424d7d 100644
--- a/ppapi/proxy/ppapi_messages.h
+++ b/ppapi/proxy/ppapi_messages.h
@@ -663,7 +663,7 @@ IPC_SYNC_MESSAGE_ROUTED4_1(PpapiHostMsg_PPBFlash_Navigate,
PP_Instance /* instance */,
ppapi::PPB_URLRequestInfo_Data /* request_data */,
std::string /* target */,
- bool /* from_user_action */,
+ PP_Bool /* from_user_action */,
int32_t /* result */)
IPC_SYNC_MESSAGE_ROUTED1_0(PpapiHostMsg_PPBFlash_RunMessageLoop,
PP_Instance /* instance */)
diff --git a/ppapi/proxy/ppapi_param_traits.cc b/ppapi/proxy/ppapi_param_traits.cc
index ca03910..23d2b72 100644
--- a/ppapi/proxy/ppapi_param_traits.cc
+++ b/ppapi/proxy/ppapi_param_traits.cc
@@ -212,6 +212,7 @@ void ParamTraits<ppapi::proxy::PPBFlash_DrawGlyphs_Params>::Write(
ParamTraits<float>::Write(m, p.transformation[2][0]);
ParamTraits<float>::Write(m, p.transformation[2][1]);
ParamTraits<float>::Write(m, p.transformation[2][2]);
+ ParamTraits<PP_Bool>::Write(m, p.allow_subpixel_aa);
ParamTraits<std::vector<uint16_t> >::Write(m, p.glyph_indices);
ParamTraits<std::vector<PP_Point> >::Write(m, p.glyph_advances);
}
@@ -238,6 +239,7 @@ bool ParamTraits<ppapi::proxy::PPBFlash_DrawGlyphs_Params>::Read(
ParamTraits<float>::Read(m, iter, &r->transformation[2][0]) &&
ParamTraits<float>::Read(m, iter, &r->transformation[2][1]) &&
ParamTraits<float>::Read(m, iter, &r->transformation[2][2]) &&
+ ParamTraits<PP_Bool>::Read(m, iter, &r->allow_subpixel_aa) &&
ParamTraits<std::vector<uint16_t> >::Read(m, iter, &r->glyph_indices) &&
ParamTraits<std::vector<PP_Point> >::Read(m, iter, &r->glyph_advances) &&
r->glyph_indices.size() == r->glyph_advances.size();
diff --git a/ppapi/proxy/ppb_flash_proxy.cc b/ppapi/proxy/ppb_flash_proxy.cc
index 2dcd68b..ae12cd0 100644
--- a/ppapi/proxy/ppb_flash_proxy.cc
+++ b/ppapi/proxy/ppb_flash_proxy.cc
@@ -43,9 +43,10 @@ PP_Bool DrawGlyphs(PP_Instance instance,
PP_Resource pp_image_data,
const PP_FontDescription_Dev* font_desc,
uint32_t color,
- PP_Point position,
- PP_Rect clip,
+ 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[]) {
@@ -67,12 +68,13 @@ PP_Bool DrawGlyphs(PP_Instance instance,
params.image_data = image_data->host_resource();
params.font_desc.SetFromPPFontDescription(dispatcher, *font_desc, true);
params.color = color;
- params.position = position;
- params.clip = clip;
+ 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],
@@ -87,6 +89,22 @@ PP_Bool DrawGlyphs(PP_Instance instance,
return result;
}
+PP_Bool DrawGlyphs11(PP_Instance instance,
+ PP_Resource pp_image_data,
+ const PP_FontDescription_Dev* font_desc,
+ uint32_t color,
+ PP_Point position,
+ PP_Rect clip,
+ const float transformation[3][3],
+ uint32_t glyph_count,
+ const uint16_t glyph_indices[],
+ const PP_Point glyph_advances[]) {
+ // Backwards-compatible version.
+ return DrawGlyphs(instance, pp_image_data, font_desc, color, &position,
+ &clip, transformation, PP_TRUE, glyph_count, glyph_indices,
+ glyph_advances);
+}
+
PP_Var GetProxyForURL(PP_Instance instance, const char* url) {
PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
if (!dispatcher)
@@ -100,7 +118,7 @@ PP_Var GetProxyForURL(PP_Instance instance, const char* url) {
int32_t Navigate(PP_Resource request_id,
const char* target,
- bool from_user_action) {
+ PP_Bool from_user_action) {
thunk::EnterResource<thunk::PPB_URLRequestInfo_API> enter(request_id, true);
if (enter.failed())
return PP_ERROR_BADRESOURCE;
@@ -118,6 +136,13 @@ int32_t Navigate(PP_Resource request_id,
return result;
}
+int32_t Navigate11(PP_Resource request_id,
+ const char* target,
+ bool from_user_action) {
+ // Backwards-compatible version.
+ return Navigate(request_id, target, PP_FromBool(from_user_action));
+}
+
void RunMessageLoop(PP_Instance instance) {
PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
if (!dispatcher)
@@ -158,20 +183,32 @@ PP_Var GetCommandLineArgs(PP_Module /*pp_module*/) {
return StringVar::StringToPPVar(args);
}
-const PPB_Flash flash_interface = {
+void PreLoadFontInWindows(const void* logfontw) {
+ // TODO(brettw) implement this.
+}
+
+const PPB_Flash_11 flash_interface_11 = {
&SetInstanceAlwaysOnTop,
- &DrawGlyphs,
+ &DrawGlyphs11,
&GetProxyForURL,
- &Navigate,
+ &Navigate11,
&RunMessageLoop,
&QuitMessageLoop,
&GetLocalTimeZoneOffset,
&GetCommandLineArgs
};
-InterfaceProxy* CreateFlashProxy(Dispatcher* dispatcher) {
- return new PPB_Flash_Proxy(dispatcher);
-}
+const PPB_Flash flash_interface_12 = {
+ &SetInstanceAlwaysOnTop,
+ &DrawGlyphs,
+ &GetProxyForURL,
+ &Navigate,
+ &RunMessageLoop,
+ &QuitMessageLoop,
+ &GetLocalTimeZoneOffset,
+ &GetCommandLineArgs,
+ &PreLoadFontInWindows
+};
} // namespace
@@ -187,8 +224,13 @@ PPB_Flash_Proxy::~PPB_Flash_Proxy() {
}
// static
-const PPB_Flash* PPB_Flash_Proxy::GetInterface() {
- return &flash_interface;
+const PPB_Flash_11* PPB_Flash_Proxy::GetInterface11() {
+ return &flash_interface_11;
+}
+
+// static
+const PPB_Flash* PPB_Flash_Proxy::GetInterface12() {
+ return &flash_interface_12;
}
bool PPB_Flash_Proxy::OnMessageReceived(const IPC::Message& msg) {
@@ -238,8 +280,9 @@ void PPB_Flash_Proxy::OnMsgDrawGlyphs(const PPBFlash_DrawGlyphs_Params& params,
*result = ppb_flash_impl_->DrawGlyphs(
0, // Unused instance param.
params.image_data.host_resource(), &font_desc,
- params.color, params.position, params.clip,
+ params.color, &params.position, &params.clip,
const_cast<float(*)[3]>(params.transformation),
+ params.allow_subpixel_aa,
static_cast<uint32_t>(params.glyph_indices.size()),
const_cast<uint16_t*>(&params.glyph_indices[0]),
const_cast<PP_Point*>(&params.glyph_advances[0]));
@@ -255,7 +298,7 @@ void PPB_Flash_Proxy::OnMsgGetProxyForURL(PP_Instance instance,
void PPB_Flash_Proxy::OnMsgNavigate(PP_Instance instance,
const PPB_URLRequestInfo_Data& data,
const std::string& target,
- bool from_user_action,
+ PP_Bool from_user_action,
int32_t* result) {
DCHECK(!dispatcher()->IsPlugin());
diff --git a/ppapi/proxy/ppb_flash_proxy.h b/ppapi/proxy/ppb_flash_proxy.h
index 8151d23..1939b22 100644
--- a/ppapi/proxy/ppb_flash_proxy.h
+++ b/ppapi/proxy/ppb_flash_proxy.h
@@ -9,6 +9,7 @@
#include <vector>
#include "ipc/ipc_platform_file.h"
+#include "ppapi/c/pp_bool.h"
#include "ppapi/c/pp_instance.h"
#include "ppapi/c/pp_module.h"
#include "ppapi/c/pp_time.h"
@@ -16,6 +17,7 @@
#include "ppapi/shared_impl/host_resource.h"
struct PPB_Flash;
+struct PPB_Flash_11;
namespace ppapi {
@@ -31,7 +33,9 @@ class PPB_Flash_Proxy : public InterfaceProxy {
explicit PPB_Flash_Proxy(Dispatcher* dispatcher);
virtual ~PPB_Flash_Proxy();
- static const PPB_Flash* GetInterface();
+ // Returns the corresponding version of the Flash interface pointer.
+ static const PPB_Flash_11* GetInterface11();
+ static const PPB_Flash* GetInterface12();
// InterfaceProxy implementation.
virtual bool OnMessageReceived(const IPC::Message& msg);
@@ -48,7 +52,7 @@ class PPB_Flash_Proxy : public InterfaceProxy {
void OnMsgNavigate(PP_Instance instance,
const PPB_URLRequestInfo_Data& data,
const std::string& target,
- bool from_user_action,
+ PP_Bool from_user_action,
int32_t* result);
void OnMsgRunMessageLoop(PP_Instance instance);
void OnMsgQuitMessageLoop(PP_Instance instance);
diff --git a/ppapi/proxy/serialized_structs.h b/ppapi/proxy/serialized_structs.h
index ea85757..4007c3b 100644
--- a/ppapi/proxy/serialized_structs.h
+++ b/ppapi/proxy/serialized_structs.h
@@ -81,6 +81,7 @@ struct PPBFlash_DrawGlyphs_Params {
PP_Point position;
PP_Rect clip;
float transformation[3][3];
+ PP_Bool allow_subpixel_aa;
std::vector<uint16_t> glyph_indices;
std::vector<PP_Point> glyph_advances;
};