diff options
28 files changed, 288 insertions, 210 deletions
diff --git a/chrome/test/ppapi/ppapi_browsertest.cc b/chrome/test/ppapi/ppapi_browsertest.cc index f1f3cc5..2fbb19b 100644 --- a/chrome/test/ppapi/ppapi_browsertest.cc +++ b/chrome/test/ppapi/ppapi_browsertest.cc @@ -660,12 +660,10 @@ TEST_PPAPI_NACL_VIA_HTTP(NetworkMonitorPrivate_DeleteInCallback) TEST_PPAPI_NACL_VIA_HTTP(NetworkMonitorPrivate_ListObserver) TEST_PPAPI_IN_PROCESS(Flash_SetInstanceAlwaysOnTop) -TEST_PPAPI_IN_PROCESS(Flash_GetProxyForURL) TEST_PPAPI_IN_PROCESS(Flash_GetLocalTimeZoneOffset) TEST_PPAPI_IN_PROCESS(Flash_GetCommandLineArgs) TEST_PPAPI_IN_PROCESS(Flash_GetSetting) TEST_PPAPI_OUT_OF_PROCESS(Flash_SetInstanceAlwaysOnTop) -TEST_PPAPI_OUT_OF_PROCESS(Flash_GetProxyForURL) TEST_PPAPI_OUT_OF_PROCESS(Flash_GetLocalTimeZoneOffset) TEST_PPAPI_OUT_OF_PROCESS(Flash_GetCommandLineArgs) TEST_PPAPI_OUT_OF_PROCESS(Flash_GetSetting) @@ -895,6 +893,7 @@ TEST_PPAPI_OUT_OF_PROCESS(MessageLoop_Post) #endif // Going forward, Flash APIs will only work out-of-process. +TEST_PPAPI_OUT_OF_PROCESS(Flash_GetProxyForURL) TEST_PPAPI_OUT_OF_PROCESS(FlashClipboard) TEST_PPAPI_OUT_OF_PROCESS(FlashFile_CreateTemporaryFile) // Mac/Aura reach NOTIMPLEMENTED/time out. diff --git a/content/browser/renderer_host/pepper/content_browser_pepper_host_factory.cc b/content/browser/renderer_host/pepper/content_browser_pepper_host_factory.cc index b66ff88..3033adb 100644 --- a/content/browser/renderer_host/pepper/content_browser_pepper_host_factory.cc +++ b/content/browser/renderer_host/pepper/content_browser_pepper_host_factory.cc @@ -5,11 +5,13 @@ #include "content/browser/renderer_host/pepper/content_browser_pepper_host_factory.h" #include "content/browser/renderer_host/pepper/browser_ppapi_host_impl.h" +#include "content/browser/renderer_host/pepper/pepper_flash_browser_host.h" #include "content/browser/renderer_host/pepper/pepper_gamepad_host.h" #include "content/browser/renderer_host/pepper/pepper_print_settings_manager.h" #include "content/browser/renderer_host/pepper/pepper_printing_host.h" #include "ppapi/host/resource_host.h" #include "ppapi/proxy/ppapi_messages.h" +#include "ppapi/shared_impl/ppapi_permissions.h" using ppapi::host::ResourceHost; @@ -42,8 +44,7 @@ scoped_ptr<ResourceHost> ContentBrowserPepperHostFactory::CreateResourceHost( } // Dev interfaces. - if (host_->GetPpapiHost()->permissions().HasPermission( - ppapi::PERMISSION_DEV)) { + if (GetPermissions().HasPermission(ppapi::PERMISSION_DEV)) { switch (message.type()) { case PpapiHostMsg_Printing_Create::ID: { scoped_ptr<PepperPrintSettingsManager> manager( @@ -54,7 +55,22 @@ scoped_ptr<ResourceHost> ContentBrowserPepperHostFactory::CreateResourceHost( } } } + + // Flash interfaces. + if (GetPermissions().HasPermission(ppapi::PERMISSION_FLASH)) { + switch (message.type()) { + case PpapiHostMsg_Flash_Create::ID: + return scoped_ptr<ResourceHost>(new PepperFlashBrowserHost( + host_, instance, params.pp_resource())); + } + } + return scoped_ptr<ResourceHost>(); } +const ppapi::PpapiPermissions& +ContentBrowserPepperHostFactory::GetPermissions() const { + return host_->GetPpapiHost()->permissions(); +} + } // namespace content diff --git a/content/browser/renderer_host/pepper/content_browser_pepper_host_factory.h b/content/browser/renderer_host/pepper/content_browser_pepper_host_factory.h index 2bc771f..c49dfed 100644 --- a/content/browser/renderer_host/pepper/content_browser_pepper_host_factory.h +++ b/content/browser/renderer_host/pepper/content_browser_pepper_host_factory.h @@ -8,6 +8,10 @@ #include "base/compiler_specific.h" #include "ppapi/host/host_factory.h" +namespace ppapi { +class PpapiPermissions; +} + namespace content { class BrowserPpapiHostImpl; @@ -25,6 +29,8 @@ class ContentBrowserPepperHostFactory : public ppapi::host::HostFactory { const IPC::Message& message) OVERRIDE; private: + const ppapi::PpapiPermissions& GetPermissions() const; + // Non-owning pointer. BrowserPpapiHostImpl* host_; diff --git a/content/browser/renderer_host/pepper/pepper_flash_browser_host.cc b/content/browser/renderer_host/pepper/pepper_flash_browser_host.cc new file mode 100644 index 0000000..ba4f75f --- /dev/null +++ b/content/browser/renderer_host/pepper/pepper_flash_browser_host.cc @@ -0,0 +1,60 @@ +// 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 "content/browser/renderer_host/pepper/pepper_flash_browser_host.h" + +#include "content/public/browser/browser_ppapi_host.h" +#include "ipc/ipc_message_macros.h" +#include "ppapi/c/pp_errors.h" +#include "ppapi/host/dispatch_host_message.h" +#include "ppapi/proxy/ppapi_messages.h" +#include "ppapi/proxy/resource_message_params.h" + +#ifdef OS_WIN +#include <windows.h> +#elif defined(OS_MACOSX) +#include <CoreServices/CoreServices.h> +#endif + +namespace content { + +PepperFlashBrowserHost::PepperFlashBrowserHost( + BrowserPpapiHost* host, + PP_Instance instance, + PP_Resource resource) + : ResourceHost(host->GetPpapiHost(), instance, resource) { +} + +PepperFlashBrowserHost::~PepperFlashBrowserHost() { +} + +int32_t PepperFlashBrowserHost::OnResourceMessageReceived( + const IPC::Message& msg, + ppapi::host::HostMessageContext* context) { + IPC_BEGIN_MESSAGE_MAP(PepperFlashBrowserHost, msg) + PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_Flash_UpdateActivity, + OnMsgUpdateActivity); + IPC_END_MESSAGE_MAP() + return PP_ERROR_FAILED; +} + +int32_t PepperFlashBrowserHost::OnMsgUpdateActivity( + ppapi::host::HostMessageContext* host_context) { +#if defined(OS_WIN) + // Reading then writing back the same value to the screensaver timeout system + // setting resets the countdown which prevents the screensaver from turning + // on "for a while". As long as the plugin pings us with this message faster + // than the screensaver timeout, it won't go on. + int value = 0; + if (SystemParametersInfo(SPI_GETSCREENSAVETIMEOUT, 0, &value, 0)) + SystemParametersInfo(SPI_SETSCREENSAVETIMEOUT, value, NULL, 0); +#elif defined(OS_MACOSX) + UpdateSystemActivity(OverallAct); +#else + // TODO(brettw) implement this for other platforms. +#endif + return PP_OK; +} + +} // namespace content diff --git a/content/browser/renderer_host/pepper/pepper_flash_browser_host.h b/content/browser/renderer_host/pepper/pepper_flash_browser_host.h new file mode 100644 index 0000000..307fe94 --- /dev/null +++ b/content/browser/renderer_host/pepper/pepper_flash_browser_host.h @@ -0,0 +1,36 @@ +// 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 CONTENT_RENDERER_PEPPER_PEPPER_FLASH_BROWSER_HOST_H_ +#define CONTENT_RENDERER_PEPPER_PEPPER_FLASH_BROWSER_HOST_H_ + +#include "base/basictypes.h" +#include "ppapi/host/host_message_context.h" +#include "ppapi/host/resource_host.h" + +namespace content { + +class BrowserPpapiHost; + +class PepperFlashBrowserHost : public ppapi::host::ResourceHost { + public: + PepperFlashBrowserHost(BrowserPpapiHost* host, + PP_Instance instance, + PP_Resource resource); + virtual ~PepperFlashBrowserHost(); + + // ppapi::host::ResourceHost override. + virtual int32_t OnResourceMessageReceived( + const IPC::Message& msg, + ppapi::host::HostMessageContext* context) OVERRIDE; + + private: + int32_t OnMsgUpdateActivity(ppapi::host::HostMessageContext* host_context); + + DISALLOW_COPY_AND_ASSIGN(PepperFlashBrowserHost); +}; + +} // namespace content + +#endif // CONTENT_RENDERER_PEPPER_PEPPER_FLASH_BROWSER_HOST_H_ diff --git a/content/browser/renderer_host/pepper/pepper_message_filter.cc b/content/browser/renderer_host/pepper/pepper_message_filter.cc index 76362f0..1af7b97 100644 --- a/content/browser/renderer_host/pepper/pepper_message_filter.cc +++ b/content/browser/renderer_host/pepper/pepper_message_filter.cc @@ -45,12 +45,6 @@ #include "ppapi/shared_impl/private/net_address_private_impl.h" #include "ppapi/shared_impl/private/ppb_host_resolver_shared.h" -#ifdef OS_WIN -#include <windows.h> -#elif defined(OS_MACOSX) -#include <CoreServices/CoreServices.h> -#endif - using ppapi::NetAddressPrivateImpl; namespace content { @@ -190,7 +184,6 @@ bool PepperMessageFilter::OnMessageReceived(const IPC::Message& msg, OnX509CertificateParseDER); // Flash messages. - IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_UpdateActivity, OnUpdateActivity) IPC_MESSAGE_HANDLER(PepperMsg_GetLocalDataRestrictions, OnGetLocalDataRestrictions) @@ -710,22 +703,6 @@ void PepperMessageFilter::OnX509CertificateParseDER( result); } -void PepperMessageFilter::OnUpdateActivity() { -#if defined(OS_WIN) - // Reading then writing back the same value to the screensaver timeout system - // setting resets the countdown which prevents the screensaver from turning - // on "for a while". As long as the plugin pings us with this message faster - // than the screensaver timeout, it won't go on. - int value = 0; - if (SystemParametersInfo(SPI_GETSCREENSAVETIMEOUT, 0, &value, 0)) - SystemParametersInfo(SPI_SETSCREENSAVETIMEOUT, value, NULL, 0); -#elif defined(OS_MACOSX) - UpdateSystemActivity(OverallAct); -#else - // TODO(brettw) implement this for other platforms. -#endif -} - void PepperMessageFilter::OnGetLocalDataRestrictions( const GURL& document_url, const GURL& plugin_url, diff --git a/content/content_browser.gypi b/content/content_browser.gypi index 925fddb..278c162 100644 --- a/content/content_browser.gypi +++ b/content/content_browser.gypi @@ -654,6 +654,8 @@ 'browser/renderer_host/pepper/content_browser_pepper_host_factory.h', 'browser/renderer_host/pepper/pepper_file_message_filter.cc', 'browser/renderer_host/pepper/pepper_file_message_filter.h', + 'browser/renderer_host/pepper/pepper_flash_browser_host.cc', + 'browser/renderer_host/pepper/pepper_flash_browser_host.h', 'browser/renderer_host/pepper/pepper_gamepad_host.cc', 'browser/renderer_host/pepper/pepper_gamepad_host.h', 'browser/renderer_host/pepper/pepper_lookup_request.h', diff --git a/content/content_renderer.gypi b/content/content_renderer.gypi index 81d31ba..a66c714 100644 --- a/content/content_renderer.gypi +++ b/content/content_renderer.gypi @@ -176,8 +176,8 @@ 'renderer/pepper/pepper_file_chooser_host.h', 'renderer/pepper/pepper_flash_clipboard_host.cc', 'renderer/pepper/pepper_flash_clipboard_host.h', - 'renderer/pepper/pepper_flash_host.cc', - 'renderer/pepper/pepper_flash_host.h', + 'renderer/pepper/pepper_flash_renderer_host.cc', + 'renderer/pepper/pepper_flash_renderer_host.h', 'renderer/pepper/pepper_graphics_2d_host.cc', 'renderer/pepper/pepper_graphics_2d_host.h', 'renderer/pepper/pepper_hung_plugin_filter.cc', diff --git a/content/renderer/pepper/content_renderer_pepper_host_factory.cc b/content/renderer/pepper/content_renderer_pepper_host_factory.cc index 7c1a14a..dbb78b7 100644 --- a/content/renderer/pepper/content_renderer_pepper_host_factory.cc +++ b/content/renderer/pepper/content_renderer_pepper_host_factory.cc @@ -8,7 +8,7 @@ #include "content/renderer/pepper/pepper_audio_input_host.h" #include "content/renderer/pepper/pepper_file_chooser_host.h" #include "content/renderer/pepper/pepper_flash_clipboard_host.h" -#include "content/renderer/pepper/pepper_flash_host.h" +#include "content/renderer/pepper/pepper_flash_renderer_host.h" #include "content/renderer/pepper/pepper_graphics_2d_host.h" #include "content/renderer/pepper/pepper_video_capture_host.h" #include "content/renderer/pepper/pepper_websocket_host.h" @@ -82,7 +82,7 @@ scoped_ptr<ResourceHost> ContentRendererPepperHostFactory::CreateResourceHost( if (GetPermissions().HasPermission(ppapi::PERMISSION_FLASH)) { switch (message.type()) { case PpapiHostMsg_Flash_Create::ID: - return scoped_ptr<ResourceHost>(new PepperFlashHost( + return scoped_ptr<ResourceHost>(new PepperFlashRendererHost( host_, instance, params.pp_resource())); case PpapiHostMsg_FlashClipboard_Create::ID: return scoped_ptr<ResourceHost>(new PepperFlashClipboardHost( diff --git a/content/renderer/pepper/pepper_flash_host.cc b/content/renderer/pepper/pepper_flash_host.cc deleted file mode 100644 index c4468b6..0000000 --- a/content/renderer/pepper/pepper_flash_host.cc +++ /dev/null @@ -1,27 +0,0 @@ -// 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 "content/renderer/pepper/pepper_flash_host.h" - -#include "content/public/renderer/renderer_ppapi_host.h" -#include "ppapi/c/pp_errors.h" - -namespace content { - -PepperFlashHost::PepperFlashHost( - RendererPpapiHost* host, - PP_Instance instance, - PP_Resource resource) - : ResourceHost(host->GetPpapiHost(), instance, resource) { -} - -PepperFlashHost::~PepperFlashHost() { -} - -int32_t PepperFlashHost::OnResourceMessageReceived( - const IPC::Message& msg, - ppapi::host::HostMessageContext* context) { - return PP_ERROR_FAILED; -} -} // namespace content diff --git a/content/renderer/pepper/pepper_flash_host.h b/content/renderer/pepper/pepper_flash_host.h deleted file mode 100644 index 48a7af9..0000000 --- a/content/renderer/pepper/pepper_flash_host.h +++ /dev/null @@ -1,34 +0,0 @@ -// 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 CONTENT_RENDERER_PEPPER_PEPPER_FLASH_HOST_H_ -#define CONTENT_RENDERER_PEPPER_PEPPER_FLASH_HOST_H_ - -#include "base/basictypes.h" -#include "ppapi/host/host_message_context.h" -#include "ppapi/host/resource_host.h" - -namespace content { - -class RendererPpapiHost; - -class PepperFlashHost - : public ppapi::host::ResourceHost { - public: - PepperFlashHost(RendererPpapiHost* host, - PP_Instance instance, - PP_Resource resource); - virtual ~PepperFlashHost(); - - virtual int32_t OnResourceMessageReceived( - const IPC::Message& msg, - ppapi::host::HostMessageContext* context) OVERRIDE; - - private: - DISALLOW_COPY_AND_ASSIGN(PepperFlashHost); -}; - -} // namespace content - -#endif // CONTENT_RENDERER_PEPPER_PEPPER_FLASH_HOST_H_ diff --git a/content/renderer/pepper/pepper_flash_renderer_host.cc b/content/renderer/pepper/pepper_flash_renderer_host.cc new file mode 100644 index 0000000..f07638a --- /dev/null +++ b/content/renderer/pepper/pepper_flash_renderer_host.cc @@ -0,0 +1,55 @@ +// 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 "content/renderer/pepper/pepper_flash_renderer_host.h" + +#include "content/common/view_messages.h" +#include "content/public/renderer/renderer_ppapi_host.h" +#include "content/renderer/render_thread_impl.h" +#include "googleurl/src/gurl.h" +#include "ipc/ipc_message_macros.h" +#include "ppapi/c/pp_errors.h" +#include "ppapi/host/dispatch_host_message.h" +#include "ppapi/proxy/ppapi_messages.h" +#include "ppapi/proxy/resource_message_params.h" + +namespace content { + +PepperFlashRendererHost::PepperFlashRendererHost( + RendererPpapiHost* host, + PP_Instance instance, + PP_Resource resource) + : ResourceHost(host->GetPpapiHost(), instance, resource) { +} + +PepperFlashRendererHost::~PepperFlashRendererHost() { +} + +int32_t PepperFlashRendererHost::OnResourceMessageReceived( + const IPC::Message& msg, + ppapi::host::HostMessageContext* context) { + IPC_BEGIN_MESSAGE_MAP(PepperFlashRendererHost, msg) + PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_Flash_GetProxyForURL, + OnMsgGetProxyForURL); + IPC_END_MESSAGE_MAP() + return PP_ERROR_FAILED; +} + +int32_t PepperFlashRendererHost::OnMsgGetProxyForURL( + ppapi::host::HostMessageContext* host_context, + const std::string& url) { + GURL gurl(url); + if (!gurl.is_valid()) + return PP_ERROR_FAILED; + bool result; + std::string proxy; + RenderThreadImpl::current()->Send( + new ViewHostMsg_ResolveProxy(gurl, &result, &proxy)); + if (!result) + return PP_ERROR_FAILED; + host_context->reply_msg = PpapiPluginMsg_Flash_GetProxyForURLReply(proxy); + return PP_OK; +} + +} // namespace content diff --git a/content/renderer/pepper/pepper_flash_renderer_host.h b/content/renderer/pepper/pepper_flash_renderer_host.h new file mode 100644 index 0000000..87470c7 --- /dev/null +++ b/content/renderer/pepper/pepper_flash_renderer_host.h @@ -0,0 +1,37 @@ +// 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 CONTENT_RENDERER_PEPPER_PEPPER_FLASH_RENDERER_HOST_H_ +#define CONTENT_RENDERER_PEPPER_PEPPER_FLASH_RENDERER_HOST_H_ + +#include "base/basictypes.h" +#include "ppapi/host/host_message_context.h" +#include "ppapi/host/resource_host.h" + +namespace content { + +class RendererPpapiHost; + +class PepperFlashRendererHost : public ppapi::host::ResourceHost { + public: + PepperFlashRendererHost(RendererPpapiHost* host, + PP_Instance instance, + PP_Resource resource); + virtual ~PepperFlashRendererHost(); + + // ppapi::host::ResourceHost override. + virtual int32_t OnResourceMessageReceived( + const IPC::Message& msg, + ppapi::host::HostMessageContext* context) OVERRIDE; + + private: + int32_t OnMsgGetProxyForURL(ppapi::host::HostMessageContext* host_context, + const std::string& url); + + DISALLOW_COPY_AND_ASSIGN(PepperFlashRendererHost); +}; + +} // namespace content + +#endif // CONTENT_RENDERER_PEPPER_PEPPER_FLASH_RENDERER_HOST_H_ diff --git a/content/renderer/pepper/pepper_plugin_delegate_impl.cc b/content/renderer/pepper/pepper_plugin_delegate_impl.cc index 827db5e..93dd759 100644 --- a/content/renderer/pepper/pepper_plugin_delegate_impl.cc +++ b/content/renderer/pepper/pepper_plugin_delegate_impl.cc @@ -1398,14 +1398,6 @@ void PepperPluginDelegateImpl::ZoomLimitsChanged(double minimum_factor, render_view_->webview()->zoomLimitsChanged(minimum_level, maximum_level); } -std::string PepperPluginDelegateImpl::ResolveProxy(const GURL& url) { - bool result; - std::string proxy_result; - RenderThreadImpl::current()->Send( - new ViewHostMsg_ResolveProxy(url, &result, &proxy_result)); - return proxy_result; -} - void PepperPluginDelegateImpl::DidStartLoading() { render_view_->DidStartLoadingForPlugin(); } diff --git a/content/renderer/pepper/pepper_plugin_delegate_impl.h b/content/renderer/pepper/pepper_plugin_delegate_impl.h index ee2e780..30832ff2 100644 --- a/content/renderer/pepper/pepper_plugin_delegate_impl.h +++ b/content/renderer/pepper/pepper_plugin_delegate_impl.h @@ -363,7 +363,6 @@ class PepperPluginDelegateImpl virtual std::string GetDefaultEncoding() OVERRIDE; virtual void ZoomLimitsChanged(double minimum_factor, double maximum_factor) OVERRIDE; - virtual std::string ResolveProxy(const GURL& url) OVERRIDE; virtual void DidStartLoading() OVERRIDE; virtual void DidStopLoading() OVERRIDE; virtual void SetContentRestriction(int restrictions) OVERRIDE; diff --git a/ppapi/proxy/flash_resource.cc b/ppapi/proxy/flash_resource.cc index afbe624..be5acd3 100644 --- a/ppapi/proxy/flash_resource.cc +++ b/ppapi/proxy/flash_resource.cc @@ -4,7 +4,11 @@ #include "ppapi/proxy/flash_resource.h" +#include "ppapi/c/pp_errors.h" +#include "ppapi/c/private/ppb_flash.h" +#include "ppapi/proxy/plugin_globals.h" #include "ppapi/proxy/ppapi_messages.h" +#include "ppapi/shared_impl/var.h" namespace ppapi { namespace proxy { @@ -12,6 +16,7 @@ namespace proxy { FlashResource::FlashResource(Connection connection, PP_Instance instance) : PluginResource(connection, instance) { SendCreate(RENDERER, PpapiHostMsg_Flash_Create()); + SendCreate(BROWSER, PpapiHostMsg_Flash_Create()); } FlashResource::~FlashResource() { @@ -21,5 +26,35 @@ thunk::PPB_Flash_Functions_API* FlashResource::AsPPB_Flash_Functions_API() { return this; } +PP_Var FlashResource::GetProxyForURL(PP_Instance instance, + const std::string& url) { + std::string proxy; + int32_t result = SyncCall<PpapiPluginMsg_Flash_GetProxyForURLReply>(RENDERER, + PpapiHostMsg_Flash_GetProxyForURL(url), &proxy); + + if (result == PP_OK) + return StringVar::StringToPPVar(proxy); + return PP_MakeUndefined(); +} + +void FlashResource::UpdateActivity(PP_Instance instance) { + Post(BROWSER, PpapiHostMsg_Flash_UpdateActivity()); +} + +PP_Bool FlashResource::SetCrashData(PP_Instance instance, + PP_FlashCrashKey key, + PP_Var value) { + switch (key) { + case PP_FLASHCRASHKEY_URL: { + StringVar* url_string_var(StringVar::FromPPVar(value)); + if (!url_string_var) + return PP_FALSE; + PluginGlobals::Get()->SetActiveURL(url_string_var->value()); + return PP_TRUE; + } + } + return PP_FALSE; +} + } // namespace proxy } // namespace ppapi diff --git a/ppapi/proxy/flash_resource.h b/ppapi/proxy/flash_resource.h index a0fe0e7..f970aed 100644 --- a/ppapi/proxy/flash_resource.h +++ b/ppapi/proxy/flash_resource.h @@ -5,6 +5,9 @@ #ifndef PPAPI_PROXY_FLASH_RESOURCE_H_ #define PPAPI_PROXY_FLASH_RESOURCE_H_ +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_var.h" +#include "ppapi/c/private/ppb_flash.h" #include "ppapi/proxy/connection.h" #include "ppapi/proxy/plugin_resource.h" #include "ppapi/proxy/ppapi_proxy_export.h" @@ -20,9 +23,16 @@ class PPAPI_PROXY_EXPORT FlashResource FlashResource(Connection connection, PP_Instance instance); virtual ~FlashResource(); - // Resource overrides. + // Resource override. virtual thunk::PPB_Flash_Functions_API* AsPPB_Flash_Functions_API() OVERRIDE; + // PPB_Flash_Functions_API implementation. + virtual PP_Var GetProxyForURL(PP_Instance instance, + const std::string& url) OVERRIDE; + virtual void UpdateActivity(PP_Instance instance) OVERRIDE; + virtual PP_Bool SetCrashData(PP_Instance instance, + PP_FlashCrashKey key, + PP_Var value) OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(FlashResource); }; diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h index bc0a60d..7c4a580 100644 --- a/ppapi/proxy/ppapi_messages.h +++ b/ppapi/proxy/ppapi_messages.h @@ -1260,10 +1260,6 @@ IPC_SYNC_MESSAGE_ROUTED2_1( PP_Instance /* instance */, ppapi::proxy::PPBFlash_DrawGlyphs_Params /* params */, PP_Bool /* result */) -IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBFlash_GetProxyForURL, - PP_Instance /* instance */, - std::string /* url */, - ppapi::proxy::SerializedVar /* result */) IPC_SYNC_MESSAGE_ROUTED4_1(PpapiHostMsg_PPBFlash_Navigate, PP_Instance /* instance */, ppapi::URLRequestInfoData /* request_data */, @@ -1278,7 +1274,6 @@ IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBFlash_IsRectTopmost, PP_Instance /* instance */, PP_Rect /* rect */, PP_Bool /* result */) -IPC_MESSAGE_ROUTED0(PpapiHostMsg_PPBFlash_UpdateActivity) IPC_SYNC_MESSAGE_ROUTED3_2(PpapiHostMsg_PPBFlash_OpenFileRef, PP_Instance /* instance */, ppapi::HostResource /* file_ref */, @@ -1596,6 +1591,13 @@ IPC_MESSAGE_CONTROL0(PpapiPluginMsg_AudioInput_OpenReply) IPC_MESSAGE_CONTROL1(PpapiHostMsg_AudioInput_StartOrStop, bool /* capture */) IPC_MESSAGE_CONTROL0(PpapiHostMsg_AudioInput_Close) +// Flash. +IPC_MESSAGE_CONTROL0(PpapiHostMsg_Flash_Create) +IPC_MESSAGE_CONTROL0(PpapiHostMsg_Flash_UpdateActivity) +IPC_MESSAGE_CONTROL1(PpapiHostMsg_Flash_GetProxyForURL, std::string /* url */) +IPC_MESSAGE_CONTROL1(PpapiPluginMsg_Flash_GetProxyForURLReply, + std::string /* proxy */) + // Flash clipboard. IPC_MESSAGE_CONTROL0(PpapiHostMsg_FlashClipboard_Create) IPC_MESSAGE_CONTROL1(PpapiHostMsg_FlashClipboard_RegisterCustomFormat, @@ -1644,9 +1646,6 @@ IPC_MESSAGE_CONTROL1(PpapiHostMsg_FlashMenu_Show, IPC_MESSAGE_CONTROL1(PpapiPluginMsg_FlashMenu_ShowReply, int32_t /* selected_id */) -// Flash functions. -IPC_MESSAGE_CONTROL0(PpapiHostMsg_Flash_Create) - // VideoCapture_Dev, plugin -> host IPC_MESSAGE_CONTROL0(PpapiHostMsg_VideoCapture_Create) IPC_MESSAGE_CONTROL0(PpapiHostMsg_VideoCapture_StartCapture) diff --git a/ppapi/proxy/ppb_flash_proxy.cc b/ppapi/proxy/ppb_flash_proxy.cc index 0846dde..4a9cd8f 100644 --- a/ppapi/proxy/ppb_flash_proxy.cc +++ b/ppapi/proxy/ppb_flash_proxy.cc @@ -106,8 +106,6 @@ bool PPB_Flash_Proxy::OnMessageReceived(const IPC::Message& msg) { OnHostMsgSetInstanceAlwaysOnTop) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_DrawGlyphs, OnHostMsgDrawGlyphs) - IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_GetProxyForURL, - OnHostMsgGetProxyForURL) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_Navigate, OnHostMsgNavigate) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_GetLocalTimeZoneOffset, OnHostMsgGetLocalTimeZoneOffset) @@ -178,13 +176,6 @@ PP_Bool PPB_Flash_Proxy::DrawGlyphs(PP_Instance instance, return result; } -PP_Var PPB_Flash_Proxy::GetProxyForURL(PP_Instance instance, const char* url) { - ReceiveSerializedVarReturnValue result; - dispatcher()->Send(new PpapiHostMsg_PPBFlash_GetProxyForURL( - API_ID_PPB_FLASH, instance, url, &result)); - return result.Return(dispatcher()); -} - int32_t PPB_Flash_Proxy::Navigate(PP_Instance instance, PP_Resource request_info, const char* target, @@ -261,11 +252,6 @@ PP_Bool PPB_Flash_Proxy::IsRectTopmost(PP_Instance instance, return result; } -void PPB_Flash_Proxy::UpdateActivity(PP_Instance instance) { - PluginGlobals::Get()->GetBrowserSender()->Send( - new PpapiHostMsg_PPBFlash_UpdateActivity(API_ID_PPB_FLASH)); -} - PP_Var PPB_Flash_Proxy::GetSetting(PP_Instance instance, PP_FlashSetting setting) { PluginDispatcher* plugin_dispatcher = @@ -294,21 +280,6 @@ PP_Var PPB_Flash_Proxy::GetSetting(PP_Instance instance, return PP_MakeUndefined(); } -PP_Bool PPB_Flash_Proxy::SetCrashData(PP_Instance instance, - PP_FlashCrashKey key, - PP_Var value) { - switch (key) { - case PP_FLASHCRASHKEY_URL: - StringVar *url_string_var(StringVar::FromPPVar(value)); - if (!url_string_var) - return PP_FALSE; - std::string url_string(url_string_var->value()); - PluginGlobals::Get()->SetActiveURL(url_string); - return PP_TRUE; - } - return PP_FALSE; -} - bool PPB_Flash_Proxy::CreateThreadAdapterForInstance(PP_Instance instance) { return true; } @@ -527,19 +498,6 @@ void PPB_Flash_Proxy::OnHostMsgDrawGlyphs( PpapiGlobals::Get()->GetVarTracker()->ReleaseVar(font_desc.face); } -void PPB_Flash_Proxy::OnHostMsgGetProxyForURL(PP_Instance instance, - const std::string& url, - SerializedVarReturnValue result) { - EnterInstanceNoLock enter(instance); - if (enter.succeeded()) { - result.Return(dispatcher(), - enter.functions()->GetFlashAPI()->GetProxyForURL( - instance, url.c_str())); - } else { - result.Return(dispatcher(), PP_MakeUndefined()); - } -} - void PPB_Flash_Proxy::OnHostMsgNavigate(PP_Instance instance, const URLRequestInfoData& data, const std::string& target, diff --git a/ppapi/proxy/ppb_flash_proxy.h b/ppapi/proxy/ppb_flash_proxy.h index faf4488..6043d2c 100644 --- a/ppapi/proxy/ppb_flash_proxy.h +++ b/ppapi/proxy/ppb_flash_proxy.h @@ -64,7 +64,6 @@ class PPB_Flash_Proxy : public InterfaceProxy, public PPB_Flash_Shared { uint32_t glyph_count, const uint16_t glyph_indices[], const PP_Point glyph_advances[]) OVERRIDE; - virtual PP_Var GetProxyForURL(PP_Instance instance, const char* url) OVERRIDE; virtual int32_t Navigate(PP_Instance instance, PP_Resource request_info, const char* target, @@ -77,12 +76,8 @@ class PPB_Flash_Proxy : public InterfaceProxy, public PPB_Flash_Shared { PP_Time t) OVERRIDE; virtual PP_Bool IsRectTopmost(PP_Instance instance, const PP_Rect* rect) OVERRIDE; - virtual void UpdateActivity(PP_Instance instance) OVERRIDE; virtual PP_Var GetSetting(PP_Instance instance, PP_FlashSetting setting) OVERRIDE; - virtual PP_Bool SetCrashData(PP_Instance instance, - PP_FlashCrashKey key, - PP_Var value) OVERRIDE; virtual bool CreateThreadAdapterForInstance(PP_Instance instance) OVERRIDE; virtual void ClearThreadAdapterForInstance(PP_Instance instance) OVERRIDE; virtual int32_t OpenFile(PP_Instance instance, @@ -121,9 +116,6 @@ class PPB_Flash_Proxy : public InterfaceProxy, public PPB_Flash_Shared { void OnHostMsgDrawGlyphs(PP_Instance instance, const PPBFlash_DrawGlyphs_Params& params, PP_Bool* result); - void OnHostMsgGetProxyForURL(PP_Instance instance, - const std::string& url, - SerializedVarReturnValue result); void OnHostMsgNavigate(PP_Instance instance, const URLRequestInfoData& data, const std::string& target, diff --git a/ppapi/thunk/ppb_flash_api.h b/ppapi/thunk/ppb_flash_api.h index fd7123a..fad0600 100644 --- a/ppapi/thunk/ppb_flash_api.h +++ b/ppapi/thunk/ppb_flash_api.h @@ -40,7 +40,6 @@ class PPAPI_THUNK_EXPORT PPB_Flash_API { uint32_t glyph_count, const uint16_t glyph_indices[], const PP_Point glyph_advances[]) = 0; - virtual PP_Var GetProxyForURL(PP_Instance instance, const char* url) = 0; // External function that takes a PPB_URLRequestInfo resource. virtual int32_t Navigate(PP_Instance instance, @@ -56,11 +55,7 @@ class PPAPI_THUNK_EXPORT PPB_Flash_API { virtual double GetLocalTimeZoneOffset(PP_Instance instance, PP_Time t) = 0; virtual PP_Bool IsRectTopmost(PP_Instance instance, const PP_Rect* rect) = 0; - virtual void UpdateActivity(PP_Instance instance) = 0; virtual PP_Var GetSetting(PP_Instance instance, PP_FlashSetting setting) = 0; - virtual PP_Bool SetCrashData(PP_Instance instance, - PP_FlashCrashKey key, - PP_Var value) = 0; // FlashFile_ModuleLocal. virtual bool CreateThreadAdapterForInstance(PP_Instance instance) = 0; diff --git a/ppapi/thunk/ppb_flash_functions_api.h b/ppapi/thunk/ppb_flash_functions_api.h index 8b70137..4aa3fec 100644 --- a/ppapi/thunk/ppb_flash_functions_api.h +++ b/ppapi/thunk/ppb_flash_functions_api.h @@ -5,11 +5,12 @@ #ifndef PPAPI_THUNK_PPB_FLASH_FUNCTIONS_API_H_ #define PPAPI_THUNK_PPB_FLASH_FUNCTIONS_API_H_ +#include <string> + +#include "ppapi/c/private/ppb_flash.h" #include "ppapi/shared_impl/singleton_resource_id.h" #include "ppapi/thunk/ppapi_thunk_export.h" -struct PP_ArrayOutput; - namespace ppapi { namespace thunk { @@ -20,6 +21,13 @@ class PPAPI_THUNK_EXPORT PPB_Flash_Functions_API { public: virtual ~PPB_Flash_Functions_API() {} + virtual PP_Var GetProxyForURL(PP_Instance instance, + const std::string& url) = 0; + virtual void UpdateActivity(PP_Instance instance) = 0; + virtual PP_Bool SetCrashData(PP_Instance instance, + PP_FlashCrashKey key, + PP_Var value) = 0; + static const SingletonResourceID kSingletonResourceID = FLASH_SINGLETON_ID; }; diff --git a/ppapi/thunk/ppb_flash_thunk.cc b/ppapi/thunk/ppb_flash_thunk.cc index 15b132a..19e0783 100644 --- a/ppapi/thunk/ppb_flash_thunk.cc +++ b/ppapi/thunk/ppb_flash_thunk.cc @@ -48,10 +48,10 @@ PP_Bool DrawGlyphs(PP_Instance instance, } PP_Var GetProxyForURL(PP_Instance instance, const char* url) { - EnterInstance enter(instance); + EnterInstanceAPI<PPB_Flash_Functions_API> enter(instance); if (enter.failed()) return PP_MakeUndefined(); - return enter.functions()->GetFlashAPI()->GetProxyForURL(instance, url); + return enter.functions()->GetProxyForURL(instance, url); } int32_t Navigate(PP_Resource request_id, @@ -119,10 +119,10 @@ int32_t InvokePrinting(PP_Instance instance) { } void UpdateActivity(PP_Instance instance) { - EnterInstance enter(instance); + EnterInstanceAPI<PPB_Flash_Functions_API> enter(instance); if (enter.failed()) return; - enter.functions()->GetFlashAPI()->UpdateActivity(instance); + enter.functions()->UpdateActivity(instance); } PP_Var GetDeviceID(PP_Instance instance) { @@ -147,10 +147,10 @@ PP_Var GetSetting(PP_Instance instance, PP_FlashSetting setting) { PP_Bool SetCrashData(PP_Instance instance, PP_FlashCrashKey key, PP_Var value) { - EnterInstance enter(instance); + EnterInstanceAPI<PPB_Flash_Functions_API> enter(instance); if (enter.failed()) return PP_FALSE; - return enter.functions()->GetFlashAPI()->SetCrashData(instance, key, value); + return enter.functions()->SetCrashData(instance, key, value); } int32_t EnumerateVideoCaptureDevices(PP_Instance instance, diff --git a/webkit/plugins/ppapi/mock_plugin_delegate.cc b/webkit/plugins/ppapi/mock_plugin_delegate.cc index 6294660..54947e7 100644 --- a/webkit/plugins/ppapi/mock_plugin_delegate.cc +++ b/webkit/plugins/ppapi/mock_plugin_delegate.cc @@ -400,10 +400,6 @@ void MockPluginDelegate::ZoomLimitsChanged(double minimum_factor, double maximum_factor) { } -std::string MockPluginDelegate::ResolveProxy(const GURL& url) { - return std::string(); -} - void MockPluginDelegate::DidStartLoading() { } diff --git a/webkit/plugins/ppapi/mock_plugin_delegate.h b/webkit/plugins/ppapi/mock_plugin_delegate.h index bbf9d5a..5ce5819 100644 --- a/webkit/plugins/ppapi/mock_plugin_delegate.h +++ b/webkit/plugins/ppapi/mock_plugin_delegate.h @@ -186,7 +186,6 @@ class MockPluginDelegate : public PluginDelegate { virtual std::string GetDefaultEncoding(); virtual void ZoomLimitsChanged(double minimum_factor, double maximum_factor); - virtual std::string ResolveProxy(const GURL& url); virtual void DidStartLoading(); virtual void DidStopLoading(); virtual void SetContentRestriction(int restrictions); diff --git a/webkit/plugins/ppapi/plugin_delegate.h b/webkit/plugins/ppapi/plugin_delegate.h index a781007..a3cbd89 100644 --- a/webkit/plugins/ppapi/plugin_delegate.h +++ b/webkit/plugins/ppapi/plugin_delegate.h @@ -620,10 +620,6 @@ class PluginDelegate { virtual void ZoomLimitsChanged(double minimum_factor, double maximum_factor) = 0; - // Retrieves the proxy information for the given URL in PAC format. On error, - // this will return an empty string. - virtual std::string ResolveProxy(const GURL& url) = 0; - // Tell the browser when resource loading starts/ends. virtual void DidStartLoading() = 0; virtual void DidStopLoading() = 0; diff --git a/webkit/plugins/ppapi/ppb_flash_impl.cc b/webkit/plugins/ppapi/ppb_flash_impl.cc index 549d3ed..237caf3 100644 --- a/webkit/plugins/ppapi/ppb_flash_impl.cc +++ b/webkit/plugins/ppapi/ppb_flash_impl.cc @@ -156,18 +156,6 @@ PP_Bool PPB_Flash_Impl::DrawGlyphs(PP_Instance instance, return PP_TRUE; } -PP_Var PPB_Flash_Impl::GetProxyForURL(PP_Instance instance, - const char* url) { - GURL gurl(url); - if (!gurl.is_valid()) - return PP_MakeUndefined(); - - std::string proxy_host = instance_->delegate()->ResolveProxy(gurl); - if (proxy_host.empty()) - return PP_MakeUndefined(); // No proxy. - return StringVar::StringToPPVar(proxy_host); -} - int32_t PPB_Flash_Impl::Navigate(PP_Instance instance, PP_Resource request_info, const char* target, @@ -210,10 +198,6 @@ PP_Bool PPB_Flash_Impl::IsRectTopmost(PP_Instance instance, rect->size.width, rect->size.height))); } -void PPB_Flash_Impl::UpdateActivity(PP_Instance pp_instance) { - // Not supported in-process. -} - PP_Var PPB_Flash_Impl::GetSetting(PP_Instance instance, PP_FlashSetting setting) { switch(setting) { @@ -229,13 +213,6 @@ PP_Var PPB_Flash_Impl::GetSetting(PP_Instance instance, } } -PP_Bool PPB_Flash_Impl::SetCrashData(PP_Instance instance, - PP_FlashCrashKey key, - PP_Var value) { - // Not implemented in process. - return PP_FALSE; -} - bool PPB_Flash_Impl::CreateThreadAdapterForInstance(PP_Instance instance) { return false; // No multithreaded access allowed. } diff --git a/webkit/plugins/ppapi/ppb_flash_impl.h b/webkit/plugins/ppapi/ppb_flash_impl.h index 24690ba..f13130c 100644 --- a/webkit/plugins/ppapi/ppb_flash_impl.h +++ b/webkit/plugins/ppapi/ppb_flash_impl.h @@ -35,7 +35,6 @@ class PPB_Flash_Impl : public ::ppapi::PPB_Flash_Shared { uint32_t glyph_count, const uint16_t glyph_indices[], const PP_Point glyph_advances[]) OVERRIDE; - virtual PP_Var GetProxyForURL(PP_Instance instance, const char* url) OVERRIDE; virtual int32_t Navigate(PP_Instance instance, PP_Resource request_info, const char* target, @@ -48,12 +47,8 @@ class PPB_Flash_Impl : public ::ppapi::PPB_Flash_Shared { PP_Time t) OVERRIDE; virtual PP_Bool IsRectTopmost(PP_Instance instance, const PP_Rect* rect) OVERRIDE; - virtual void UpdateActivity(PP_Instance instance) OVERRIDE; virtual PP_Var GetSetting(PP_Instance instance, PP_FlashSetting setting) OVERRIDE; - virtual PP_Bool SetCrashData(PP_Instance instance, - PP_FlashCrashKey key, - PP_Var value) OVERRIDE; virtual bool CreateThreadAdapterForInstance(PP_Instance instance) OVERRIDE; virtual void ClearThreadAdapterForInstance(PP_Instance instance) OVERRIDE; virtual int32_t OpenFile(PP_Instance instance, |