summaryrefslogtreecommitdiffstats
path: root/ppapi/proxy
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-03 17:43:36 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-03 17:43:36 +0000
commite8f07ac77c1b27633eb7c6c2793d5b465e023f9f (patch)
tree6b1aa7de84dcb5f18adac114bba01c4f77a71e6b /ppapi/proxy
parent08d9dfe8c279ec894cdacdf5f0a89bd8c85a92fc (diff)
downloadchromium_src-e8f07ac77c1b27633eb7c6c2793d5b465e023f9f.zip
chromium_src-e8f07ac77c1b27633eb7c6c2793d5b465e023f9f.tar.gz
chromium_src-e8f07ac77c1b27633eb7c6c2793d5b465e023f9f.tar.bz2
Change the DidChangeView update to take a new ViewChanged resource.
This will allow us to be more flexible about adding data to view changed updates in the future. For now, I've incorporated fullscreen and tab foreground state into the view state. BUG= TEST= Review URL: http://codereview.chromium.org/8951014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116142 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/proxy')
-rw-r--r--ppapi/proxy/interface_list.cc8
-rw-r--r--ppapi/proxy/plugin_dispatcher.cc13
-rw-r--r--ppapi/proxy/plugin_dispatcher.h5
-rw-r--r--ppapi/proxy/ppapi_messages.h16
-rw-r--r--ppapi/proxy/ppapi_param_traits.h1
-rw-r--r--ppapi/proxy/ppb_instance_proxy.cc161
-rw-r--r--ppapi/proxy/ppb_instance_proxy.h112
-rw-r--r--ppapi/proxy/ppp_instance_proxy.cc142
-rw-r--r--ppapi/proxy/ppp_instance_proxy.h32
9 files changed, 271 insertions, 219 deletions
diff --git a/ppapi/proxy/interface_list.cc b/ppapi/proxy/interface_list.cc
index 9cd3e07..436cbc5c 100644
--- a/ppapi/proxy/interface_list.cc
+++ b/ppapi/proxy/interface_list.cc
@@ -39,6 +39,7 @@
#include "ppapi/c/ppb_url_request_info.h"
#include "ppapi/c/ppb_url_response_info.h"
#include "ppapi/c/ppb_var.h"
+#include "ppapi/c/ppb_view.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/ppp_instance.h"
#include "ppapi/c/private/ppb_file_ref_private.h"
@@ -186,12 +187,17 @@ InterfaceList::InterfaceList() {
AddPPB(PPB_Var_Deprecated_Proxy::GetInfo());
// PPP (plugin) interfaces.
+ // TODO(brettw) move these to interface_list*.h
+ AddProxy(API_ID_PPP_INSTANCE, &ProxyFactory<PPP_Instance_Proxy>);
+ AddPPP(PPP_INSTANCE_INTERFACE_1_1, API_ID_PPP_INSTANCE,
+ PPP_Instance_Proxy::GetInstanceInterface());
+
+ // Old-style GetInfo PPP interfaces.
// Do not add more stuff here, they should be added to interface_list*.h
// TODO(brettw) remove these.
AddPPP(PPP_Graphics3D_Proxy::GetInfo());
AddPPP(PPP_InputEvent_Proxy::GetInfo());
AddPPP(PPP_Instance_Private_Proxy::GetInfo());
- AddPPP(PPP_Instance_Proxy::GetInfo1_0());
AddPPP(PPP_Messaging_Proxy::GetInfo());
AddPPP(PPP_MouseLock_Proxy::GetInfo());
AddPPP(PPP_VideoCapture_Proxy::GetInfo());
diff --git a/ppapi/proxy/plugin_dispatcher.cc b/ppapi/proxy/plugin_dispatcher.cc
index c1eca3f..b036978 100644
--- a/ppapi/proxy/plugin_dispatcher.cc
+++ b/ppapi/proxy/plugin_dispatcher.cc
@@ -13,6 +13,7 @@
#include "ipc/ipc_sync_channel.h"
#include "base/debug/trace_event.h"
#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/ppp_instance.h"
#include "ppapi/proxy/interface_list.h"
#include "ppapi/proxy/interface_proxy.h"
#include "ppapi/proxy/plugin_message_filter.h"
@@ -42,10 +43,8 @@ InstanceToDispatcherMap* g_instance_to_dispatcher = NULL;
} // namespace
InstanceData::InstanceData()
- : fullscreen(PP_FALSE),
- flash_fullscreen(PP_FALSE),
+ : flash_fullscreen(PP_FALSE),
mouse_lock_callback(PP_BlockUntilComplete()) {
- memset(&position, 0, sizeof(position));
}
InstanceData::~InstanceData() {
@@ -219,6 +218,14 @@ void PluginDispatcher::OnMsgSupportsInterface(
const std::string& interface_name,
bool* result) {
*result = !!GetPluginInterface(interface_name);
+
+ // Do fallback for PPP_Instance. This is a hack here and if we have more
+ // cases like this it should be generalized. The PPP_Instance proxy always
+ // proxies the 1.1 interface, and then does fallback to 1.0 inside the
+ // plugin process (see PPP_Instance_Proxy). So here we return true for
+ // supporting the 1.1 interface if either 1.1 or 1.0 is supported.
+ if (!*result && interface_name == PPP_INSTANCE_INTERFACE)
+ *result = !!GetPluginInterface(PPP_INSTANCE_INTERFACE_1_0);
}
void PluginDispatcher::OnMsgSetPreferences(const Preferences& prefs) {
diff --git a/ppapi/proxy/plugin_dispatcher.h b/ppapi/proxy/plugin_dispatcher.h
index 31fe221..47df95d 100644
--- a/ppapi/proxy/plugin_dispatcher.h
+++ b/ppapi/proxy/plugin_dispatcher.h
@@ -18,6 +18,7 @@
#include "ppapi/proxy/dispatcher.h"
#include "ppapi/shared_impl/function_group_base.h"
#include "ppapi/shared_impl/ppapi_preferences.h"
+#include "ppapi/shared_impl/ppb_view_shared.h"
namespace ppapi {
@@ -32,8 +33,8 @@ struct InstanceData {
InstanceData();
~InstanceData();
- PP_Rect position;
- PP_Bool fullscreen; // Used for PPB_Fullscreen.
+ ViewData view;
+
PP_Bool flash_fullscreen; // Used for PPB_FlashFullscreen.
// When non-0, indicates the callback to execute when mouse lock is lost.
diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h
index c424d7d..0b47a71 100644
--- a/ppapi/proxy/ppapi_messages.h
+++ b/ppapi/proxy/ppapi_messages.h
@@ -19,6 +19,7 @@
#include "ipc/ipc_message_utils.h"
#include "ipc/ipc_platform_file.h"
#include "ppapi/c/dev/pp_video_capture_dev.h"
+#include "ppapi/c/dev/pp_video_dev.h"
#include "ppapi/c/dev/ppb_text_input_dev.h"
#include "ppapi/c/pp_bool.h"
#include "ppapi/c/pp_file_info.h"
@@ -28,7 +29,6 @@
#include "ppapi/c/pp_rect.h"
#include "ppapi/c/pp_resource.h"
#include "ppapi/c/pp_size.h"
-#include "ppapi/c/dev/pp_video_dev.h"
#include "ppapi/c/private/ppb_tcp_socket_private.h"
#include "ppapi/proxy/ppapi_param_traits.h"
#include "ppapi/proxy/ppapi_proxy_export.h"
@@ -37,6 +37,7 @@
#include "ppapi/shared_impl/ppapi_preferences.h"
#include "ppapi/shared_impl/ppb_input_event_shared.h"
#include "ppapi/shared_impl/ppb_url_request_info_shared.h"
+#include "ppapi/shared_impl/ppb_view_shared.h"
#undef IPC_MESSAGE_EXPORT
#define IPC_MESSAGE_EXPORT PPAPI_PROXY_EXPORT
@@ -92,6 +93,13 @@ IPC_STRUCT_TRAITS_BEGIN(ppapi::proxy::PPPVideoCapture_Buffer)
IPC_STRUCT_TRAITS_MEMBER(size)
IPC_STRUCT_TRAITS_END()
+IPC_STRUCT_TRAITS_BEGIN(ppapi::ViewData)
+ IPC_STRUCT_TRAITS_MEMBER(rect)
+ IPC_STRUCT_TRAITS_MEMBER(is_fullscreen)
+ IPC_STRUCT_TRAITS_MEMBER(is_page_visible)
+ IPC_STRUCT_TRAITS_MEMBER(clip_rect)
+IPC_STRUCT_TRAITS_END()
+
IPC_STRUCT_TRAITS_BEGIN(ppapi::Preferences)
IPC_STRUCT_TRAITS_MEMBER(standard_font_family)
IPC_STRUCT_TRAITS_MEMBER(fixed_font_family)
@@ -402,11 +410,9 @@ IPC_SYNC_MESSAGE_ROUTED3_1(PpapiMsg_PPPInstance_DidCreate,
PP_Bool /* result */)
IPC_SYNC_MESSAGE_ROUTED1_0(PpapiMsg_PPPInstance_DidDestroy,
PP_Instance /* instance */)
-IPC_MESSAGE_ROUTED5(PpapiMsg_PPPInstance_DidChangeView,
+IPC_MESSAGE_ROUTED3(PpapiMsg_PPPInstance_DidChangeView,
PP_Instance /* instance */,
- PP_Rect /* position */,
- PP_Rect /* clip */,
- PP_Bool /* fullscreen */,
+ ppapi::ViewData /* new_data */,
PP_Bool /* flash_fullscreen */)
IPC_MESSAGE_ROUTED2(PpapiMsg_PPPInstance_DidChangeFocus,
PP_Instance /* instance */,
diff --git a/ppapi/proxy/ppapi_param_traits.h b/ppapi/proxy/ppapi_param_traits.h
index 57706c5..63121f0 100644
--- a/ppapi/proxy/ppapi_param_traits.h
+++ b/ppapi/proxy/ppapi_param_traits.h
@@ -23,7 +23,6 @@ struct PP_NetAddress_Private;
namespace ppapi {
class HostResource;
-//struct PPB_FileRef_CreateInfo;
namespace proxy {
diff --git a/ppapi/proxy/ppb_instance_proxy.cc b/ppapi/proxy/ppb_instance_proxy.cc
index af417e8..c6f5c27 100644
--- a/ppapi/proxy/ppb_instance_proxy.cc
+++ b/ppapi/proxy/ppb_instance_proxy.cc
@@ -16,6 +16,7 @@
#include "ppapi/proxy/serialized_var.h"
#include "ppapi/shared_impl/ppapi_globals.h"
#include "ppapi/shared_impl/ppb_url_util_shared.h"
+#include "ppapi/shared_impl/ppb_view_shared.h"
#include "ppapi/thunk/enter.h"
#include "ppapi/thunk/thunk.h"
@@ -72,53 +73,53 @@ bool PPB_Instance_Proxy::OnMessageReceived(const IPC::Message& msg) {
IPC_BEGIN_MESSAGE_MAP(PPB_Instance_Proxy, msg)
// Plugin -> Host messages.
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetWindowObject,
- OnMsgGetWindowObject)
+ OnHostMsgGetWindowObject)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetOwnerElementObject,
- OnMsgGetOwnerElementObject)
+ OnHostMsgGetOwnerElementObject)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_BindGraphics,
- OnMsgBindGraphics)
+ OnHostMsgBindGraphics)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_IsFullFrame,
- OnMsgIsFullFrame)
+ OnHostMsgIsFullFrame)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ExecuteScript,
- OnMsgExecuteScript)
+ OnHostMsgExecuteScript)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetDefaultCharSet,
- OnMsgGetDefaultCharSet)
+ OnHostMsgGetDefaultCharSet)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_Log,
- OnMsgLog)
+ OnHostMsgLog)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_LogWithSource,
- OnMsgLogWithSource)
+ OnHostMsgLogWithSource)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_PostMessage,
- OnMsgPostMessage)
+ OnHostMsgPostMessage)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_FlashSetFullscreen,
- OnMsgFlashSetFullscreen)
+ OnHostMsgFlashSetFullscreen)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_FlashGetScreenSize,
- OnMsgFlashGetScreenSize)
+ OnHostMsgFlashGetScreenSize)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SetFullscreen,
- OnMsgSetFullscreen)
+ OnHostMsgSetFullscreen)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetScreenSize,
- OnMsgGetScreenSize)
+ OnHostMsgGetScreenSize)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_RequestInputEvents,
- OnMsgRequestInputEvents)
+ OnHostMsgRequestInputEvents)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ClearInputEvents,
- OnMsgClearInputEvents)
+ OnHostMsgClearInputEvents)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_LockMouse,
- OnMsgLockMouse)
+ OnHostMsgLockMouse)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_UnlockMouse,
- OnMsgUnlockMouse)
+ OnHostMsgUnlockMouse)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ResolveRelativeToDocument,
- OnMsgResolveRelativeToDocument)
+ OnHostMsgResolveRelativeToDocument)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DocumentCanRequest,
- OnMsgDocumentCanRequest)
+ OnHostMsgDocumentCanRequest)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DocumentCanAccessDocument,
- OnMsgDocumentCanAccessDocument)
+ OnHostMsgDocumentCanAccessDocument)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetDocumentURL,
- OnMsgGetDocumentURL)
+ OnHostMsgGetDocumentURL)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetPluginInstanceURL,
- OnMsgGetPluginInstanceURL)
+ OnHostMsgGetPluginInstanceURL)
// Host -> Plugin messages.
IPC_MESSAGE_HANDLER(PpapiMsg_PPBInstance_MouseLockComplete,
- OnMsgMouseLockComplete)
+ OnPluginMsgMouseLockComplete)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
@@ -150,6 +151,14 @@ PP_Bool PPB_Instance_Proxy::IsFullFrame(PP_Instance instance) {
return result;
}
+const ViewData* PPB_Instance_Proxy::GetViewData(PP_Instance instance) {
+ InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())->
+ GetInstanceData(instance);
+ if (!data)
+ return NULL;
+ return &data->view;
+}
+
PP_Var PPB_Instance_Proxy::GetWindowObject(PP_Instance instance) {
ReceiveSerializedVarReturnValue result;
dispatcher()->Send(new PpapiHostMsg_PPBInstance_GetWindowObject(
@@ -218,14 +227,6 @@ void PPB_Instance_Proxy::SelectedFindResultChanged(PP_Instance instance,
NOTIMPLEMENTED(); // Not proxied yet.
}
-PP_Bool PPB_Instance_Proxy::IsFullscreen(PP_Instance instance) {
- InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())->
- GetInstanceData(instance);
- if (!data)
- return PP_FALSE;
- return data->fullscreen;
-}
-
PP_Bool PPB_Instance_Proxy::FlashIsFullscreen(PP_Instance instance) {
InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())->
GetInstanceData(instance);
@@ -392,7 +393,7 @@ void PPB_Instance_Proxy::UnlockMouse(PP_Instance instance) {
API_ID_PPB_INSTANCE, instance));
}
-void PPB_Instance_Proxy::OnMsgGetWindowObject(
+void PPB_Instance_Proxy::OnHostMsgGetWindowObject(
PP_Instance instance,
SerializedVarReturnValue result) {
EnterInstanceNoLock enter(instance, false);
@@ -400,7 +401,7 @@ void PPB_Instance_Proxy::OnMsgGetWindowObject(
result.Return(dispatcher(), enter.functions()->GetWindowObject(instance));
}
-void PPB_Instance_Proxy::OnMsgGetOwnerElementObject(
+void PPB_Instance_Proxy::OnHostMsgGetOwnerElementObject(
PP_Instance instance,
SerializedVarReturnValue result) {
EnterInstanceNoLock enter(instance, false);
@@ -410,9 +411,9 @@ void PPB_Instance_Proxy::OnMsgGetOwnerElementObject(
}
}
-void PPB_Instance_Proxy::OnMsgBindGraphics(PP_Instance instance,
- const HostResource& device,
- PP_Bool* result) {
+void PPB_Instance_Proxy::OnHostMsgBindGraphics(PP_Instance instance,
+ const HostResource& device,
+ PP_Bool* result) {
EnterInstanceNoLock enter(instance, false);
if (enter.succeeded()) {
*result = enter.functions()->BindGraphics(instance,
@@ -420,14 +421,14 @@ void PPB_Instance_Proxy::OnMsgBindGraphics(PP_Instance instance,
}
}
-void PPB_Instance_Proxy::OnMsgIsFullFrame(PP_Instance instance,
- PP_Bool* result) {
+void PPB_Instance_Proxy::OnHostMsgIsFullFrame(PP_Instance instance,
+ PP_Bool* result) {
EnterInstanceNoLock enter(instance, false);
if (enter.succeeded())
*result = enter.functions()->IsFullFrame(instance);
}
-void PPB_Instance_Proxy::OnMsgExecuteScript(
+void PPB_Instance_Proxy::OnHostMsgExecuteScript(
PP_Instance instance,
SerializedVarReceiveInput script,
SerializedVarOutParam out_exception,
@@ -447,7 +448,7 @@ void PPB_Instance_Proxy::OnMsgExecuteScript(
out_exception.OutParam(dispatcher())));
}
-void PPB_Instance_Proxy::OnMsgGetDefaultCharSet(
+void PPB_Instance_Proxy::OnHostMsgGetDefaultCharSet(
PP_Instance instance,
SerializedVarReturnValue result) {
EnterInstanceNoLock enter(instance, false);
@@ -455,18 +456,19 @@ void PPB_Instance_Proxy::OnMsgGetDefaultCharSet(
result.Return(dispatcher(), enter.functions()->GetDefaultCharSet(instance));
}
-void PPB_Instance_Proxy::OnMsgLog(PP_Instance instance,
- int log_level,
- SerializedVarReceiveInput value) {
+void PPB_Instance_Proxy::OnHostMsgLog(PP_Instance instance,
+ int log_level,
+ SerializedVarReceiveInput value) {
EnterInstanceNoLock enter(instance, false);
if (enter.succeeded())
enter.functions()->Log(instance, log_level, value.Get(dispatcher()));
}
-void PPB_Instance_Proxy::OnMsgLogWithSource(PP_Instance instance,
- int log_level,
- SerializedVarReceiveInput source,
- SerializedVarReceiveInput value) {
+void PPB_Instance_Proxy::OnHostMsgLogWithSource(
+ PP_Instance instance,
+ int log_level,
+ SerializedVarReceiveInput source,
+ SerializedVarReceiveInput value) {
EnterInstanceNoLock enter(instance, false);
if (enter.succeeded()) {
enter.functions()->LogWithSource(instance, log_level,
@@ -475,42 +477,42 @@ void PPB_Instance_Proxy::OnMsgLogWithSource(PP_Instance instance,
}
}
-void PPB_Instance_Proxy::OnMsgSetFullscreen(PP_Instance instance,
- PP_Bool fullscreen,
- PP_Bool* result) {
+void PPB_Instance_Proxy::OnHostMsgSetFullscreen(PP_Instance instance,
+ PP_Bool fullscreen,
+ PP_Bool* result) {
EnterInstanceNoLock enter(instance, false);
if (enter.succeeded())
*result = enter.functions()->SetFullscreen(instance, fullscreen);
}
-void PPB_Instance_Proxy::OnMsgFlashSetFullscreen(PP_Instance instance,
- PP_Bool fullscreen,
- PP_Bool* result) {
+void PPB_Instance_Proxy::OnHostMsgFlashSetFullscreen(PP_Instance instance,
+ PP_Bool fullscreen,
+ PP_Bool* result) {
EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false);
if (enter.succeeded())
*result = enter.functions()->FlashSetFullscreen(instance, fullscreen);
}
-void PPB_Instance_Proxy::OnMsgGetScreenSize(PP_Instance instance,
- PP_Bool* result,
- PP_Size* size) {
+void PPB_Instance_Proxy::OnHostMsgGetScreenSize(PP_Instance instance,
+ PP_Bool* result,
+ PP_Size* size) {
EnterInstanceNoLock enter(instance, false);
if (enter.succeeded())
*result = enter.functions()->GetScreenSize(instance, size);
}
-void PPB_Instance_Proxy::OnMsgFlashGetScreenSize(PP_Instance instance,
- PP_Bool* result,
- PP_Size* size) {
+void PPB_Instance_Proxy::OnHostMsgFlashGetScreenSize(PP_Instance instance,
+ PP_Bool* result,
+ PP_Size* size) {
EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false);
if (enter.succeeded())
*result = enter.functions()->FlashGetScreenSize(instance, size);
}
-void PPB_Instance_Proxy::OnMsgRequestInputEvents(PP_Instance instance,
- bool is_filtering,
- uint32_t event_classes) {
+void PPB_Instance_Proxy::OnHostMsgRequestInputEvents(PP_Instance instance,
+ bool is_filtering,
+ uint32_t event_classes) {
EnterInstanceNoLock enter(instance, false);
if (enter.succeeded()) {
if (is_filtering)
@@ -520,21 +522,21 @@ void PPB_Instance_Proxy::OnMsgRequestInputEvents(PP_Instance instance,
}
}
-void PPB_Instance_Proxy::OnMsgClearInputEvents(PP_Instance instance,
- uint32_t event_classes) {
+void PPB_Instance_Proxy::OnHostMsgClearInputEvents(PP_Instance instance,
+ uint32_t event_classes) {
EnterInstanceNoLock enter(instance, false);
if (enter.succeeded())
enter.functions()->ClearInputEventRequest(instance, event_classes);
}
-void PPB_Instance_Proxy::OnMsgPostMessage(PP_Instance instance,
+void PPB_Instance_Proxy::OnHostMsgPostMessage(PP_Instance instance,
SerializedVarReceiveInput message) {
EnterInstanceNoLock enter(instance, false);
if (enter.succeeded())
enter.functions()->PostMessage(instance, message.Get(dispatcher()));
}
-void PPB_Instance_Proxy::OnMsgLockMouse(PP_Instance instance) {
+void PPB_Instance_Proxy::OnHostMsgLockMouse(PP_Instance instance) {
EnterHostFunctionForceCallback<PPB_Instance_FunctionAPI> enter(
instance, callback_factory_,
&PPB_Instance_Proxy::MouseLockCompleteInHost, instance);
@@ -542,13 +544,13 @@ void PPB_Instance_Proxy::OnMsgLockMouse(PP_Instance instance) {
enter.SetResult(enter.functions()->LockMouse(instance, enter.callback()));
}
-void PPB_Instance_Proxy::OnMsgUnlockMouse(PP_Instance instance) {
+void PPB_Instance_Proxy::OnHostMsgUnlockMouse(PP_Instance instance) {
EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, true);
if (enter.succeeded())
enter.functions()->UnlockMouse(instance);
}
-void PPB_Instance_Proxy::OnMsgResolveRelativeToDocument(
+void PPB_Instance_Proxy::OnHostMsgResolveRelativeToDocument(
PP_Instance instance,
SerializedVarReceiveInput relative,
SerializedVarReturnValue result) {
@@ -560,9 +562,10 @@ void PPB_Instance_Proxy::OnMsgResolveRelativeToDocument(
}
}
-void PPB_Instance_Proxy::OnMsgDocumentCanRequest(PP_Instance instance,
- SerializedVarReceiveInput url,
- PP_Bool* result) {
+void PPB_Instance_Proxy::OnHostMsgDocumentCanRequest(
+ PP_Instance instance,
+ SerializedVarReceiveInput url,
+ PP_Bool* result) {
EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, true);
if (enter.succeeded()) {
*result = enter.functions()->DocumentCanRequest(instance,
@@ -570,16 +573,16 @@ void PPB_Instance_Proxy::OnMsgDocumentCanRequest(PP_Instance instance,
}
}
-void PPB_Instance_Proxy::OnMsgDocumentCanAccessDocument(PP_Instance active,
- PP_Instance target,
- PP_Bool* result) {
+void PPB_Instance_Proxy::OnHostMsgDocumentCanAccessDocument(PP_Instance active,
+ PP_Instance target,
+ PP_Bool* result) {
EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(active, true);
if (enter.succeeded())
*result = enter.functions()->DocumentCanAccessDocument(active, target);
}
-void PPB_Instance_Proxy::OnMsgGetDocumentURL(PP_Instance instance,
- SerializedVarReturnValue result) {
+void PPB_Instance_Proxy::OnHostMsgGetDocumentURL(PP_Instance instance,
+ SerializedVarReturnValue result) {
EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, true);
if (enter.succeeded()) {
result.Return(dispatcher(),
@@ -587,7 +590,7 @@ void PPB_Instance_Proxy::OnMsgGetDocumentURL(PP_Instance instance,
}
}
-void PPB_Instance_Proxy::OnMsgGetPluginInstanceURL(
+void PPB_Instance_Proxy::OnHostMsgGetPluginInstanceURL(
PP_Instance instance,
SerializedVarReturnValue result) {
EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, true);
@@ -597,8 +600,8 @@ void PPB_Instance_Proxy::OnMsgGetPluginInstanceURL(
}
}
-void PPB_Instance_Proxy::OnMsgMouseLockComplete(PP_Instance instance,
- int32_t result) {
+void PPB_Instance_Proxy::OnPluginMsgMouseLockComplete(PP_Instance instance,
+ int32_t result) {
// Save the mouse callback on the instance data.
InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())->
GetInstanceData(instance);
diff --git a/ppapi/proxy/ppb_instance_proxy.h b/ppapi/proxy/ppb_instance_proxy.h
index eeb791c..de10f80 100644
--- a/ppapi/proxy/ppb_instance_proxy.h
+++ b/ppapi/proxy/ppb_instance_proxy.h
@@ -47,6 +47,7 @@ class PPB_Instance_Proxy : public InterfaceProxy,
virtual PP_Bool BindGraphics(PP_Instance instance,
PP_Resource device) OVERRIDE;
virtual PP_Bool IsFullFrame(PP_Instance instance) OVERRIDE;
+ virtual const ViewData* GetViewData(PP_Instance instance) OVERRIDE;
virtual PP_Var GetWindowObject(PP_Instance instance) OVERRIDE;
virtual PP_Var GetOwnerElementObject(PP_Instance instance) OVERRIDE;
virtual PP_Var ExecuteScript(PP_Instance instance,
@@ -65,7 +66,6 @@ class PPB_Instance_Proxy : public InterfaceProxy,
PP_Bool final_result) OVERRIDE;
virtual void SelectedFindResultChanged(PP_Instance instance,
int32_t index) OVERRIDE;
- virtual PP_Bool IsFullscreen(PP_Instance instance) OVERRIDE;
virtual PP_Bool SetFullscreen(PP_Instance instance,
PP_Bool fullscreen) OVERRIDE;
virtual PP_Bool GetScreenSize(PP_Instance instance,
@@ -106,64 +106,64 @@ class PPB_Instance_Proxy : public InterfaceProxy,
private:
// Plugin -> Host message handlers.
- void OnMsgGetWindowObject(PP_Instance instance,
- SerializedVarReturnValue result);
- void OnMsgGetOwnerElementObject(PP_Instance instance,
- SerializedVarReturnValue result);
- void OnMsgBindGraphics(PP_Instance instance,
- const ppapi::HostResource& device,
- PP_Bool* result);
- void OnMsgIsFullFrame(PP_Instance instance, PP_Bool* result);
- void OnMsgExecuteScript(PP_Instance instance,
- SerializedVarReceiveInput script,
- SerializedVarOutParam out_exception,
- SerializedVarReturnValue result);
- void OnMsgGetDefaultCharSet(PP_Instance instance,
- SerializedVarReturnValue result);
- void OnMsgLog(PP_Instance instance,
- int log_level,
- SerializedVarReceiveInput value);
- void OnMsgLogWithSource(PP_Instance instance,
- int log_level,
- SerializedVarReceiveInput source,
- SerializedVarReceiveInput value);
- void OnMsgSetFullscreen(PP_Instance instance,
- PP_Bool fullscreen,
- PP_Bool* result);
- void OnMsgGetScreenSize(PP_Instance instance,
- PP_Bool* result,
- PP_Size* size);
- void OnMsgFlashSetFullscreen(PP_Instance instance,
- PP_Bool fullscreen,
- PP_Bool* result);
- void OnMsgFlashGetScreenSize(PP_Instance instance,
- PP_Bool* result,
- PP_Size* size);
- void OnMsgRequestInputEvents(PP_Instance instance,
- bool is_filtering,
- uint32_t event_classes);
- void OnMsgClearInputEvents(PP_Instance instance,
- uint32_t event_classes);
- void OnMsgPostMessage(PP_Instance instance,
- SerializedVarReceiveInput message);
- void OnMsgLockMouse(PP_Instance instance);
- void OnMsgUnlockMouse(PP_Instance instance);
- void OnMsgResolveRelativeToDocument(PP_Instance instance,
- SerializedVarReceiveInput relative,
+ void OnHostMsgGetWindowObject(PP_Instance instance,
+ SerializedVarReturnValue result);
+ void OnHostMsgGetOwnerElementObject(PP_Instance instance,
SerializedVarReturnValue result);
- void OnMsgDocumentCanRequest(PP_Instance instance,
- SerializedVarReceiveInput url,
- PP_Bool* result);
- void OnMsgDocumentCanAccessDocument(PP_Instance active,
- PP_Instance target,
- PP_Bool* result);
- void OnMsgGetDocumentURL(PP_Instance instance,
- SerializedVarReturnValue result);
- void OnMsgGetPluginInstanceURL(PP_Instance instance,
- SerializedVarReturnValue result);
+ void OnHostMsgBindGraphics(PP_Instance instance,
+ const ppapi::HostResource& device,
+ PP_Bool* result);
+ void OnHostMsgIsFullFrame(PP_Instance instance, PP_Bool* result);
+ void OnHostMsgExecuteScript(PP_Instance instance,
+ SerializedVarReceiveInput script,
+ SerializedVarOutParam out_exception,
+ SerializedVarReturnValue result);
+ void OnHostMsgGetDefaultCharSet(PP_Instance instance,
+ SerializedVarReturnValue result);
+ void OnHostMsgLog(PP_Instance instance,
+ int log_level,
+ SerializedVarReceiveInput value);
+ void OnHostMsgLogWithSource(PP_Instance instance,
+ int log_level,
+ SerializedVarReceiveInput source,
+ SerializedVarReceiveInput value);
+ void OnHostMsgSetFullscreen(PP_Instance instance,
+ PP_Bool fullscreen,
+ PP_Bool* result);
+ void OnHostMsgGetScreenSize(PP_Instance instance,
+ PP_Bool* result,
+ PP_Size* size);
+ void OnHostMsgFlashSetFullscreen(PP_Instance instance,
+ PP_Bool fullscreen,
+ PP_Bool* result);
+ void OnHostMsgFlashGetScreenSize(PP_Instance instance,
+ PP_Bool* result,
+ PP_Size* size);
+ void OnHostMsgRequestInputEvents(PP_Instance instance,
+ bool is_filtering,
+ uint32_t event_classes);
+ void OnHostMsgClearInputEvents(PP_Instance instance,
+ uint32_t event_classes);
+ void OnHostMsgPostMessage(PP_Instance instance,
+ SerializedVarReceiveInput message);
+ void OnHostMsgLockMouse(PP_Instance instance);
+ void OnHostMsgUnlockMouse(PP_Instance instance);
+ void OnHostMsgResolveRelativeToDocument(PP_Instance instance,
+ SerializedVarReceiveInput relative,
+ SerializedVarReturnValue result);
+ void OnHostMsgDocumentCanRequest(PP_Instance instance,
+ SerializedVarReceiveInput url,
+ PP_Bool* result);
+ void OnHostMsgDocumentCanAccessDocument(PP_Instance active,
+ PP_Instance target,
+ PP_Bool* result);
+ void OnHostMsgGetDocumentURL(PP_Instance instance,
+ SerializedVarReturnValue result);
+ void OnHostMsgGetPluginInstanceURL(PP_Instance instance,
+ SerializedVarReturnValue result);
// Host -> Plugin message handlers.
- void OnMsgMouseLockComplete(PP_Instance instance, int32_t result);
+ void OnPluginMsgMouseLockComplete(PP_Instance instance, int32_t result);
void MouseLockCompleteInHost(int32_t result, PP_Instance instance);
diff --git a/ppapi/proxy/ppp_instance_proxy.cc b/ppapi/proxy/ppp_instance_proxy.cc
index 28f7b78..8ad8ae4 100644
--- a/ppapi/proxy/ppp_instance_proxy.cc
+++ b/ppapi/proxy/ppp_instance_proxy.cc
@@ -8,6 +8,7 @@
#include "ppapi/c/pp_var.h"
#include "ppapi/c/ppb_core.h"
+#include "ppapi/c/ppb_fullscreen.h"
#include "ppapi/c/ppp_instance.h"
#include "ppapi/c/private/ppb_flash_fullscreen.h"
#include "ppapi/proxy/host_dispatcher.h"
@@ -16,12 +17,36 @@
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/proxy/ppb_url_loader_proxy.h"
#include "ppapi/shared_impl/ppapi_globals.h"
+#include "ppapi/shared_impl/ppb_view_shared.h"
+#include "ppapi/shared_impl/scoped_pp_resource.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_view_api.h"
namespace ppapi {
namespace proxy {
namespace {
+void GetFullscreenStates(PP_Instance instance,
+ HostDispatcher* dispatcher,
+ PP_Bool* fullscreen,
+ PP_Bool* flash_fullscreen) {
+ const PPB_Fullscreen* fullscreen_interface =
+ static_cast<const PPB_Fullscreen*>(
+ dispatcher->local_get_interface()(PPB_FULLSCREEN_INTERFACE));
+ DCHECK(fullscreen_interface);
+ *fullscreen = fullscreen_interface->IsFullscreen(instance);
+}
+
+PP_Bool IsFlashFullscreen(PP_Instance instance,
+ HostDispatcher* dispatcher) {
+ const PPB_FlashFullscreen* flash_fullscreen_interface =
+ static_cast<const PPB_FlashFullscreen*>(
+ dispatcher->local_get_interface()(PPB_FLASHFULLSCREEN_INTERFACE));
+ DCHECK(flash_fullscreen_interface);
+ return flash_fullscreen_interface->IsFullscreen(instance);
+}
+
PP_Bool DidCreate(PP_Instance instance,
uint32_t argc,
const char* argn[],
@@ -45,26 +70,18 @@ void DidDestroy(PP_Instance instance) {
new PpapiMsg_PPPInstance_DidDestroy(API_ID_PPP_INSTANCE, instance));
}
-void DidChangeView(PP_Instance instance,
- const PP_Rect* position,
- const PP_Rect* clip) {
+void DidChangeView(PP_Instance instance, PP_Resource view_resource) {
HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance);
- const PPB_FlashFullscreen* fullscreen_interface =
- static_cast<const PPB_FlashFullscreen*>(
- dispatcher->local_get_interface()(PPB_FLASHFULLSCREEN_INTERFACE));
- DCHECK(fullscreen_interface);
- const PPB_FlashFullscreen* flash_fullscreen_interface =
- static_cast<const PPB_FlashFullscreen*>(
- dispatcher->local_get_interface()(PPB_FLASHFULLSCREEN_INTERFACE));
- DCHECK(flash_fullscreen_interface);
- PP_Bool fullscreen = fullscreen_interface->IsFullscreen(instance);
- PP_Bool flash_fullscreen =
- flash_fullscreen_interface->IsFullscreen(instance);
- dispatcher->Send(
- new PpapiMsg_PPPInstance_DidChangeView(API_ID_PPP_INSTANCE,
- instance, *position, *clip,
- fullscreen,
- flash_fullscreen));
+
+ thunk::EnterResourceNoLock<thunk::PPB_View_API> enter(view_resource, false);
+ if (enter.failed()) {
+ NOTREACHED();
+ return;
+ }
+
+ dispatcher->Send(new PpapiMsg_PPPInstance_DidChangeView(
+ API_ID_PPP_INSTANCE, instance, enter.object()->GetData(),
+ IsFlashFullscreen(instance, dispatcher)));
}
void DidChangeFocus(PP_Instance instance, PP_Bool has_focus) {
@@ -105,7 +122,7 @@ PP_Bool HandleDocumentLoad(PP_Instance instance,
return result;
}
-static const PPP_Instance_1_0 instance_interface_1_0 = {
+static const PPP_Instance_1_1 instance_interface = {
&DidCreate,
&DidDestroy,
&DidChangeView,
@@ -113,18 +130,30 @@ static const PPP_Instance_1_0 instance_interface_1_0 = {
&HandleDocumentLoad
};
-InterfaceProxy* CreateInstanceProxy(Dispatcher* dispatcher) {
- return new PPP_Instance_Proxy(dispatcher);
-}
-
} // namespace
PPP_Instance_Proxy::PPP_Instance_Proxy(Dispatcher* dispatcher)
: InterfaceProxy(dispatcher) {
if (dispatcher->IsPlugin()) {
- combined_interface_.reset(
- new PPP_Instance_Combined(*static_cast<const PPP_Instance_1_0*>(
- dispatcher->local_get_interface()(PPP_INSTANCE_INTERFACE_1_0))));
+ // The PPP_Instance proxy works by always proxying the 1.1 version of the
+ // interface, and then detecting in the plugin process which one to use.
+ // PPP_Instance_Combined handles dispatching to whatever interface is
+ // supported.
+ //
+ // This means that if the plugin supports either 1.0 or 1.1 version of
+ // the interface, we want to say it supports the 1.1 version since we'll
+ // convert it here. This magic conversion code is hardcoded into
+ // PluginDispatcher::OnMsgSupportsInterface.
+ const PPP_Instance* instance = static_cast<const PPP_Instance*>(
+ dispatcher->local_get_interface()(PPP_INSTANCE_INTERFACE));
+ if (instance) {
+ combined_interface_.reset(new PPP_Instance_Combined(*instance));
+ } else {
+ const PPP_Instance_1_0* instance_1_0 =
+ static_cast<const PPP_Instance_1_0*>(
+ dispatcher->local_get_interface()(PPP_INSTANCE_INTERFACE_1_0));
+ combined_interface_.reset(new PPP_Instance_Combined(*instance_1_0));
+ }
}
}
@@ -132,36 +161,29 @@ PPP_Instance_Proxy::~PPP_Instance_Proxy() {
}
// static
-const InterfaceProxy::Info* PPP_Instance_Proxy::GetInfo1_0() {
- static const Info info = {
- &instance_interface_1_0,
- PPP_INSTANCE_INTERFACE_1_0,
- API_ID_PPP_INSTANCE,
- false,
- &CreateInstanceProxy
- };
- return &info;
+const PPP_Instance* PPP_Instance_Proxy::GetInstanceInterface() {
+ return &instance_interface;
}
bool PPP_Instance_Proxy::OnMessageReceived(const IPC::Message& msg) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(PPP_Instance_Proxy, msg)
IPC_MESSAGE_HANDLER(PpapiMsg_PPPInstance_DidCreate,
- OnMsgDidCreate)
+ OnPluginMsgDidCreate)
IPC_MESSAGE_HANDLER(PpapiMsg_PPPInstance_DidDestroy,
- OnMsgDidDestroy)
+ OnPluginMsgDidDestroy)
IPC_MESSAGE_HANDLER(PpapiMsg_PPPInstance_DidChangeView,
- OnMsgDidChangeView)
+ OnPluginMsgDidChangeView)
IPC_MESSAGE_HANDLER(PpapiMsg_PPPInstance_DidChangeFocus,
- OnMsgDidChangeFocus)
+ OnPluginMsgDidChangeFocus)
IPC_MESSAGE_HANDLER(PpapiMsg_PPPInstance_HandleDocumentLoad,
- OnMsgHandleDocumentLoad)
+ OnPluginMsgHandleDocumentLoad)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
}
-void PPP_Instance_Proxy::OnMsgDidCreate(
+void PPP_Instance_Proxy::OnPluginMsgDidCreate(
PP_Instance instance,
const std::vector<std::string>& argn,
const std::vector<std::string>& argv,
@@ -195,37 +217,45 @@ void PPP_Instance_Proxy::OnMsgDidCreate(
&argn_array[0], &argv_array[0]);
}
-void PPP_Instance_Proxy::OnMsgDidDestroy(PP_Instance instance) {
+void PPP_Instance_Proxy::OnPluginMsgDidDestroy(PP_Instance instance) {
combined_interface_->DidDestroy(instance);
PpapiGlobals::Get()->GetResourceTracker()->DidDeleteInstance(instance);
static_cast<PluginDispatcher*>(dispatcher())->DidDestroyInstance(instance);
}
-void PPP_Instance_Proxy::OnMsgDidChangeView(PP_Instance instance,
- const PP_Rect& position,
- const PP_Rect& clip,
- PP_Bool fullscreen,
- PP_Bool flash_fullscreen) {
+void PPP_Instance_Proxy::OnPluginMsgDidChangeView(
+ PP_Instance instance,
+ const ViewData& new_data,
+ PP_Bool flash_fullscreen) {
PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
if (!dispatcher)
return;
InstanceData* data = dispatcher->GetInstanceData(instance);
if (!data)
return;
- data->position = position;
- data->fullscreen = fullscreen;
+
+ data->view = new_data;
data->flash_fullscreen = flash_fullscreen;
- combined_interface_->DidChangeView(instance, &position, &clip);
+
+ ScopedPPResource resource(
+ ScopedPPResource::PassRef(),
+ (new PPB_View_Shared(PPB_View_Shared::InitAsProxy(),
+ instance, new_data))->GetReference());
+
+ combined_interface_->DidChangeView(instance, resource,
+ &new_data.rect,
+ &new_data.clip_rect);
}
-void PPP_Instance_Proxy::OnMsgDidChangeFocus(PP_Instance instance,
- PP_Bool has_focus) {
+void PPP_Instance_Proxy::OnPluginMsgDidChangeFocus(PP_Instance instance,
+ PP_Bool has_focus) {
combined_interface_->DidChangeFocus(instance, has_focus);
}
-void PPP_Instance_Proxy::OnMsgHandleDocumentLoad(PP_Instance instance,
- const HostResource& url_loader,
- PP_Bool* result) {
+void PPP_Instance_Proxy::OnPluginMsgHandleDocumentLoad(
+ PP_Instance instance,
+ const HostResource& url_loader,
+ PP_Bool* result) {
PP_Resource plugin_loader =
PPB_URLLoader_Proxy::TrackPluginResource(url_loader);
*result = combined_interface_->HandleDocumentLoad(instance, plugin_loader);
diff --git a/ppapi/proxy/ppp_instance_proxy.h b/ppapi/proxy/ppp_instance_proxy.h
index 2fce675..1b599d0 100644
--- a/ppapi/proxy/ppp_instance_proxy.h
+++ b/ppapi/proxy/ppp_instance_proxy.h
@@ -19,6 +19,9 @@
struct PP_Rect;
namespace ppapi {
+
+struct ViewData;
+
namespace proxy {
class PPP_Instance_Proxy : public InterfaceProxy {
@@ -26,8 +29,7 @@ class PPP_Instance_Proxy : public InterfaceProxy {
explicit PPP_Instance_Proxy(Dispatcher* dispatcher);
virtual ~PPP_Instance_Proxy();
- // Return the info for the 1.0 (latest, canonical) version of the interface.
- static const Info* GetInfo1_0();
+ static const PPP_Instance* GetInstanceInterface();
PPP_Instance_Combined* ppp_instance_target() const {
return combined_interface_.get();
@@ -38,20 +40,18 @@ class PPP_Instance_Proxy : public InterfaceProxy {
private:
// Message handlers.
- void OnMsgDidCreate(PP_Instance instance,
- const std::vector<std::string>& argn,
- const std::vector<std::string>& argv,
- PP_Bool* result);
- void OnMsgDidDestroy(PP_Instance instance);
- void OnMsgDidChangeView(PP_Instance instance,
- const PP_Rect& position,
- const PP_Rect& clip,
- PP_Bool fullscreen,
- PP_Bool flash_fullscreen);
- void OnMsgDidChangeFocus(PP_Instance instance, PP_Bool has_focus);
- void OnMsgHandleDocumentLoad(PP_Instance instance,
- const HostResource& url_loader,
- PP_Bool* result);
+ void OnPluginMsgDidCreate(PP_Instance instance,
+ const std::vector<std::string>& argn,
+ const std::vector<std::string>& argv,
+ PP_Bool* result);
+ void OnPluginMsgDidDestroy(PP_Instance instance);
+ void OnPluginMsgDidChangeView(PP_Instance instance,
+ const ViewData& new_data,
+ PP_Bool flash_fullscreen);
+ void OnPluginMsgDidChangeFocus(PP_Instance instance, PP_Bool has_focus);
+ void OnPluginMsgHandleDocumentLoad(PP_Instance instance,
+ const HostResource& url_loader,
+ PP_Bool* result);
scoped_ptr<PPP_Instance_Combined> combined_interface_;
};