diff options
author | raymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-30 01:55:44 +0000 |
---|---|---|
committer | raymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-30 01:55:44 +0000 |
commit | 22fdaa65859604b35e1196cfe568e020f71310f3 (patch) | |
tree | a9fd75cc2e83b507f8c4d91b7db5d5becda62cb3 | |
parent | f511afb6940373a304131e0a547bcfe17749d0db (diff) | |
download | chromium_src-22fdaa65859604b35e1196cfe568e020f71310f3.zip chromium_src-22fdaa65859604b35e1196cfe568e020f71310f3.tar.gz chromium_src-22fdaa65859604b35e1196cfe568e020f71310f3.tar.bz2 |
Refactor PPB_Flash_Fullscreen to the new resource model.
This moves PPB_Flash_Fullscreen to the new ppapi resource model and removes the in-process implementation.
BUG=
Review URL: https://chromiumcodereview.appspot.com/11421066
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@170346 0039d316-1c4b-4281-b951-d872f2087c98
29 files changed, 311 insertions, 157 deletions
diff --git a/chrome/chrome_renderer.gypi b/chrome/chrome_renderer.gypi index ad02dde..89d35ad 100644 --- a/chrome/chrome_renderer.gypi +++ b/chrome/chrome_renderer.gypi @@ -203,6 +203,8 @@ 'renderer/pepper/chrome_renderer_pepper_host_factory.h', 'renderer/pepper/pepper_flash_font_file_host.cc', 'renderer/pepper/pepper_flash_font_file_host.h', + 'renderer/pepper/pepper_flash_fullscreen_host.cc', + 'renderer/pepper/pepper_flash_fullscreen_host.h', 'renderer/pepper/pepper_flash_menu_host.cc', 'renderer/pepper/pepper_flash_menu_host.h', 'renderer/pepper/pepper_flash_renderer_message_filter.cc', diff --git a/chrome/renderer/pepper/chrome_renderer_pepper_host_factory.cc b/chrome/renderer/pepper/chrome_renderer_pepper_host_factory.cc index 9287e1c..017eafd 100644 --- a/chrome/renderer/pepper/chrome_renderer_pepper_host_factory.cc +++ b/chrome/renderer/pepper/chrome_renderer_pepper_host_factory.cc @@ -6,6 +6,7 @@ #include "base/logging.h" #include "chrome/renderer/pepper/pepper_flash_font_file_host.h" +#include "chrome/renderer/pepper/pepper_flash_fullscreen_host.h" #include "chrome/renderer/pepper/pepper_flash_menu_host.h" #include "content/public/renderer/renderer_ppapi_host.h" #include "ppapi/host/ppapi_host.h" @@ -51,6 +52,11 @@ ChromeRendererPepperHostFactory::CreateResourceHost( } break; } + case PpapiHostMsg_FlashFullscreen_Create::ID: { + return scoped_ptr<ResourceHost>(new PepperFlashFullscreenHost( + host_, instance, params.pp_resource())); + break; + } case PpapiHostMsg_FlashMenu_Create::ID: { ppapi::proxy::SerializedFlashMenu serialized_menu; if (ppapi::UnpackMessage<PpapiHostMsg_FlashMenu_Create>( diff --git a/chrome/renderer/pepper/pepper_flash_fullscreen_host.cc b/chrome/renderer/pepper/pepper_flash_fullscreen_host.cc new file mode 100644 index 0000000..45ca836 --- /dev/null +++ b/chrome/renderer/pepper/pepper_flash_fullscreen_host.cc @@ -0,0 +1,52 @@ +// Copyright (c) 2012 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 "chrome/renderer/pepper/pepper_flash_fullscreen_host.h" + +#include "content/public/renderer/renderer_ppapi_host.h" +#include "ppapi/c/pp_errors.h" +#include "ppapi/host/dispatch_host_message.h" +#include "ppapi/host/host_message_context.h" +#include "ppapi/host/ppapi_host.h" +#include "ppapi/proxy/ppapi_messages.h" +#include "webkit/plugins/ppapi/ppapi_plugin_instance.h" + +namespace chrome { + +PepperFlashFullscreenHost::PepperFlashFullscreenHost( + content::RendererPpapiHost* host, + PP_Instance instance, + PP_Resource resource) + : ResourceHost(host->GetPpapiHost(), instance, resource), + renderer_ppapi_host_(host) { +} + +PepperFlashFullscreenHost::~PepperFlashFullscreenHost() { +} + +int32_t PepperFlashFullscreenHost::OnResourceMessageReceived( + const IPC::Message& msg, + ppapi::host::HostMessageContext* context) { + IPC_BEGIN_MESSAGE_MAP(PepperFlashFullscreenHost, msg) + PPAPI_DISPATCH_HOST_RESOURCE_CALL( + PpapiHostMsg_FlashFullscreen_SetFullscreen, + OnMsgSetFullscreen) + IPC_END_MESSAGE_MAP() + return PP_ERROR_FAILED; +} + +int32_t PepperFlashFullscreenHost::OnMsgSetFullscreen( + ppapi::host::HostMessageContext* context, + bool fullscreen) { + webkit::ppapi::PluginInstance* plugin_instance = + renderer_ppapi_host_->GetPluginInstance(pp_instance()); + if (plugin_instance) { + plugin_instance->FlashSetFullscreen(fullscreen, true); + return PP_OK; + } + return PP_ERROR_FAILED; +} + +} // namespace chrome + diff --git a/chrome/renderer/pepper/pepper_flash_fullscreen_host.h b/chrome/renderer/pepper/pepper_flash_fullscreen_host.h new file mode 100644 index 0000000..37e7d46 --- /dev/null +++ b/chrome/renderer/pepper/pepper_flash_fullscreen_host.h @@ -0,0 +1,41 @@ +// Copyright (c) 2012 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 CHROME_RENDERER_PEPPER_PEPPER_FLASH_FULLSCREEN_HOST_H_ +#define CHROME_RENDERER_PEPPER_PEPPER_FLASH_FULLSCREEN_HOST_H_ + +#include "base/basictypes.h" +#include "base/compiler_specific.h" +#include "ppapi/host/resource_host.h" + +namespace content { +class RendererPpapiHost; +} + +namespace chrome { + +class PepperFlashFullscreenHost : public ppapi::host::ResourceHost { + public: + PepperFlashFullscreenHost(content::RendererPpapiHost* host, + PP_Instance instance, + PP_Resource resource); + virtual ~PepperFlashFullscreenHost(); + + virtual int32_t OnResourceMessageReceived( + const IPC::Message& msg, + ppapi::host::HostMessageContext* context) OVERRIDE; + + private: + int32_t OnMsgSetFullscreen(ppapi::host::HostMessageContext* context, + bool fullscreen); + + // Non-owning pointer. + content::RendererPpapiHost* renderer_ppapi_host_; + + DISALLOW_COPY_AND_ASSIGN(PepperFlashFullscreenHost); +}; + +} // namespace chrome + +#endif // CHROME_RENDERER_PEPPER_PEPPER_FLASH_FULLSCREEN_HOST_H_ diff --git a/chrome/test/ppapi/ppapi_browsertest.cc b/chrome/test/ppapi/ppapi_browsertest.cc index 5596347..94f2a97 100644 --- a/chrome/test/ppapi/ppapi_browsertest.cc +++ b/chrome/test/ppapi/ppapi_browsertest.cc @@ -582,27 +582,6 @@ TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(FileSystem) TEST_PPAPI_NACL_VIA_HTTP(MAYBE_FileSystem) -// Mac/Aura reach NOTIMPLEMENTED/time out. -// Other systems work in-process, but flake out-of-process because of the -// asyncronous nature of the proxy. -// mac: http://crbug.com/96767 -// aura: http://crbug.com/104384 -// async flakiness: http://crbug.com/108471 -#if defined(OS_MACOSX) || defined(USE_AURA) -#define MAYBE_FlashFullscreen DISABLED_FlashFullscreen -#define MAYBE_OutOfProcessFlashFullscreen DISABLED_FlashFullscreen -#else -#define MAYBE_FlashFullscreen FlashFullscreen -#define MAYBE_OutOfProcessFlashFullscreen FlashFullscreen -#endif - -IN_PROC_BROWSER_TEST_F(PPAPITest, MAYBE_FlashFullscreen) { - RunTestViaHTTP("FlashFullscreen"); -} -IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, MAYBE_OutOfProcessFlashFullscreen) { - RunTestViaHTTP("FlashFullscreen"); -} - #if defined(OS_MACOSX) // http://crbug.com/103912 #define MAYBE_Fullscreen DISABLED_Fullscreen @@ -918,6 +897,15 @@ TEST_PPAPI_OUT_OF_PROCESS(MessageLoop_Post) // Going forward, Flash APIs will only work out-of-process. TEST_PPAPI_OUT_OF_PROCESS(FlashClipboard) TEST_PPAPI_OUT_OF_PROCESS(FlashFile_CreateTemporaryFile) +// Mac/Aura reach NOTIMPLEMENTED/time out. +// mac: http://crbug.com/96767 +// aura: http://crbug.com/104384 +#if defined(OS_MACOSX) || defined(USE_AURA) +#define MAYBE_FlashFullscreen DISABLED_FlashFullscreen +#else +#define MAYBE_FlashFullscreen FlashFullscreen +#endif +TEST_PPAPI_OUT_OF_PROCESS(MAYBE_FlashFullscreen) TEST_PPAPI_IN_PROCESS(TalkPrivate) TEST_PPAPI_OUT_OF_PROCESS(TalkPrivate) diff --git a/ppapi/ppapi_proxy.gypi b/ppapi/ppapi_proxy.gypi index 6db746c..32796e1 100644 --- a/ppapi/ppapi_proxy.gypi +++ b/ppapi/ppapi_proxy.gypi @@ -39,6 +39,8 @@ 'proxy/flash_device_id_resource.h', 'proxy/flash_font_file_resource.cc', 'proxy/flash_font_file_resource.h', + 'proxy/flash_fullscreen_resource.cc', + 'proxy/flash_fullscreen_resource.h', 'proxy/flash_menu_resource.cc', 'proxy/flash_menu_resource.h', 'proxy/flash_resource.cc', @@ -183,6 +185,7 @@ 'proxy/flash_clipboard_resource.cc', 'proxy/flash_device_id_resource.cc', 'proxy/flash_font_file_resource.cc', + 'proxy/flash_fullscreen_resource.cc', 'proxy/flash_menu_resource.cc', 'proxy/flash_resource.cc', 'proxy/host_dispatcher.cc', diff --git a/ppapi/ppapi_shared.gypi b/ppapi/ppapi_shared.gypi index 461108f..da446ef 100644 --- a/ppapi/ppapi_shared.gypi +++ b/ppapi/ppapi_shared.gypi @@ -162,6 +162,7 @@ 'thunk/ppb_file_system_thunk.cc', 'thunk/ppb_find_thunk.cc', 'thunk/ppb_flash_api.h', + 'thunk/ppb_flash_clipboard_api.h', 'thunk/ppb_flash_clipboard_thunk.cc', 'thunk/ppb_flash_device_id_api.h', 'thunk/ppb_flash_device_id_thunk.cc', @@ -169,6 +170,7 @@ 'thunk/ppb_flash_file_modulelocal_thunk.cc', 'thunk/ppb_flash_font_file_api.h', 'thunk/ppb_flash_font_file_thunk.cc', + 'thunk/ppb_flash_fullscreen_api.h', 'thunk/ppb_flash_fullscreen_thunk.cc', 'thunk/ppb_flash_functions_api.h', 'thunk/ppb_flash_menu_api.h', diff --git a/ppapi/proxy/flash_fullscreen_resource.cc b/ppapi/proxy/flash_fullscreen_resource.cc new file mode 100644 index 0000000..90a68fc --- /dev/null +++ b/ppapi/proxy/flash_fullscreen_resource.cc @@ -0,0 +1,46 @@ +// Copyright (c) 2012 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/flash_fullscreen_resource.h" + +#include "ppapi/c/pp_bool.h" +#include "ppapi/proxy/ppapi_messages.h" + +namespace ppapi { +namespace proxy { + +FlashFullscreenResource::FlashFullscreenResource(Connection connection, + PP_Instance instance) + : PluginResource(connection, instance), + is_fullscreen_(PP_FALSE) { +} + +FlashFullscreenResource::~FlashFullscreenResource() { +} + +thunk::PPB_Flash_Fullscreen_API* +FlashFullscreenResource::AsPPB_Flash_Fullscreen_API() { + return this; +} + +PP_Bool FlashFullscreenResource::IsFullscreen(PP_Instance instance) { + return is_fullscreen_; +} + +PP_Bool FlashFullscreenResource::SetFullscreen(PP_Instance instance, + PP_Bool fullscreen) { + if (!sent_create_to_renderer()) + SendCreate(RENDERER, PpapiHostMsg_FlashFullscreen_Create()); + int32_t result = SyncCall<IPC::Message>(RENDERER, + PpapiHostMsg_FlashFullscreen_SetFullscreen(PP_ToBool(fullscreen))); + return PP_FromBool(result == PP_OK); +} + +void FlashFullscreenResource::SetLocalIsFullscreen(PP_Instance instance, + PP_Bool is_fullscreen) { + is_fullscreen_ = is_fullscreen; +} + +} // namespace proxy +} // namespace ppapi diff --git a/ppapi/proxy/flash_fullscreen_resource.h b/ppapi/proxy/flash_fullscreen_resource.h new file mode 100644 index 0000000..c6d5ccb --- /dev/null +++ b/ppapi/proxy/flash_fullscreen_resource.h @@ -0,0 +1,43 @@ +// Copyright (c) 2012 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_PROXY_FLASH_FULLSCREEN_RESOURCE_H_ +#define PPAPI_PROXY_FLASH_FULLSCREEN_RESOURCE_H_ + +#include "ppapi/proxy/connection.h" +#include "ppapi/proxy/plugin_resource.h" +#include "ppapi/thunk/ppb_flash_fullscreen_api.h" + +namespace ppapi { +namespace proxy { + +class FlashFullscreenResource + : public PluginResource, + public thunk::PPB_Flash_Fullscreen_API { + public: + FlashFullscreenResource(Connection connection, + PP_Instance instance); + virtual ~FlashFullscreenResource(); + + // Resource overrides. + virtual thunk::PPB_Flash_Fullscreen_API* + AsPPB_Flash_Fullscreen_API() OVERRIDE; + + // PPB_Flash_Fullscreen_API implementation. + virtual PP_Bool IsFullscreen(PP_Instance instance) OVERRIDE; + virtual PP_Bool SetFullscreen(PP_Instance instance, + PP_Bool fullscreen) OVERRIDE; + virtual void SetLocalIsFullscreen(PP_Instance instance, + PP_Bool is_fullscreen) OVERRIDE; + + private: + PP_Bool is_fullscreen_; + + DISALLOW_COPY_AND_ASSIGN(FlashFullscreenResource); +}; + +} // namespace proxy +} // namespace ppapi + +#endif // PPAPI_PROXY_FLASH_FULLSCREEN_RESOURCE_H_ diff --git a/ppapi/proxy/plugin_dispatcher.cc b/ppapi/proxy/plugin_dispatcher.cc index 137031d..0198b6b 100644 --- a/ppapi/proxy/plugin_dispatcher.cc +++ b/ppapi/proxy/plugin_dispatcher.cc @@ -50,8 +50,7 @@ DispatcherSet* g_live_dispatchers = NULL; } // namespace InstanceData::InstanceData() - : flash_fullscreen(PP_FALSE), - is_request_surrounding_text_pending(false), + : is_request_surrounding_text_pending(false), should_do_request_surrounding_text(false) { } diff --git a/ppapi/proxy/plugin_dispatcher.h b/ppapi/proxy/plugin_dispatcher.h index f944d45..98f43a6 100644 --- a/ppapi/proxy/plugin_dispatcher.h +++ b/ppapi/proxy/plugin_dispatcher.h @@ -47,8 +47,6 @@ struct InstanceData { ViewData view; - PP_Bool flash_fullscreen; // Used for PPB_FlashFullscreen. - // When non-NULL, indicates the callback to execute when mouse lock is lost. scoped_refptr<TrackedCallback> mouse_lock_callback; diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h index 2bec742..5aa940c 100644 --- a/ppapi/proxy/ppapi_messages.h +++ b/ppapi/proxy/ppapi_messages.h @@ -1279,14 +1279,6 @@ IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBFlash_IsRectTopmost, PP_Instance /* instance */, PP_Rect /* rect */, PP_Bool /* result */) -IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBFlash_FlashSetFullscreen, - PP_Instance /* instance */, - PP_Bool /* fullscreen */, - PP_Bool /* result */) -IPC_SYNC_MESSAGE_ROUTED1_2(PpapiHostMsg_PPBFlash_FlashGetScreenSize, - PP_Instance /* instance */, - PP_Bool /* result */, - PP_Size /* size */) IPC_MESSAGE_ROUTED0(PpapiHostMsg_PPBFlash_UpdateActivity) IPC_SYNC_MESSAGE_ROUTED3_2(PpapiHostMsg_PPBFlash_OpenFileRef, PP_Instance /* instance */, @@ -1633,6 +1625,11 @@ IPC_MESSAGE_CONTROL1(PpapiHostMsg_FlashFontFile_GetFontTable, IPC_MESSAGE_CONTROL1(PpapiPluginMsg_FlashFontFile_GetFontTableReply, std::string /* output */) +// Flash fullscreen. +IPC_MESSAGE_CONTROL0(PpapiHostMsg_FlashFullscreen_Create) +IPC_MESSAGE_CONTROL1(PpapiHostMsg_FlashFullscreen_SetFullscreen, + bool /* fullscreen */) + // FlashMenu ------------------------------------------------------------------ // Creates the flash menu with the given data. diff --git a/ppapi/proxy/ppapi_proxy_test.cc b/ppapi/proxy/ppapi_proxy_test.cc index 52fe44b..117a80c 100644 --- a/ppapi/proxy/ppapi_proxy_test.cc +++ b/ppapi/proxy/ppapi_proxy_test.cc @@ -175,7 +175,6 @@ void PluginProxyTestHarness::SetUpHarness() { PpapiPermissions(), false)); plugin_dispatcher_->InitWithTestSink(&sink()); - plugin_dispatcher_->DidCreateInstance(pp_instance()); // The plugin proxy delegate is needed for // |PluginProxyDelegate::GetBrowserSender| which is used // in |ResourceCreationProxy::GetConnection| to get the channel to the @@ -183,6 +182,7 @@ void PluginProxyTestHarness::SetUpHarness() { // for test purposes. plugin_delegate_mock_.set_browser_sender(plugin_dispatcher_.get()); PluginGlobals::Get()->set_plugin_proxy_delegate(&plugin_delegate_mock_); + plugin_dispatcher_->DidCreateInstance(pp_instance()); } void PluginProxyTestHarness::SetUpHarnessWithChannel( @@ -204,6 +204,8 @@ void PluginProxyTestHarness::SetUpHarnessWithChannel( plugin_dispatcher_->InitPluginWithChannel(&plugin_delegate_mock_, channel_handle, is_client); + plugin_delegate_mock_.set_browser_sender(plugin_dispatcher_.get()); + PluginGlobals::Get()->set_plugin_proxy_delegate(&plugin_delegate_mock_); plugin_dispatcher_->DidCreateInstance(pp_instance()); } diff --git a/ppapi/proxy/ppb_flash_proxy.cc b/ppapi/proxy/ppb_flash_proxy.cc index 494d948..0846dde 100644 --- a/ppapi/proxy/ppb_flash_proxy.cc +++ b/ppapi/proxy/ppb_flash_proxy.cc @@ -113,10 +113,6 @@ bool PPB_Flash_Proxy::OnMessageReceived(const IPC::Message& msg) { OnHostMsgGetLocalTimeZoneOffset) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_IsRectTopmost, OnHostMsgIsRectTopmost) - IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_FlashSetFullscreen, - OnHostMsgFlashSetFullscreen) - IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_FlashGetScreenSize, - OnHostMsgFlashGetScreenSize) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_OpenFileRef, OnHostMsgOpenFileRef) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_QueryFileRef, @@ -494,30 +490,6 @@ int32_t PPB_Flash_Proxy::QueryFileRef(PP_Instance instance, return result; } -PP_Bool PPB_Flash_Proxy::FlashIsFullscreen(PP_Instance instance) { - InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> - GetInstanceData(instance); - if (!data) - return PP_FALSE; - return data->flash_fullscreen; -} - -PP_Bool PPB_Flash_Proxy::FlashSetFullscreen(PP_Instance instance, - PP_Bool fullscreen) { - PP_Bool result = PP_FALSE; - dispatcher()->Send(new PpapiHostMsg_PPBFlash_FlashSetFullscreen( - API_ID_PPB_FLASH, instance, fullscreen, &result)); - return result; -} - -PP_Bool PPB_Flash_Proxy::FlashGetScreenSize(PP_Instance instance, - PP_Size* size) { - PP_Bool result = PP_FALSE; - dispatcher()->Send(new PpapiHostMsg_PPBFlash_FlashGetScreenSize( - API_ID_PPB_FLASH, instance, &result, size)); - return result; -} - void PPB_Flash_Proxy::OnHostMsgSetInstanceAlwaysOnTop(PP_Instance instance, PP_Bool on_top) { EnterInstanceNoLock enter(instance); @@ -621,31 +593,6 @@ void PPB_Flash_Proxy::OnHostMsgIsRectTopmost(PP_Instance instance, *result = PP_FALSE; } -void PPB_Flash_Proxy::OnHostMsgFlashSetFullscreen(PP_Instance instance, - PP_Bool fullscreen, - PP_Bool* result) { - EnterInstanceNoLock enter(instance); - if (enter.succeeded()) { - *result = enter.functions()->GetFlashAPI()->FlashSetFullscreen( - instance, fullscreen); - } else { - *result = PP_FALSE; - } -} - -void PPB_Flash_Proxy::OnHostMsgFlashGetScreenSize(PP_Instance instance, - PP_Bool* result, - PP_Size* size) { - EnterInstanceNoLock enter(instance); - if (enter.succeeded()) { - *result = enter.functions()->GetFlashAPI()->FlashGetScreenSize( - instance, size); - } else { - size->width = 0; - size->height = 0; - } -} - void PPB_Flash_Proxy::OnHostMsgOpenFileRef( PP_Instance instance, const HostResource& host_resource, diff --git a/ppapi/proxy/ppb_flash_proxy.h b/ppapi/proxy/ppb_flash_proxy.h index 1c644bf..faf4488 100644 --- a/ppapi/proxy/ppb_flash_proxy.h +++ b/ppapi/proxy/ppb_flash_proxy.h @@ -111,11 +111,6 @@ class PPB_Flash_Proxy : public InterfaceProxy, public PPB_Flash_Shared { virtual int32_t QueryFileRef(PP_Instance instance, PP_Resource file_ref, PP_FileInfo* info) OVERRIDE; - virtual PP_Bool FlashIsFullscreen(PP_Instance instance) OVERRIDE; - virtual PP_Bool FlashSetFullscreen(PP_Instance instance, - PP_Bool fullscreen) OVERRIDE; - virtual PP_Bool FlashGetScreenSize(PP_Instance instance, - PP_Size* size) OVERRIDE; static const ApiID kApiID = API_ID_PPB_FLASH; @@ -139,12 +134,6 @@ class PPB_Flash_Proxy : public InterfaceProxy, public PPB_Flash_Shared { void OnHostMsgIsRectTopmost(PP_Instance instance, PP_Rect rect, PP_Bool* result); - void OnHostMsgFlashSetFullscreen(PP_Instance instance, - PP_Bool fullscreen, - PP_Bool* result); - void OnHostMsgFlashGetScreenSize(PP_Instance instance, - PP_Bool* result, - PP_Size* size); void OnHostMsgOpenFileRef(PP_Instance instance, const ppapi::HostResource& host_resource, int32_t mode, diff --git a/ppapi/proxy/ppb_instance_proxy.cc b/ppapi/proxy/ppb_instance_proxy.cc index 603e34d..9c69bbd 100644 --- a/ppapi/proxy/ppb_instance_proxy.cc +++ b/ppapi/proxy/ppb_instance_proxy.cc @@ -17,6 +17,7 @@ #include "ppapi/proxy/content_decryptor_private_serializer.h" #include "ppapi/proxy/enter_proxy.h" #include "ppapi/proxy/flash_clipboard_resource.h" +#include "ppapi/proxy/flash_fullscreen_resource.h" #include "ppapi/proxy/flash_resource.h" #include "ppapi/proxy/gamepad_resource.h" #include "ppapi/proxy/host_dispatcher.h" @@ -249,6 +250,13 @@ const ViewData* PPB_Instance_Proxy::GetViewData(PP_Instance instance) { return &data->view; } +PP_Bool PPB_Instance_Proxy::FlashIsFullscreen(PP_Instance instance) { + // This function is only used for proxying in the renderer process. It is not + // implemented in the plugin process. + NOTREACHED(); + return PP_FALSE; +} + PP_Var PPB_Instance_Proxy::GetWindowObject(PP_Instance instance) { ReceiveSerializedVarReturnValue result; dispatcher()->Send(new PpapiHostMsg_PPBInstance_GetWindowObject( @@ -372,15 +380,19 @@ Resource* PPB_Instance_Proxy::GetSingletonResource(PP_Instance instance, break; // Flash resources aren't needed for NaCl. #if !defined(OS_NACL) && !defined(NACL_WIN64) - case FLASH_SINGLETON_ID: - new_singleton = new FlashResource(connection, instance); - break; case FLASH_CLIPBOARD_SINGLETON_ID: new_singleton = new FlashClipboardResource(connection, instance); break; -#else + case FLASH_FULLSCREEN_SINGLETON_ID: + new_singleton = new FlashFullscreenResource(connection, instance); + break; case FLASH_SINGLETON_ID: + new_singleton = new FlashResource(connection, instance); + break; +#else case FLASH_CLIPBOARD_SINGLETON_ID: + case FLASH_FULLSCREEN_SINGLETON_ID: + case FLASH_SINGLETON_ID: NOTREACHED(); break; #endif // !defined(OS_NACL) && !defined(NACL_WIN64) diff --git a/ppapi/proxy/ppb_instance_proxy.h b/ppapi/proxy/ppb_instance_proxy.h index ca7f4af..7879f21 100644 --- a/ppapi/proxy/ppb_instance_proxy.h +++ b/ppapi/proxy/ppb_instance_proxy.h @@ -50,6 +50,7 @@ class PPB_Instance_Proxy : public InterfaceProxy, PP_Resource device) OVERRIDE; virtual PP_Bool IsFullFrame(PP_Instance instance) OVERRIDE; virtual const ViewData* GetViewData(PP_Instance instance) OVERRIDE; + virtual PP_Bool FlashIsFullscreen(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, diff --git a/ppapi/proxy/ppp_instance_proxy.cc b/ppapi/proxy/ppp_instance_proxy.cc index bfc9102..077366e 100644 --- a/ppapi/proxy/ppp_instance_proxy.cc +++ b/ppapi/proxy/ppp_instance_proxy.cc @@ -11,7 +11,6 @@ #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" #include "ppapi/proxy/plugin_dispatcher.h" #include "ppapi/proxy/plugin_resource_tracker.h" @@ -21,23 +20,22 @@ #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_flash_fullscreen_api.h" #include "ppapi/thunk/ppb_view_api.h" namespace ppapi { namespace proxy { +using thunk::EnterInstanceAPINoLock; +using thunk::EnterInstanceNoLock; +using thunk::EnterResourceNoLock; +using thunk::PPB_Flash_Fullscreen_API; +using thunk::PPB_Instance_API; +using thunk::PPB_View_API; + namespace { #if !defined(OS_NACL) -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[], @@ -64,15 +62,19 @@ void DidDestroy(PP_Instance instance) { void DidChangeView(PP_Instance instance, PP_Resource view_resource) { HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); - thunk::EnterResourceNoLock<thunk::PPB_View_API> enter(view_resource, false); - if (enter.failed()) { + EnterResourceNoLock<PPB_View_API> enter_view(view_resource, false); + if (enter_view.failed()) { NOTREACHED(); return; } + PP_Bool flash_fullscreen = PP_FALSE; + EnterInstanceNoLock enter_instance(instance); + if (!enter_instance.failed()) + flash_fullscreen = enter_instance.functions()->FlashIsFullscreen(instance); dispatcher->Send(new PpapiMsg_PPPInstance_DidChangeView( - API_ID_PPP_INSTANCE, instance, enter.object()->GetData(), - IsFlashFullscreen(instance, dispatcher))); + API_ID_PPP_INSTANCE, instance, enter_view.object()->GetData(), + flash_fullscreen)); } void DidChangeFocus(PP_Instance instance, PP_Bool has_focus) { @@ -223,9 +225,13 @@ void PPP_Instance_Proxy::OnPluginMsgDidChangeView( InstanceData* data = dispatcher->GetInstanceData(instance); if (!data) return; - data->view = new_data; - data->flash_fullscreen = flash_fullscreen; + +#if !defined(OS_NACL) + EnterInstanceAPINoLock<PPB_Flash_Fullscreen_API> enter(instance); + if (!enter.failed()) + enter.functions()->SetLocalIsFullscreen(instance, flash_fullscreen); +#endif // !defined(OS_NACL) ScopedPPResource resource( ScopedPPResource::PassRef(), diff --git a/ppapi/shared_impl/resource.h b/ppapi/shared_impl/resource.h index d341b32..dc1bf3f 100644 --- a/ppapi/shared_impl/resource.h +++ b/ppapi/shared_impl/resource.h @@ -37,6 +37,7 @@ F(PPB_Flash_Clipboard_API) \ F(PPB_Flash_DeviceID_API) \ F(PPB_Flash_FontFile_API) \ + F(PPB_Flash_Fullscreen_API) \ F(PPB_Flash_Functions_API) \ F(PPB_Flash_Menu_API) \ F(PPB_Flash_MessageLoop_API) \ diff --git a/ppapi/shared_impl/singleton_resource_id.h b/ppapi/shared_impl/singleton_resource_id.h index 526ebdf..9558db6 100644 --- a/ppapi/shared_impl/singleton_resource_id.h +++ b/ppapi/shared_impl/singleton_resource_id.h @@ -10,8 +10,9 @@ namespace ppapi { // These IDs are used to access singleton resource objects using // PPB_Instance_API.GetSingletonResource. enum SingletonResourceID { - FLASH_SINGLETON_ID, FLASH_CLIPBOARD_SINGLETON_ID, + FLASH_FULLSCREEN_SINGLETON_ID, + FLASH_SINGLETON_ID, GAMEPAD_SINGLETON_ID, }; diff --git a/ppapi/thunk/enter.h b/ppapi/thunk/enter.h index b5e129f..358d0a2 100644 --- a/ppapi/thunk/enter.h +++ b/ppapi/thunk/enter.h @@ -248,7 +248,7 @@ class PPAPI_THUNK_EXPORT EnterInstanceNoLock // EnterInstanceAPI ------------------------------------------------------------ template<typename ApiT, bool lock_on_entry = true> -class PPAPI_THUNK_EXPORT EnterInstanceAPI +class EnterInstanceAPI : public subtle::EnterBase, public subtle::LockOnEntry<lock_on_entry> { public: @@ -278,8 +278,7 @@ class PPAPI_THUNK_EXPORT EnterInstanceAPI }; template<typename ApiT> -class PPAPI_THUNK_EXPORT EnterInstanceAPINoLock - : public EnterInstanceAPI<ApiT, false> { +class EnterInstanceAPINoLock : public EnterInstanceAPI<ApiT, false> { public: explicit EnterInstanceAPINoLock(PP_Instance instance) : EnterInstanceAPI<ApiT, false>(instance) { diff --git a/ppapi/thunk/ppb_flash_api.h b/ppapi/thunk/ppb_flash_api.h index aa70d3a..fd7123a 100644 --- a/ppapi/thunk/ppb_flash_api.h +++ b/ppapi/thunk/ppb_flash_api.h @@ -95,12 +95,6 @@ class PPAPI_THUNK_EXPORT PPB_Flash_API { virtual int32_t QueryFileRef(PP_Instance instance, PP_Resource file_ref, PP_FileInfo* info) = 0; - - // FlashFullscreen. - virtual PP_Bool FlashIsFullscreen(PP_Instance instance) = 0; - virtual PP_Bool FlashSetFullscreen(PP_Instance instance, - PP_Bool fullscreen) = 0; - virtual PP_Bool FlashGetScreenSize(PP_Instance instance, PP_Size* size) = 0; }; } // namespace thunk diff --git a/ppapi/thunk/ppb_flash_fullscreen_api.h b/ppapi/thunk/ppb_flash_fullscreen_api.h new file mode 100644 index 0000000..d1435b5 --- /dev/null +++ b/ppapi/thunk/ppb_flash_fullscreen_api.h @@ -0,0 +1,35 @@ +// Copyright (c) 2012 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_THUNK_PPB_FLASH_FULLSCREEN_API_H_ +#define PPAPI_THUNK_PPB_FLASH_FULLSCREEN_API_H_ + +#include "ppapi/shared_impl/singleton_resource_id.h" +#include "ppapi/thunk/ppapi_thunk_export.h" + +namespace ppapi { +namespace thunk { + +class PPAPI_THUNK_EXPORT PPB_Flash_Fullscreen_API { + public: + virtual ~PPB_Flash_Fullscreen_API() {} + + virtual PP_Bool IsFullscreen(PP_Instance instance) = 0; + virtual PP_Bool SetFullscreen(PP_Instance instance, + PP_Bool fullscreen) = 0; + + // Internal function used to update whether or not Flash fullscreen is enabled + // in the plugin side. The value is passed with a + // PpapiMsg_PPPInstance_DidChangeView message. + virtual void SetLocalIsFullscreen(PP_Instance instance, + PP_Bool fullscreen) = 0; + + static const SingletonResourceID kSingletonResourceID = + FLASH_FULLSCREEN_SINGLETON_ID; +}; + +} // namespace thunk +} // namespace ppapi + +#endif // PPAPI_THUNK_PPB_FLASH_FULLSCREEN_API_H_ diff --git a/ppapi/thunk/ppb_flash_fullscreen_thunk.cc b/ppapi/thunk/ppb_flash_fullscreen_thunk.cc index 598dc71..f64ad99 100644 --- a/ppapi/thunk/ppb_flash_fullscreen_thunk.cc +++ b/ppapi/thunk/ppb_flash_fullscreen_thunk.cc @@ -6,8 +6,8 @@ #include "ppapi/c/private/ppb_flash_fullscreen.h" #include "ppapi/thunk/thunk.h" #include "ppapi/thunk/enter.h" +#include "ppapi/thunk/ppb_flash_fullscreen_api.h" #include "ppapi/thunk/ppb_instance_api.h" -#include "ppapi/thunk/ppb_flash_api.h" #include "ppapi/thunk/resource_creation_api.h" namespace ppapi { @@ -16,25 +16,26 @@ namespace thunk { namespace { PP_Bool IsFullscreen(PP_Instance instance) { - EnterInstance enter(instance); + EnterInstanceAPI<PPB_Flash_Fullscreen_API> enter(instance); if (enter.failed()) return PP_FALSE; - return enter.functions()->GetFlashAPI()->FlashIsFullscreen(instance); + return enter.functions()->IsFullscreen(instance); } PP_Bool SetFullscreen(PP_Instance instance, PP_Bool fullscreen) { - EnterInstance enter(instance); + EnterInstanceAPI<PPB_Flash_Fullscreen_API> enter(instance); if (enter.failed()) return PP_FALSE; - return enter.functions()->GetFlashAPI()->FlashSetFullscreen(instance, - fullscreen); + return enter.functions()->SetFullscreen(instance, fullscreen); } +// TODO(raymes): The codepaths for GetScreenSize in PPB_Fullscreen and +// PPB_Flash_Fullscreen are the same. Consider deprecating the flash version. PP_Bool GetScreenSize(PP_Instance instance, PP_Size* size) { EnterInstance enter(instance); if (enter.failed()) return PP_FALSE; - return enter.functions()->GetFlashAPI()->FlashGetScreenSize(instance, size); + return enter.functions()->GetScreenSize(instance, size); } const PPB_FlashFullscreen_0_1 g_ppb_flash_fullscreen_thunk = { diff --git a/ppapi/thunk/ppb_instance_api.h b/ppapi/thunk/ppb_instance_api.h index a89785c..cb52418 100644 --- a/ppapi/thunk/ppb_instance_api.h +++ b/ppapi/thunk/ppb_instance_api.h @@ -49,8 +49,11 @@ class PPB_Instance_API { virtual PP_Bool BindGraphics(PP_Instance instance, PP_Resource device) = 0; virtual PP_Bool IsFullFrame(PP_Instance instance) = 0; - // Not an exposed PPAPI function, this returns the internal view data struct. + // Unexposed PPAPI functions for proxying. + // Returns the internal view data struct. virtual const ViewData* GetViewData(PP_Instance instance) = 0; + // Returns the flash fullscreen status. + virtual PP_Bool FlashIsFullscreen(PP_Instance instance) = 0; // InstancePrivate. virtual PP_Var GetWindowObject(PP_Instance instance) = 0; diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc index 2d10023..3cae57c 100644 --- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc +++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc @@ -1929,6 +1929,10 @@ const ViewData* PluginInstance::GetViewData(PP_Instance instance) { return &view_data_; } +PP_Bool PluginInstance::FlashIsFullscreen(PP_Instance instance) { + return PP_FromBool(flash_fullscreen_); +} + PP_Var PluginInstance::GetWindowObject(PP_Instance instance) { if (!container_) return PP_MakeUndefined(); @@ -2128,8 +2132,9 @@ PP_Bool PluginInstance::GetScreenSize(PP_Instance instance, PP_Size* size) { ::ppapi::SingletonResourceID id) { // Flash APIs aren't implemented in-process. switch (id) { - case ::ppapi::FLASH_SINGLETON_ID: case ::ppapi::FLASH_CLIPBOARD_SINGLETON_ID: + case ::ppapi::FLASH_FULLSCREEN_SINGLETON_ID: + case ::ppapi::FLASH_SINGLETON_ID: NOTIMPLEMENTED(); return NULL; case ::ppapi::GAMEPAD_SINGLETON_ID: diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.h b/webkit/plugins/ppapi/ppapi_plugin_instance.h index cab6cd4..07f588d 100644 --- a/webkit/plugins/ppapi/ppapi_plugin_instance.h +++ b/webkit/plugins/ppapi/ppapi_plugin_instance.h @@ -343,6 +343,7 @@ class WEBKIT_PLUGINS_EXPORT PluginInstance : PP_Resource device) OVERRIDE; virtual PP_Bool IsFullFrame(PP_Instance instance) OVERRIDE; virtual const ::ppapi::ViewData* GetViewData(PP_Instance instance) OVERRIDE; + virtual PP_Bool FlashIsFullscreen(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, diff --git a/webkit/plugins/ppapi/ppb_flash_impl.cc b/webkit/plugins/ppapi/ppb_flash_impl.cc index 64aa797..278ced4 100644 --- a/webkit/plugins/ppapi/ppb_flash_impl.cc +++ b/webkit/plugins/ppapi/ppb_flash_impl.cc @@ -457,20 +457,5 @@ int32_t PPB_Flash_Impl::QueryFileRef(PP_Instance pp_instance, return ::ppapi::PlatformFileErrorToPepperError(result); } -PP_Bool PPB_Flash_Impl::FlashIsFullscreen(PP_Instance instance) { - return PP_FromBool(instance_->flash_fullscreen()); -} - -PP_Bool PPB_Flash_Impl::FlashSetFullscreen(PP_Instance instance, - PP_Bool fullscreen) { - instance_->FlashSetFullscreen(PP_ToBool(fullscreen), true); - return PP_TRUE; -} - -PP_Bool PPB_Flash_Impl::FlashGetScreenSize(PP_Instance instance, - PP_Size* size) { - return instance_->GetScreenSize(instance, size); -} - } // namespace ppapi } // namespace webkit diff --git a/webkit/plugins/ppapi/ppb_flash_impl.h b/webkit/plugins/ppapi/ppb_flash_impl.h index 85289ec..24690ba 100644 --- a/webkit/plugins/ppapi/ppb_flash_impl.h +++ b/webkit/plugins/ppapi/ppb_flash_impl.h @@ -82,11 +82,6 @@ class PPB_Flash_Impl : public ::ppapi::PPB_Flash_Shared { virtual int32_t QueryFileRef(PP_Instance instance, PP_Resource file_ref, PP_FileInfo* info) OVERRIDE; - virtual PP_Bool FlashIsFullscreen(PP_Instance instance) OVERRIDE; - virtual PP_Bool FlashSetFullscreen(PP_Instance instance, - PP_Bool fullscreen) OVERRIDE; - virtual PP_Bool FlashGetScreenSize(PP_Instance instance, - PP_Size* size) OVERRIDE; private: PluginInstance* instance_; |