forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Re-land previous change r65856. Add implementations for Fullscreen an…
…d CursorControl interfaces. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65914 0039d316-1c4b-4281-b951-d872f2087c98
- Loading branch information
brettw@chromium.org
committed
Nov 12, 2010
1 parent
c149f3b
commit a301033
Showing
8 changed files
with
344 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Oops, something went wrong.