summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ppapi/ppapi.gyp4
-rw-r--r--ppapi/proxy/dispatcher.cc8
-rw-r--r--ppapi/proxy/interface_id.h2
-rw-r--r--ppapi/proxy/ppapi_messages_internal.h28
-rw-r--r--ppapi/proxy/ppb_cursor_control_proxy.cc129
-rw-r--r--ppapi/proxy/ppb_cursor_control_proxy.h54
-rw-r--r--ppapi/proxy/ppb_fullscreen_proxy.cc75
-rw-r--r--ppapi/proxy/ppb_fullscreen_proxy.h44
8 files changed, 344 insertions, 0 deletions
diff --git a/ppapi/ppapi.gyp b/ppapi/ppapi.gyp
index bd949fc..56c8881 100644
--- a/ppapi/ppapi.gyp
+++ b/ppapi/ppapi.gyp
@@ -522,8 +522,12 @@
'proxy/ppb_char_set_proxy.h',
'proxy/ppb_core_proxy.cc',
'proxy/ppb_core_proxy.h',
+ 'proxy/ppb_cursor_control_proxy.cc',
+ 'proxy/ppb_cursor_control_proxy.h',
'proxy/ppb_font_proxy.cc',
'proxy/ppb_font_proxy.h',
+ 'proxy/ppb_fullscreen_proxy.cc',
+ 'proxy/ppb_fullscreen_proxy.h',
'proxy/ppb_graphics_2d_proxy.cc',
'proxy/ppb_graphics_2d_proxy.h',
'proxy/ppb_image_data_proxy.cc',
diff --git a/ppapi/proxy/dispatcher.cc b/ppapi/proxy/dispatcher.cc
index 61365d6..491b964 100644
--- a/ppapi/proxy/dispatcher.cc
+++ b/ppapi/proxy/dispatcher.cc
@@ -14,6 +14,8 @@
#include "ipc/ipc_sync_channel.h"
#include "ppapi/c/dev/ppb_char_set_dev.h"
#include "ppapi/c/dev/ppb_font_dev.h"
+#include "ppapi/c/dev/ppb_cursor_control_dev.h"
+#include "ppapi/c/dev/ppb_fullscreen_dev.h"
#include "ppapi/c/dev/ppb_testing_dev.h"
#include "ppapi/c/dev/ppb_var_deprecated.h"
#include "ppapi/c/pp_errors.h"
@@ -28,7 +30,9 @@
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/proxy/ppb_char_set_proxy.h"
#include "ppapi/proxy/ppb_core_proxy.h"
+#include "ppapi/proxy/ppb_cursor_control_proxy.h"
#include "ppapi/proxy/ppb_font_proxy.h"
+#include "ppapi/proxy/ppb_fullscreen_proxy.h"
#include "ppapi/proxy/ppb_graphics_2d_proxy.h"
#include "ppapi/proxy/ppb_image_data_proxy.h"
#include "ppapi/proxy/ppb_instance_proxy.h"
@@ -210,8 +214,12 @@ InterfaceProxy* Dispatcher::CreateProxyForInterface(
return new PPB_CharSet_Proxy(this, interface_functions);
if (interface_name == PPB_CORE_INTERFACE)
return new PPB_Core_Proxy(this, interface_functions);
+ if (interface_name == PPB_CURSOR_CONTROL_DEV_INTERFACE)
+ return new PPB_CursorControl_Proxy(this, interface_functions);
if (interface_name == PPB_FONT_DEV_INTERFACE)
return new PPB_Font_Proxy(this, interface_functions);
+ if (interface_name == PPB_FULLSCREEN_DEV_INTERFACE)
+ return new PPB_Fullscreen_Proxy(this, interface_functions);
if (interface_name == PPB_GRAPHICS_2D_INTERFACE)
return new PPB_Graphics2D_Proxy(this, interface_functions);
if (interface_name == PPB_IMAGEDATA_INTERFACE)
diff --git a/ppapi/proxy/interface_id.h b/ppapi/proxy/interface_id.h
index c85bfc9..c181a83 100644
--- a/ppapi/proxy/interface_id.h
+++ b/ppapi/proxy/interface_id.h
@@ -14,7 +14,9 @@ enum InterfaceID {
// Zero is reserved for control messages.
INTERFACE_ID_PPB_CHAR_SET = 1,
INTERFACE_ID_PPB_CORE,
+ INTERFACE_ID_PPB_CURSORCONTROL,
INTERFACE_ID_PPB_FONT,
+ INTERFACE_ID_PPB_FULLSCREEN,
INTERFACE_ID_PPB_GRAPHICS_2D,
INTERFACE_ID_PPB_IMAGE_DATA,
INTERFACE_ID_PPB_INSTANCE,
diff --git a/ppapi/proxy/ppapi_messages_internal.h b/ppapi/proxy/ppapi_messages_internal.h
index 9375d1d..2a2c636 100644
--- a/ppapi/proxy/ppapi_messages_internal.h
+++ b/ppapi/proxy/ppapi_messages_internal.h
@@ -158,6 +158,26 @@ IPC_BEGIN_MESSAGES(PpapiHost)
PP_Module /* module */,
pp::proxy::SerializedVar /* result */)
+ // PPB_CursorControl.
+ IPC_SYNC_MESSAGE_ROUTED4_1(PpapiHostMsg_PPBCursorControl_SetCursor,
+ PP_Instance /* instance */,
+ int32_t /* type */,
+ PP_Resource /* custom_image */,
+ PP_Point /* hot_spot */,
+ PP_Bool /* result */)
+ IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBCursorControl_LockCursor,
+ PP_Instance /* instance */,
+ PP_Bool /* result */)
+ IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBCursorControl_UnlockCursor,
+ PP_Instance /* instance */,
+ PP_Bool /* result */)
+ IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBCursorControl_HasCursorLock,
+ PP_Instance /* instance */,
+ PP_Bool /* result */)
+ IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBCursorControl_CanLockCursor,
+ PP_Instance /* instance */,
+ PP_Bool /* result */)
+
// PPB_Font.
IPC_SYNC_MESSAGE_ROUTED2_3(
PpapiHostMsg_PPBFont_Create,
@@ -191,6 +211,14 @@ IPC_BEGIN_MESSAGES(PpapiHost)
uint32_t /* char_offset */,
int32_t /* result */)
+ // PPB_Fullscreen.
+ IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBFullscreen_IsFullscreen,
+ PP_Instance /* instance */,
+ PP_Bool /* result */)
+ IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBFullscreen_SetFullscreen,
+ PP_Instance /* instance */,
+ PP_Bool /* fullscreen */,
+ PP_Bool /* result */)
// PPB_Graphics2D.
IPC_SYNC_MESSAGE_ROUTED3_1(PpapiHostMsg_PPBGraphics2D_Create,
diff --git a/ppapi/proxy/ppb_cursor_control_proxy.cc b/ppapi/proxy/ppb_cursor_control_proxy.cc
new file mode 100644
index 0000000..4c6eaae
--- /dev/null
+++ b/ppapi/proxy/ppb_cursor_control_proxy.cc
@@ -0,0 +1,129 @@
+// Copyright (c) 2010 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/proxy/ppb_cursor_control_proxy.h"
+
+#include "ppapi/c/dev/ppb_cursor_control_dev.h"
+#include "ppapi/proxy/plugin_dispatcher.h"
+#include "ppapi/proxy/ppapi_messages.h"
+
+namespace pp {
+namespace proxy {
+
+namespace {
+
+PP_Bool SetCursor(PP_Instance instance_id,
+ PP_CursorType_Dev type,
+ PP_Resource custom_image_id,
+ const PP_Point* hot_spot) {
+ PP_Bool result = PP_FALSE;
+ PP_Point empty_point = { 0, 0 };
+ PluginDispatcher::Get()->Send(new PpapiHostMsg_PPBCursorControl_SetCursor(
+ INTERFACE_ID_PPB_CURSORCONTROL,
+ instance_id, static_cast<int32_t>(type), custom_image_id,
+ hot_spot ? *hot_spot : empty_point, &result));
+ return result;
+}
+
+PP_Bool LockCursor(PP_Instance instance_id) {
+ PP_Bool result = PP_FALSE;
+ PluginDispatcher::Get()->Send(new PpapiHostMsg_PPBCursorControl_LockCursor(
+ INTERFACE_ID_PPB_CURSORCONTROL, instance_id, &result));
+ return result;
+}
+
+PP_Bool UnlockCursor(PP_Instance instance_id) {
+ PP_Bool result = PP_FALSE;
+ PluginDispatcher::Get()->Send(new PpapiHostMsg_PPBCursorControl_UnlockCursor(
+ INTERFACE_ID_PPB_CURSORCONTROL, instance_id, &result));
+ return result;
+}
+
+PP_Bool HasCursorLock(PP_Instance instance_id) {
+ PP_Bool result = PP_FALSE;
+ PluginDispatcher::Get()->Send(new PpapiHostMsg_PPBCursorControl_HasCursorLock(
+ INTERFACE_ID_PPB_CURSORCONTROL, instance_id, &result));
+ return result;
+}
+
+PP_Bool CanLockCursor(PP_Instance instance_id) {
+ PP_Bool result = PP_FALSE;
+ PluginDispatcher::Get()->Send(new PpapiHostMsg_PPBCursorControl_CanLockCursor(
+ INTERFACE_ID_PPB_CURSORCONTROL, instance_id, &result));
+ return result;
+}
+
+const PPB_CursorControl_Dev cursor_control_interface = {
+ &SetCursor,
+ &LockCursor,
+ &UnlockCursor,
+ &HasCursorLock,
+ &CanLockCursor
+};
+
+} // namespace
+
+PPB_CursorControl_Proxy::PPB_CursorControl_Proxy(Dispatcher* dispatcher,
+ const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface) {
+}
+
+PPB_CursorControl_Proxy::~PPB_CursorControl_Proxy() {
+}
+
+const void* PPB_CursorControl_Proxy::GetSourceInterface() const {
+ return &cursor_control_interface;
+}
+
+InterfaceID PPB_CursorControl_Proxy::GetInterfaceId() const {
+ return INTERFACE_ID_PPB_CURSORCONTROL;
+}
+
+void PPB_CursorControl_Proxy::OnMessageReceived(const IPC::Message& msg) {
+ IPC_BEGIN_MESSAGE_MAP(PPB_CursorControl_Proxy, msg)
+ IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBCursorControl_SetCursor,
+ OnMsgSetCursor)
+ IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBCursorControl_LockCursor,
+ OnMsgLockCursor)
+ IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBCursorControl_UnlockCursor,
+ OnMsgUnlockCursor)
+ IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBCursorControl_HasCursorLock,
+ OnMsgHasCursorLock)
+ IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBCursorControl_CanLockCursor,
+ OnMsgCanLockCursor)
+ IPC_END_MESSAGE_MAP()
+ // TODO(brettw): handle bad messages!
+}
+
+void PPB_CursorControl_Proxy::OnMsgSetCursor(PP_Instance instance,
+ int32_t type,
+ PP_Resource custom_image,
+ const PP_Point& hot_spot,
+ PP_Bool* result) {
+ *result = ppb_cursor_control_target()->SetCursor(
+ instance, static_cast<PP_CursorType_Dev>(type), custom_image, &hot_spot);
+}
+
+void PPB_CursorControl_Proxy::OnMsgLockCursor(PP_Instance instance,
+ PP_Bool* result) {
+ *result = ppb_cursor_control_target()->LockCursor(instance);
+}
+
+void PPB_CursorControl_Proxy::OnMsgUnlockCursor(PP_Instance instance,
+ PP_Bool* result) {
+ *result = ppb_cursor_control_target()->UnlockCursor(instance);
+}
+
+void PPB_CursorControl_Proxy::OnMsgHasCursorLock(PP_Instance instance,
+ PP_Bool* result) {
+ *result = ppb_cursor_control_target()->HasCursorLock(instance);
+}
+
+void PPB_CursorControl_Proxy::OnMsgCanLockCursor(PP_Instance instance,
+ PP_Bool* result) {
+ *result = ppb_cursor_control_target()->CanLockCursor(instance);
+}
+
+} // namespace proxy
+} // namespace pp
diff --git a/ppapi/proxy/ppb_cursor_control_proxy.h b/ppapi/proxy/ppb_cursor_control_proxy.h
new file mode 100644
index 0000000..f540c0a
--- /dev/null
+++ b/ppapi/proxy/ppb_cursor_control_proxy.h
@@ -0,0 +1,54 @@
+// Copyright (c) 2010 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.
+
+#ifndef PPAPI_PPB_CURSOR_CONTROL_PROXY_H_
+#define PPAPI_PPB_CURSOR_CONTROL_PROXY_H_
+
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_bool.h"
+#include "ppapi/c/pp_instance.h"
+#include "ppapi/c/pp_point.h"
+#include "ppapi/c/pp_resource.h"
+#include "ppapi/proxy/interface_proxy.h"
+
+struct PPB_CursorControl_Dev;
+
+namespace pp {
+namespace proxy {
+
+class PPB_CursorControl_Proxy : public InterfaceProxy {
+ public:
+ PPB_CursorControl_Proxy(Dispatcher* dispatcher, const void* target_interface);
+ virtual ~PPB_CursorControl_Proxy();
+
+ const PPB_CursorControl_Dev* ppb_cursor_control_target() const {
+ return reinterpret_cast<const PPB_CursorControl_Dev*>(target_interface());
+ }
+
+ // InterfaceProxy implementation.
+ virtual const void* GetSourceInterface() const;
+ virtual InterfaceID GetInterfaceId() const;
+ virtual void OnMessageReceived(const IPC::Message& msg);
+
+ private:
+ // Message handlers.
+ void OnMsgSetCursor(PP_Instance instance,
+ int32_t type,
+ PP_Resource custom_image,
+ const PP_Point& hot_spot,
+ PP_Bool* result);
+ void OnMsgLockCursor(PP_Instance instance,
+ PP_Bool* result);
+ void OnMsgUnlockCursor(PP_Instance instance,
+ PP_Bool* result);
+ void OnMsgHasCursorLock(PP_Instance instance,
+ PP_Bool* result);
+ void OnMsgCanLockCursor(PP_Instance instance,
+ PP_Bool* result);
+};
+
+} // namespace proxy
+} // namespace pp
+
+#endif // PPAPI_PPB_CURSOR_CONTROL_PROXY_H_
diff --git a/ppapi/proxy/ppb_fullscreen_proxy.cc b/ppapi/proxy/ppb_fullscreen_proxy.cc
new file mode 100644
index 0000000..ddf0cdb
--- /dev/null
+++ b/ppapi/proxy/ppb_fullscreen_proxy.cc
@@ -0,0 +1,75 @@
+// Copyright (c) 2010 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/proxy/ppb_fullscreen_proxy.h"
+
+#include "ppapi/c/dev/ppb_fullscreen_dev.h"
+#include "ppapi/proxy/plugin_dispatcher.h"
+#include "ppapi/proxy/ppapi_messages.h"
+
+namespace pp {
+namespace proxy {
+
+namespace {
+
+PP_Bool IsFullscreen(PP_Instance instance) {
+ PP_Bool result = PP_FALSE;
+ PluginDispatcher::Get()->Send(new PpapiHostMsg_PPBFullscreen_IsFullscreen(
+ INTERFACE_ID_PPB_FULLSCREEN, instance, &result));
+ return result;
+}
+
+PP_Bool SetFullscreen(PP_Instance instance, PP_Bool fullscreen) {
+ PP_Bool result = PP_FALSE;
+ PluginDispatcher::Get()->Send(new PpapiHostMsg_PPBFullscreen_SetFullscreen(
+ INTERFACE_ID_PPB_FULLSCREEN, instance, fullscreen, &result));
+ return result;
+}
+
+const PPB_Fullscreen_Dev ppb_fullscreen = {
+ &IsFullscreen,
+ &SetFullscreen
+};
+
+} // namespace
+
+PPB_Fullscreen_Proxy::PPB_Fullscreen_Proxy(Dispatcher* dispatcher,
+ const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface) {
+}
+
+PPB_Fullscreen_Proxy::~PPB_Fullscreen_Proxy() {
+}
+
+const void* PPB_Fullscreen_Proxy::GetSourceInterface() const {
+ return &ppb_fullscreen;
+}
+
+InterfaceID PPB_Fullscreen_Proxy::GetInterfaceId() const {
+ return INTERFACE_ID_PPB_FULLSCREEN;
+}
+
+void PPB_Fullscreen_Proxy::OnMessageReceived(const IPC::Message& msg) {
+ IPC_BEGIN_MESSAGE_MAP(PPB_Fullscreen_Proxy, msg)
+ IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFullscreen_IsFullscreen,
+ OnMsgIsFullscreen)
+ IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFullscreen_SetFullscreen,
+ OnMsgSetFullscreen)
+ IPC_END_MESSAGE_MAP()
+ // TODO(brettw): handle bad messages!
+}
+
+void PPB_Fullscreen_Proxy::OnMsgIsFullscreen(PP_Instance instance,
+ PP_Bool* result) {
+ *result = ppb_fullscreen_target()->IsFullscreen(instance);
+}
+
+void PPB_Fullscreen_Proxy::OnMsgSetFullscreen(PP_Instance instance,
+ PP_Bool fullscreen,
+ PP_Bool* result) {
+ *result = ppb_fullscreen_target()->SetFullscreen(instance, fullscreen);
+}
+
+} // namespace proxy
+} // namespace pp
diff --git a/ppapi/proxy/ppb_fullscreen_proxy.h b/ppapi/proxy/ppb_fullscreen_proxy.h
new file mode 100644
index 0000000..f24eb7e
--- /dev/null
+++ b/ppapi/proxy/ppb_fullscreen_proxy.h
@@ -0,0 +1,44 @@
+// Copyright (c) 2010 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.
+
+#ifndef PPAPI_PPB_FULLSCREEN_PROXY_H_
+#define PPAPI_PPB_FULLSCREEN_PROXY_H_
+
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_bool.h"
+#include "ppapi/c/pp_instance.h"
+#include "ppapi/proxy/interface_proxy.h"
+
+struct PPB_Fullscreen_Dev;
+
+namespace pp {
+namespace proxy {
+
+class PPB_Fullscreen_Proxy : public InterfaceProxy {
+ public:
+ PPB_Fullscreen_Proxy(Dispatcher* dispatcher, const void* target_interface);
+ virtual ~PPB_Fullscreen_Proxy();
+
+ const PPB_Fullscreen_Dev* ppb_fullscreen_target() const {
+ return reinterpret_cast<const PPB_Fullscreen_Dev*>(target_interface());
+ }
+
+ // InterfaceProxy implementation.
+ virtual const void* GetSourceInterface() const;
+ virtual InterfaceID GetInterfaceId() const;
+ virtual void OnMessageReceived(const IPC::Message& msg);
+
+ private:
+ // Message handlers.
+ void OnMsgIsFullscreen(PP_Instance instance,
+ PP_Bool* result);
+ void OnMsgSetFullscreen(PP_Instance instance,
+ PP_Bool fullscreen,
+ PP_Bool* result);
+};
+
+} // namespace proxy
+} // namespace pp
+
+#endif // PPAPI_PPB_FULLSCREEN_PROXY_H_