diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-30 15:14:44 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-30 15:14:44 +0000 |
commit | a8462d1139a1facedc23331e0344e61a1d56e98b (patch) | |
tree | 8ad9ef8c33b9109ea6a48a1ecf642d0bc453bd3f | |
parent | 2434672764714ef57dacfa7effe387104788349b (diff) | |
download | chromium_src-a8462d1139a1facedc23331e0344e61a1d56e98b.zip chromium_src-a8462d1139a1facedc23331e0344e61a1d56e98b.tar.gz chromium_src-a8462d1139a1facedc23331e0344e61a1d56e98b.tar.bz2 |
Remove PluginDelegate completely. In a followup I'll rename PepperPluginDelegateImpl to something clearer.
BUG=263054
R=scottmg@chromium.org
Review URL: https://codereview.chromium.org/21219002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@214354 0039d316-1c4b-4281-b951-d872f2087c98
38 files changed, 147 insertions, 461 deletions
diff --git a/content/content_renderer.gypi b/content/content_renderer.gypi index c42d364..4443522 100644 --- a/content/content_renderer.gypi +++ b/content/content_renderer.gypi @@ -342,7 +342,6 @@ 'renderer/pepper/pepper_webplugin_impl.h', 'renderer/pepper/pepper_websocket_host.cc', 'renderer/pepper/pepper_websocket_host.h', - 'renderer/pepper/plugin_delegate.h', 'renderer/pepper/plugin_module.cc', 'renderer/pepper/plugin_module.h', 'renderer/pepper/plugin_object.cc', diff --git a/content/content_tests.gypi b/content/content_tests.gypi index c6cffe3..0060cd2 100644 --- a/content/content_tests.gypi +++ b/content/content_tests.gypi @@ -433,8 +433,6 @@ 'renderer/media/webaudiosourceprovider_impl_unittest.cc', 'renderer/paint_aggregator_unittest.cc', 'renderer/pepper/host_var_tracker_unittest.cc', - 'renderer/pepper/mock_plugin_delegate.cc', - 'renderer/pepper/mock_plugin_delegate.h', 'renderer/pepper/mock_resource.h', 'renderer/pepper/ppapi_unittest.cc', 'renderer/pepper/ppapi_unittest.h', @@ -852,8 +850,6 @@ 'renderer/dom_serializer_browsertest.cc', 'renderer/mouse_lock_dispatcher_browsertest.cc', 'renderer/password_form_conversion_utils_browsertest.cc', - 'renderer/pepper/mock_plugin_delegate.cc', - 'renderer/pepper/mock_plugin_delegate.h', 'renderer/pepper/mock_renderer_ppapi_host.cc', 'renderer/pepper/pepper_device_enumeration_host_helper_unittest.cc', 'renderer/pepper/pepper_file_chooser_host_unittest.cc', diff --git a/content/renderer/pepper/fullscreen_container.h b/content/renderer/pepper/fullscreen_container.h index e3c030f..81ee53d 100644 --- a/content/renderer/pepper/fullscreen_container.h +++ b/content/renderer/pepper/fullscreen_container.h @@ -5,8 +5,6 @@ #ifndef CONTENT_RENDERER_PEPPER_PPB_FULLSCREEN_CONTAINER_IMPL_H_ #define CONTENT_RENDERER_PEPPER_PPB_FULLSCREEN_CONTAINER_IMPL_H_ -#include "content/renderer/pepper/plugin_delegate.h" - namespace WebKit { class WebLayer; struct WebCursorInfo; diff --git a/content/renderer/pepper/host_globals.cc b/content/renderer/pepper/host_globals.cc index 78790e1..dac943b 100644 --- a/content/renderer/pepper/host_globals.cc +++ b/content/renderer/pepper/host_globals.cc @@ -13,6 +13,7 @@ #include "base/task_runner.h" #include "content/renderer/pepper/pepper_plugin_instance_impl.h" #include "content/renderer/pepper/plugin_module.h" +#include "content/renderer/render_thread_impl.h" #include "ppapi/shared_impl/api_id.h" #include "ppapi/shared_impl/id_assignment.h" #include "third_party/WebKit/public/platform/WebString.h" @@ -185,12 +186,7 @@ void HostGlobals::BroadcastLogWithSource(PP_Module pp_module, } base::TaskRunner* HostGlobals::GetFileTaskRunner(PP_Instance instance) { - scoped_refptr<PepperPluginInstanceImpl> plugin_instance = - GetInstance(instance); - DCHECK(plugin_instance.get()); - scoped_refptr<base::MessageLoopProxy> message_loop = - plugin_instance->delegate()->GetFileThreadMessageLoopProxy(); - return message_loop.get(); + return RenderThreadImpl::current()->GetFileThreadMessageLoopProxy().get(); } ::ppapi::MessageLoopShared* HostGlobals::GetCurrentMessageLoop() { diff --git a/content/renderer/pepper/host_var_tracker_unittest.cc b/content/renderer/pepper/host_var_tracker_unittest.cc index a5a1c184..ec0e258 100644 --- a/content/renderer/pepper/host_var_tracker_unittest.cc +++ b/content/renderer/pepper/host_var_tracker_unittest.cc @@ -7,7 +7,6 @@ #include "base/memory/scoped_ptr.h" #include "content/renderer/pepper/host_globals.h" #include "content/renderer/pepper/host_var_tracker.h" -#include "content/renderer/pepper/mock_plugin_delegate.h" #include "content/renderer/pepper/mock_resource.h" #include "content/renderer/pepper/npapi_glue.h" #include "content/renderer/pepper/npobject_var.h" @@ -84,8 +83,7 @@ class HostVarTrackerTest : public PpapiUnittest { TEST_F(HostVarTrackerTest, DeleteObjectVarWithInstance) { // Make a second instance (the test harness already creates & manages one). scoped_refptr<PepperPluginInstanceImpl> instance2( - PepperPluginInstanceImpl::Create( - delegate(), NULL, module(), NULL, GURL())); + PepperPluginInstanceImpl::Create(NULL, NULL, module(), NULL, GURL())); PP_Instance pp_instance2 = instance2->pp_instance(); // Make an object var. diff --git a/content/renderer/pepper/mock_plugin_delegate.cc b/content/renderer/pepper/mock_plugin_delegate.cc deleted file mode 100644 index b0a82cf..0000000 --- a/content/renderer/pepper/mock_plugin_delegate.cc +++ /dev/null @@ -1,81 +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/mock_plugin_delegate.h" - -#include "base/logging.h" -#include "base/message_loop/message_loop_proxy.h" -#include "content/renderer/pepper/pepper_plugin_instance_impl.h" -#include "content/renderer/pepper/plugin_delegate.h" -#include "content/renderer/pepper/plugin_module.h" -#include "ppapi/c/pp_errors.h" -#include "ppapi/shared_impl/ppapi_permissions.h" -#include "ppapi/shared_impl/ppapi_preferences.h" -#include "third_party/WebKit/public/platform/WebGamepads.h" - -namespace content { - -MockPluginDelegate::MockPluginDelegate() { -} - -MockPluginDelegate::~MockPluginDelegate() { -} - -void MockPluginDelegate::PluginFocusChanged(PepperPluginInstanceImpl* instance, - bool focused) { -} - -void MockPluginDelegate::PluginTextInputTypeChanged( - PepperPluginInstanceImpl* instance) { -} - -void MockPluginDelegate::PluginCaretPositionChanged( - PepperPluginInstanceImpl* instance) { -} - -void MockPluginDelegate::PluginRequestedCancelComposition( - PepperPluginInstanceImpl* instance) { -} - -void MockPluginDelegate::PluginSelectionChanged( - PepperPluginInstanceImpl* instance) { -} - -void MockPluginDelegate::InstanceCreated(PepperPluginInstanceImpl* instance) { -} - -void MockPluginDelegate::InstanceDeleted(PepperPluginInstanceImpl* instance) { -} - -bool MockPluginDelegate::AsyncOpenFile(const base::FilePath& path, - int flags, - const AsyncOpenFileCallback& callback) { - return false; -} - -scoped_refptr<base::MessageLoopProxy> -MockPluginDelegate::GetFileThreadMessageLoopProxy() { - return scoped_refptr<base::MessageLoopProxy>(); -} - -void MockPluginDelegate::SampleGamepads(WebKit::WebGamepads* data) { - data->length = 0; -} - -void MockPluginDelegate::HandleDocumentLoad( - PepperPluginInstanceImpl* instance, - const WebKit::WebURLResponse& response) { -} - -RendererPpapiHost* MockPluginDelegate::CreateExternalPluginModule( - scoped_refptr<PluginModule> module, - const base::FilePath& path, - ::ppapi::PpapiPermissions permissions, - const IPC::ChannelHandle& channel_handle, - base::ProcessId plugin_pid, - int plugin_child_id) { - return NULL; -} - -} // namespace content diff --git a/content/renderer/pepper/mock_plugin_delegate.h b/content/renderer/pepper/mock_plugin_delegate.h deleted file mode 100644 index 8d3278e..0000000 --- a/content/renderer/pepper/mock_plugin_delegate.h +++ /dev/null @@ -1,54 +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_MOCK_PLUGIN_DELEGATE_H_ -#define CONTENT_RENDERER_PEPPER_MOCK_PLUGIN_DELEGATE_H_ - -#include "content/renderer/pepper/plugin_delegate.h" - -struct PP_NetAddress_Private; -namespace ppapi { class PPB_X509Certificate_Fields; } - -namespace content { - -class MockPluginDelegate : public PluginDelegate { - public: - MockPluginDelegate(); - virtual ~MockPluginDelegate(); - - virtual void PluginFocusChanged(PepperPluginInstanceImpl* instance, - bool focused) OVERRIDE; - virtual void PluginTextInputTypeChanged( - PepperPluginInstanceImpl* instance) OVERRIDE; - virtual void PluginCaretPositionChanged( - PepperPluginInstanceImpl* instance) OVERRIDE; - virtual void PluginRequestedCancelComposition( - PepperPluginInstanceImpl* instance) OVERRIDE; - virtual void PluginSelectionChanged( - PepperPluginInstanceImpl* instance) OVERRIDE; - virtual void InstanceCreated(PepperPluginInstanceImpl* instance) OVERRIDE; - virtual void InstanceDeleted(PepperPluginInstanceImpl* instance) OVERRIDE; - virtual bool AsyncOpenFile(const base::FilePath& path, - int flags, - const AsyncOpenFileCallback& callback) OVERRIDE; - virtual scoped_refptr<base::MessageLoopProxy> - GetFileThreadMessageLoopProxy() OVERRIDE; - - // Add/remove a network list observer. - virtual void SampleGamepads(WebKit::WebGamepads* data) OVERRIDE; - virtual void HandleDocumentLoad( - PepperPluginInstanceImpl* instance, - const WebKit::WebURLResponse& response) OVERRIDE; - virtual RendererPpapiHost* CreateExternalPluginModule( - scoped_refptr<PluginModule> module, - const base::FilePath& path, - ::ppapi::PpapiPermissions permissions, - const IPC::ChannelHandle& channel_handle, - base::ProcessId plugin_pid, - int plugin_child_id) OVERRIDE; -}; - -} // namespace content - -#endif // CONTENT_RENDERER_PEPPER_MOCK_PLUGIN_DELEGATE_H_ diff --git a/content/renderer/pepper/pepper_broker.h b/content/renderer/pepper/pepper_broker.h index ff6dad6..4afb993 100644 --- a/content/renderer/pepper/pepper_broker.h +++ b/content/renderer/pepper/pepper_broker.h @@ -9,7 +9,6 @@ #include "base/process/process.h" #include "base/sync_socket.h" #include "content/common/content_export.h" -#include "content/renderer/pepper/plugin_delegate.h" #include "content/renderer/pepper/ppb_broker_impl.h" #include "ppapi/proxy/proxy_channel.h" diff --git a/content/renderer/pepper/pepper_file_io_host.cc b/content/renderer/pepper/pepper_file_io_host.cc index 992aa0d..c58b25f 100644 --- a/content/renderer/pepper/pepper_file_io_host.cc +++ b/content/renderer/pepper/pepper_file_io_host.cc @@ -16,9 +16,11 @@ #include "content/public/common/content_client.h" #include "content/public/renderer/content_renderer_client.h" #include "content/renderer/pepper/host_globals.h" +#include "content/renderer/pepper/pepper_plugin_delegate_impl.h" #include "content/renderer/pepper/pepper_plugin_instance_impl.h" #include "content/renderer/pepper/ppb_file_ref_impl.h" #include "content/renderer/pepper/quota_file_io.h" +#include "content/renderer/pepper/resource_helper.h" #include "content/renderer/render_thread_impl.h" #include "ppapi/c/pp_errors.h" #include "ppapi/host/dispatch_host_message.h" @@ -141,17 +143,12 @@ PepperFileIOHost::PepperFileIOHost(RendererPpapiHost* host, PP_Instance instance, PP_Resource resource) : ResourceHost(host->GetPpapiHost(), instance, resource), - plugin_delegate_(NULL), file_(base::kInvalidPlatformFileValue), file_system_type_(PP_FILESYSTEMTYPE_INVALID), quota_policy_(quota::kQuotaLimitTypeUnknown), is_running_in_process_(host->IsRunningInProcess()), open_flags_(0), weak_factory_(this) { - // TODO(victorhsieh): eliminate plugin_delegate_ as it's no longer needed. - PepperPluginInstanceImpl* plugin_instance = - HostGlobals::Get()->GetInstance(instance); - plugin_delegate_ = plugin_instance ? plugin_instance->delegate() : NULL; } PepperFileIOHost::~PepperFileIOHost() { @@ -217,9 +214,6 @@ int32_t PepperFileIOHost::OnHostMsgOpen( return PP_ERROR_FAILED; file_system_type_ = type; - if (!plugin_delegate_) - return PP_ERROR_FAILED; - PPB_FileRef_Impl* file_ref = static_cast<PPB_FileRef_Impl*>(file_ref_api); if (file_ref->HasValidFileSystem()) { file_system_url_ = file_ref->GetFileSystemURL(); @@ -235,9 +229,12 @@ int32_t PepperFileIOHost::OnHostMsgOpen( base::Bind(&DidOpenFileSystemURL, callback), base::Bind(&DidFailOpenFileSystemURL, callback)); } else { - if (file_system_type_ != PP_FILESYSTEMTYPE_EXTERNAL) + PepperPluginDelegateImpl* plugin_delegate = + static_cast<PepperPluginInstanceImpl*>( + PepperPluginInstance::Get(pp_instance()))->delegate(); + if (file_system_type_ != PP_FILESYSTEMTYPE_EXTERNAL || !plugin_delegate) return PP_ERROR_FAILED; - if (!plugin_delegate_->AsyncOpenFile( + if (!plugin_delegate->AsyncOpenFile( file_ref->GetSystemPath(), flags, base::Bind(&PepperFileIOHost::ExecutePlatformOpenFileCallback, weak_factory_.GetWeakPtr(), @@ -256,11 +253,8 @@ int32_t PepperFileIOHost::OnHostMsgQuery( if (rv != PP_OK) return rv; - if (!plugin_delegate_) - return PP_ERROR_FAILED; - if (!base::FileUtilProxy::GetFileInfoFromPlatformFile( - plugin_delegate_->GetFileThreadMessageLoopProxy().get(), + RenderThreadImpl::current()->GetFileThreadMessageLoopProxy().get(), file_, base::Bind(&PepperFileIOHost::ExecutePlatformQueryCallback, weak_factory_.GetWeakPtr(), @@ -280,9 +274,6 @@ int32_t PepperFileIOHost::OnHostMsgTouch( if (rv != PP_OK) return rv; - if (!plugin_delegate_) - return PP_ERROR_FAILED; - if (file_system_type_ != PP_FILESYSTEMTYPE_EXTERNAL) { FileSystemDispatcher* file_system_dispatcher = ChildThread::current()->file_system_dispatcher(); @@ -300,7 +291,7 @@ int32_t PepperFileIOHost::OnHostMsgTouch( // TODO(nhiroki): fix a failure of FileIO.Touch for an external filesystem on // Mac and Linux due to sandbox restrictions (http://crbug.com/101128). if (!base::FileUtilProxy::Touch( - plugin_delegate_->GetFileThreadMessageLoopProxy().get(), + RenderThreadImpl::current()->GetFileThreadMessageLoopProxy().get(), file_, PPTimeToTime(last_access_time), PPTimeToTime(last_modified_time), @@ -332,11 +323,8 @@ int32_t PepperFileIOHost::OnHostMsgRead( return PP_OK_COMPLETIONPENDING; } - if (!plugin_delegate_) - return PP_ERROR_FAILED; - if (!base::FileUtilProxy::Read( - plugin_delegate_->GetFileThreadMessageLoopProxy().get(), + RenderThreadImpl::current()->GetFileThreadMessageLoopProxy().get(), file_, offset, max_read_length, @@ -366,11 +354,8 @@ int32_t PepperFileIOHost::OnHostMsgWrite( context->MakeReplyMessageContext()))) return PP_ERROR_FAILED; } else { - if (!plugin_delegate_) - return PP_ERROR_FAILED; - if (!base::FileUtilProxy::Write( - plugin_delegate_->GetFileThreadMessageLoopProxy().get(), + RenderThreadImpl::current()->GetFileThreadMessageLoopProxy().get(), file_, offset, buffer.c_str(), @@ -393,9 +378,6 @@ int32_t PepperFileIOHost::OnHostMsgSetLength( if (rv != PP_OK) return rv; - if (!plugin_delegate_) - return PP_ERROR_FAILED; - if (file_system_type_ != PP_FILESYSTEMTYPE_EXTERNAL) { FileSystemDispatcher* file_system_dispatcher = ChildThread::current()->file_system_dispatcher(); @@ -408,7 +390,7 @@ int32_t PepperFileIOHost::OnHostMsgSetLength( // TODO(nhiroki): fix a failure of FileIO.SetLength for an external // filesystem on Mac due to sandbox restrictions (http://crbug.com/156077). if (!base::FileUtilProxy::Truncate( - plugin_delegate_->GetFileThreadMessageLoopProxy().get(), + RenderThreadImpl::current()->GetFileThreadMessageLoopProxy().get(), file_, length, base::Bind(&PepperFileIOHost::ExecutePlatformGeneralCallback, @@ -428,11 +410,8 @@ int32_t PepperFileIOHost::OnHostMsgFlush( if (rv != PP_OK) return rv; - if (!plugin_delegate_) - return PP_ERROR_FAILED; - if (!base::FileUtilProxy::Flush( - plugin_delegate_->GetFileThreadMessageLoopProxy().get(), + RenderThreadImpl::current()->GetFileThreadMessageLoopProxy().get(), file_, base::Bind(&PepperFileIOHost::ExecutePlatformGeneralCallback, weak_factory_.GetWeakPtr(), @@ -445,9 +424,9 @@ int32_t PepperFileIOHost::OnHostMsgFlush( int32_t PepperFileIOHost::OnHostMsgClose( ppapi::host::HostMessageContext* context) { - if (file_ != base::kInvalidPlatformFileValue && plugin_delegate_) { + if (file_ != base::kInvalidPlatformFileValue) { base::FileUtilProxy::Close( - plugin_delegate_->GetFileThreadMessageLoopProxy().get(), + RenderThreadImpl::current()->GetFileThreadMessageLoopProxy().get(), file_, base::ResetAndReturn(¬ify_close_file_callback_)); file_ = base::kInvalidPlatformFileValue; diff --git a/content/renderer/pepper/pepper_file_io_host.h b/content/renderer/pepper/pepper_file_io_host.h index f23340c..88596fe 100644 --- a/content/renderer/pepper/pepper_file_io_host.h +++ b/content/renderer/pepper/pepper_file_io_host.h @@ -23,7 +23,6 @@ using ppapi::host::ReplyMessageContext; namespace content { -class PluginDelegate; class QuotaFileIO; class PepperFileIOHost : public ppapi::host::ResourceHost, @@ -97,9 +96,6 @@ class PepperFileIOHost : public ppapi::host::ResourceHost, base::PlatformFileError error_code, int bytes_written); - // TODO(victorhsieh): eliminate plugin_delegate_ as it's no longer needed. - PluginDelegate* plugin_delegate_; // Not owned. - base::PlatformFile file_; // The file system type specified in the Open() call. This will be diff --git a/content/renderer/pepper/pepper_graphics_2d_host.h b/content/renderer/pepper/pepper_graphics_2d_host.h index 965974c..b69f752 100644 --- a/content/renderer/pepper/pepper_graphics_2d_host.h +++ b/content/renderer/pepper/pepper_graphics_2d_host.h @@ -11,7 +11,6 @@ #include "base/compiler_specific.h" #include "base/memory/weak_ptr.h" #include "content/common/content_export.h" -#include "content/renderer/pepper/plugin_delegate.h" #include "ppapi/c/ppb_graphics_2d.h" #include "ppapi/host/host_message_context.h" #include "ppapi/host/resource_host.h" diff --git a/content/renderer/pepper/pepper_platform_context_3d.h b/content/renderer/pepper/pepper_platform_context_3d.h index d2a8710..842871a 100644 --- a/content/renderer/pepper/pepper_platform_context_3d.h +++ b/content/renderer/pepper/pepper_platform_context_3d.h @@ -10,7 +10,6 @@ #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" -#include "content/renderer/pepper/plugin_delegate.h" #include "gpu/command_buffer/common/mailbox.h" #ifdef ENABLE_GPU diff --git a/content/renderer/pepper/pepper_plugin_delegate_impl.cc b/content/renderer/pepper/pepper_plugin_delegate_impl.cc index d5adbf7..682fe0f 100644 --- a/content/renderer/pepper/pepper_plugin_delegate_impl.cc +++ b/content/renderer/pepper/pepper_plugin_delegate_impl.cc @@ -574,10 +574,12 @@ void PepperPluginDelegateImpl::OnAsyncFileOpened( IPC::PlatformFileForTransitToPlatformFile(file_for_transit); callback->Run(error_code, base::PassPlatformFile(&file)); // Make sure we won't leak file handle if the requester has died. - if (file != base::kInvalidPlatformFileValue) - base::FileUtilProxy::Close(GetFileThreadMessageLoopProxy().get(), - file, - base::FileUtilProxy::StatusCallback()); + if (file != base::kInvalidPlatformFileValue) { + base::FileUtilProxy::Close( + RenderThreadImpl::current()->GetFileThreadMessageLoopProxy().get(), + file, + base::FileUtilProxy::StatusCallback()); + } delete callback; } @@ -610,11 +612,6 @@ void PepperPluginDelegateImpl::WillHandleMouseEvent() { last_mouse_event_target_ = NULL; } -scoped_refptr<base::MessageLoopProxy> -PepperPluginDelegateImpl::GetFileThreadMessageLoopProxy() { - return RenderThreadImpl::current()->GetFileThreadMessageLoopProxy(); -} - void PepperPluginDelegateImpl::RegisterTCPSocket( PPB_TCPSocket_Private_Impl* socket, uint32 socket_id) { diff --git a/content/renderer/pepper/pepper_plugin_delegate_impl.h b/content/renderer/pepper/pepper_plugin_delegate_impl.h index 7a604bd..bd62a5a 100644 --- a/content/renderer/pepper/pepper_plugin_delegate_impl.h +++ b/content/renderer/pepper/pepper_plugin_delegate_impl.h @@ -18,8 +18,8 @@ #include "base/observer_list.h" #include "content/public/renderer/render_view_observer.h" #include "content/renderer/pepper/pepper_browser_connection.h" -#include "content/renderer/pepper/plugin_delegate.h" #include "content/renderer/render_view_pepper_helper.h" +#include "ipc/ipc_platform_file.h" #include "ppapi/c/pp_file_info.h" #include "ppapi/c/ppb_tcp_socket.h" #include "ppapi/c/private/ppb_tcp_socket_private.h" @@ -33,6 +33,7 @@ class FilePath; namespace ppapi { class PepperFilePath; +class PpapiPermissions; class PPB_X509Certificate_Fields; namespace host { class ResourceHost; @@ -41,7 +42,9 @@ class ResourceHost; namespace WebKit { class WebGamepads; +class WebURLResponse; struct WebCompositionUnderline; +struct WebCursorInfo; } namespace content { @@ -50,12 +53,12 @@ class GamepadSharedMemoryReader; class PepperBroker; class PluginModule; class PPB_Broker_Impl; +class PPB_TCPSocket_Private_Impl; class RenderViewImpl; struct WebPluginInfo; class PepperPluginDelegateImpl - : public PluginDelegate, - public RenderViewPepperHelper, + : public RenderViewPepperHelper, public base::SupportsWeakPtr<PepperPluginDelegateImpl>, public RenderViewObserver { public: @@ -90,6 +93,57 @@ class PepperPluginDelegateImpl // Notifies that |instance| has received a mouse event. void DidReceiveMouseEvent(PepperPluginInstanceImpl* instance); + // Notification that the given plugin is focused or unfocused. + void PluginFocusChanged(PepperPluginInstanceImpl* instance, bool focused); + + // Notification that the text input status of the given plugin is changed. + void PluginTextInputTypeChanged(PepperPluginInstanceImpl* instance); + + // Notification that the caret position in the given plugin is changed. + void PluginCaretPositionChanged(PepperPluginInstanceImpl* instance); + + // Notification that the plugin requested to cancel the current composition. + void PluginRequestedCancelComposition(PepperPluginInstanceImpl* instance); + + // Notification that the text selection in the given plugin is changed. + void PluginSelectionChanged(PepperPluginInstanceImpl* instance); + + // Indicates that the given instance has been created. + void InstanceCreated(PepperPluginInstanceImpl* instance); + + // Indicates that the given instance is being destroyed. This is called from + // the destructor, so it's important that the instance is not dereferenced + // from this call. + void InstanceDeleted(PepperPluginInstanceImpl* instance); + + // Sends an async IPC to open a local file. + typedef base::Callback<void (base::PlatformFileError, base::PassPlatformFile)> + AsyncOpenFileCallback; + bool AsyncOpenFile(const base::FilePath& path, + int flags, + const AsyncOpenFileCallback& callback); + + // Retrieve current gamepad data. + void SampleGamepads(WebKit::WebGamepads* data); + + // Notifies the plugin of the document load. This should initiate the call to + // PPP_Instance.HandleDocumentLoad. + // + // The loader object should set itself on the PluginInstance as the document + // loader using set_document_loader. + void HandleDocumentLoad(PepperPluginInstanceImpl* instance, + const WebKit::WebURLResponse& response); + + // Sets up the renderer host and out-of-process proxy for an external plugin + // module. Returns the renderer host, or NULL if it couldn't be created. + RendererPpapiHost* CreateExternalPluginModule( + scoped_refptr<PluginModule> module, + const base::FilePath& path, + ::ppapi::PpapiPermissions permissions, + const IPC::ChannelHandle& channel_handle, + base::ProcessId plugin_pid, + int plugin_child_id); + private: // RenderViewPepperHelper implementation. virtual WebKit::WebPlugin* CreatePepperWebPlugin( @@ -121,36 +175,6 @@ class PepperPluginDelegateImpl virtual void OnImeConfirmComposition(const string16& text) OVERRIDE; virtual void WillHandleMouseEvent() OVERRIDE; - // PluginDelegate implementation. - virtual void PluginFocusChanged(PepperPluginInstanceImpl* instance, - bool focused) OVERRIDE; - virtual void PluginTextInputTypeChanged( - PepperPluginInstanceImpl* instance) OVERRIDE; - virtual void PluginCaretPositionChanged( - PepperPluginInstanceImpl* instance) OVERRIDE; - virtual void PluginRequestedCancelComposition( - PepperPluginInstanceImpl* instance) OVERRIDE; - virtual void PluginSelectionChanged( - PepperPluginInstanceImpl* instance) OVERRIDE; - virtual void InstanceCreated(PepperPluginInstanceImpl* instance) OVERRIDE; - virtual void InstanceDeleted(PepperPluginInstanceImpl* instance) OVERRIDE; - virtual bool AsyncOpenFile(const base::FilePath& path, - int flags, - const AsyncOpenFileCallback& callback) OVERRIDE; - virtual scoped_refptr<base::MessageLoopProxy> - GetFileThreadMessageLoopProxy() OVERRIDE; - virtual void SampleGamepads(WebKit::WebGamepads* data) OVERRIDE; - virtual void HandleDocumentLoad( - PepperPluginInstanceImpl* instance, - const WebKit::WebURLResponse& response) OVERRIDE; - virtual RendererPpapiHost* CreateExternalPluginModule( - scoped_refptr<PluginModule> module, - const base::FilePath& path, - ::ppapi::PpapiPermissions permissions, - const IPC::ChannelHandle& channel_handle, - base::ProcessId plugin_pid, - int plugin_child_id) OVERRIDE; - // RenderViewObserver implementation. virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; virtual void OnDestruct() OVERRIDE; diff --git a/content/renderer/pepper/pepper_plugin_instance_impl.cc b/content/renderer/pepper/pepper_plugin_instance_impl.cc index 90399be..4054aba 100644 --- a/content/renderer/pepper/pepper_plugin_instance_impl.cc +++ b/content/renderer/pepper/pepper_plugin_instance_impl.cc @@ -352,7 +352,7 @@ class PluginInstanceLockTarget : public MouseLockDispatcher::LockTarget { // static PepperPluginInstanceImpl* PepperPluginInstanceImpl::Create( - PluginDelegate* delegate, + PepperPluginDelegateImpl* delegate, RenderViewImpl* render_view, PluginModule* module, WebPluginContainer* container, @@ -413,7 +413,8 @@ void PepperPluginInstanceImpl::NaClDocumentLoader::didFail( error_.reset(new WebURLError(error)); } -PepperPluginInstanceImpl::GamepadImpl::GamepadImpl(PluginDelegate* delegate) +PepperPluginInstanceImpl::GamepadImpl::GamepadImpl( + PepperPluginDelegateImpl* delegate) : Resource(::ppapi::Resource::Untracked()), delegate_(delegate) { } @@ -435,7 +436,7 @@ void PepperPluginInstanceImpl::GamepadImpl::Sample( } PepperPluginInstanceImpl::PepperPluginInstanceImpl( - PluginDelegate* delegate, + PepperPluginDelegateImpl* delegate, RenderViewImpl* render_view, PluginModule* module, ::ppapi::PPP_Instance_Combined* instance_interface, @@ -492,9 +493,10 @@ PepperPluginInstanceImpl::PepperPluginInstanceImpl( pp_instance_ = HostGlobals::Get()->AddInstance(this); memset(¤t_print_settings_, 0, sizeof(current_print_settings_)); - DCHECK(delegate); module_->InstanceCreated(this); - delegate_->InstanceCreated(this); + + if (delegate_) + delegate_->InstanceCreated(this); if (render_view) // NULL in tests view_data_.is_page_visible = !render_view->is_hidden(); @@ -531,7 +533,8 @@ PepperPluginInstanceImpl::~PepperPluginInstanceImpl() { if (TrackedCallback::IsPending(lock_mouse_callback_)) lock_mouse_callback_->Abort(); - delegate_->InstanceDeleted(this); + if (delegate_) + delegate_->InstanceDeleted(this); UnSetAndDeleteLockTargetAdapter(); module_->InstanceDeleted(this); // If we switched from the NaCl plugin module, notify it too. @@ -715,7 +718,7 @@ bool PepperPluginInstanceImpl::HandleDocumentLoad( container()->element().document().frame()->stopLoading(); return false; } - delegate()->HandleDocumentLoad(this, response); + delegate_->HandleDocumentLoad(this, response); // If the load was not abandoned, document_loader_ will now be set. It's // possible that the load was canceled by now and document_loader_ was // already nulled out. @@ -890,8 +893,7 @@ bool PepperPluginInstanceImpl::HandleInputEvent( TRACE_EVENT0("ppapi", "PepperPluginInstanceImpl::HandleInputEvent"); if (WebInputEvent::isMouseEventType(event.type)) { - static_cast<PepperPluginDelegateImpl*>(delegate_)->DidReceiveMouseEvent( - this); + delegate_->DidReceiveMouseEvent(this); } // Don't dispatch input events to crashed plugins. @@ -1329,12 +1331,12 @@ bool PepperPluginInstanceImpl::PluginHasFocus() const { } void PepperPluginInstanceImpl::SendFocusChangeNotification() { - // This call can happen during PepperPluginInstanceImpl destruction, because + // This call can happen during PepperPluginIn>stanceImpl destruction, because // WebKit informs the plugin it's losing focus. See crbug.com/236574 if (!delegate_ || !instance_interface_) return; bool has_focus = PluginHasFocus(); - delegate()->PluginFocusChanged(this, has_focus); + delegate_->PluginFocusChanged(this, has_focus); instance_interface_->DidChangeFocus(pp_instance(), PP_FromBool(has_focus)); } @@ -2343,7 +2345,7 @@ void PepperPluginInstanceImpl::SetTextInputType(PP_Instance instance, if (itype < 0 || itype > ui::TEXT_INPUT_TYPE_URL) itype = ui::TEXT_INPUT_TYPE_NONE; text_input_type_ = static_cast<ui::TextInputType>(itype); - delegate()->PluginTextInputTypeChanged(this); + delegate_->PluginTextInputTypeChanged(this); } void PepperPluginInstanceImpl::UpdateCaretPosition( @@ -2353,11 +2355,11 @@ void PepperPluginInstanceImpl::UpdateCaretPosition( text_input_caret_ = PP_ToGfxRect(caret); text_input_caret_bounds_ = PP_ToGfxRect(bounding_box); text_input_caret_set_ = true; - delegate()->PluginCaretPositionChanged(this); + delegate_->PluginCaretPositionChanged(this); } void PepperPluginInstanceImpl::CancelCompositionText(PP_Instance instance) { - delegate()->PluginRequestedCancelComposition(this); + delegate_->PluginRequestedCancelComposition(this); } void PepperPluginInstanceImpl::SelectionChanged(PP_Instance instance) { @@ -2383,7 +2385,7 @@ void PepperPluginInstanceImpl::UpdateSurroundingText(PP_Instance instance, surrounding_text_ = text; selection_caret_ = caret; selection_anchor_ = anchor; - delegate()->PluginSelectionChanged(this); + delegate_->PluginSelectionChanged(this); } PP_Var PepperPluginInstanceImpl::ResolveRelativeToDocument( @@ -2634,8 +2636,7 @@ void PepperPluginInstanceImpl::DoSetCursor(WebCursorInfo* cursor) { if (fullscreen_container_) { fullscreen_container_->DidChangeCursor(*cursor); } else { - static_cast<PepperPluginDelegateImpl*>(delegate_)->DidChangeCursor( - this, *cursor); + delegate_->DidChangeCursor(this, *cursor); } } diff --git a/content/renderer/pepper/pepper_plugin_instance_impl.h b/content/renderer/pepper/pepper_plugin_instance_impl.h index e7ca581..6d2c574 100644 --- a/content/renderer/pepper/pepper_plugin_instance_impl.h +++ b/content/renderer/pepper/pepper_plugin_instance_impl.h @@ -19,7 +19,6 @@ #include "content/common/content_export.h" #include "content/public/renderer/pepper_plugin_instance.h" #include "content/renderer/mouse_lock_dispatcher.h" -#include "content/renderer/pepper/plugin_delegate.h" #include "content/renderer/pepper/ppp_pdf.h" #include "ppapi/c/dev/pp_cursor_type_dev.h" #include "ppapi/c/dev/ppp_find_dev.h" @@ -100,7 +99,7 @@ class ContentDecryptorDelegate; class FullscreenContainer; class MessageChannel; class PepperGraphics2DHost; -class PluginDelegate; +class PepperPluginDelegateImpl; class PluginModule; class PluginObject; class PPB_Graphics3D_Impl; @@ -123,12 +122,12 @@ class CONTENT_EXPORT PepperPluginInstanceImpl // get_plugin_interface function. If the plugin does not support any valid // PPP_Instance interface, returns NULL. static PepperPluginInstanceImpl* Create( - PluginDelegate* delegate, + PepperPluginDelegateImpl* delegate, RenderViewImpl* render_view, PluginModule* module, WebKit::WebPluginContainer* container, const GURL& plugin_url); - PluginDelegate* delegate() const { return delegate_; } + PepperPluginDelegateImpl* delegate() const { return delegate_; } RenderViewImpl* render_view() const { return render_view_; } PluginModule* module() const { return module_.get(); } MessageChannel& message_channel() { return *message_channel_; } @@ -541,21 +540,21 @@ class CONTENT_EXPORT PepperPluginInstanceImpl class GamepadImpl : public ::ppapi::thunk::PPB_Gamepad_API, public ::ppapi::Resource { public: - explicit GamepadImpl(PluginDelegate* delegate); + explicit GamepadImpl(PepperPluginDelegateImpl* delegate); // Resource implementation. virtual ::ppapi::thunk::PPB_Gamepad_API* AsPPB_Gamepad_API() OVERRIDE; virtual void Sample(PP_Instance instance, PP_GamepadsSampleData* data) OVERRIDE; private: virtual ~GamepadImpl(); - PluginDelegate* delegate_; + PepperPluginDelegateImpl* delegate_; }; // See the static Create functions above for creating PepperPluginInstanceImpl // objects. This constructor is private so that we can hide the // PPP_Instance_Combined details while still having 1 constructor to maintain // for member initialization. - PepperPluginInstanceImpl(PluginDelegate* delegate, + PepperPluginInstanceImpl(PepperPluginDelegateImpl* delegate, RenderViewImpl* render_view, PluginModule* module, ::ppapi::PPP_Instance_Combined* instance_interface, @@ -647,7 +646,7 @@ class CONTENT_EXPORT PepperPluginInstanceImpl MouseLockDispatcher::LockTarget* GetOrCreateLockTargetAdapter(); void UnSetAndDeleteLockTargetAdapter(); - PluginDelegate* delegate_; + PepperPluginDelegateImpl* delegate_; RenderViewImpl* render_view_; scoped_refptr<PluginModule> module_; scoped_ptr< ::ppapi::PPP_Instance_Combined> instance_interface_; diff --git a/content/renderer/pepper/pepper_webplugin_impl.cc b/content/renderer/pepper/pepper_webplugin_impl.cc index 11e9fc1..176dca2 100644 --- a/content/renderer/pepper/pepper_webplugin_impl.cc +++ b/content/renderer/pepper/pepper_webplugin_impl.cc @@ -48,7 +48,7 @@ namespace content { struct PepperWebPluginImpl::InitData { scoped_refptr<PluginModule> module; - base::WeakPtr<PluginDelegate> delegate; + base::WeakPtr<PepperPluginDelegateImpl> delegate; base::WeakPtr<RenderViewImpl> render_view; std::vector<std::string> arg_names; std::vector<std::string> arg_values; @@ -58,7 +58,7 @@ struct PepperWebPluginImpl::InitData { PepperWebPluginImpl::PepperWebPluginImpl( PluginModule* plugin_module, const WebPluginParams& params, - const base::WeakPtr<PluginDelegate>& plugin_delegate, + const base::WeakPtr<PepperPluginDelegateImpl>& plugin_delegate, const base::WeakPtr<RenderViewImpl>& render_view) : init_data_(new InitData()), full_frame_(params.loadManually), diff --git a/content/renderer/pepper/pepper_webplugin_impl.h b/content/renderer/pepper/pepper_webplugin_impl.h index 09d068e..c05e840d 100644 --- a/content/renderer/pepper/pepper_webplugin_impl.h +++ b/content/renderer/pepper/pepper_webplugin_impl.h @@ -24,18 +24,19 @@ struct WebPrintParams; namespace content { +class PepperPluginDelegateImpl; class PepperPluginInstanceImpl; -class PluginDelegate; class PluginModule; class PPB_URLLoader_Impl; class RenderViewImpl; class PepperWebPluginImpl : public WebKit::WebPlugin { public: - PepperWebPluginImpl(PluginModule* module, - const WebKit::WebPluginParams& params, - const base::WeakPtr<PluginDelegate>& plugin_delegate, - const base::WeakPtr<RenderViewImpl>& render_view); + PepperWebPluginImpl( + PluginModule* module, + const WebKit::WebPluginParams& params, + const base::WeakPtr<PepperPluginDelegateImpl>& plugin_delegate, + const base::WeakPtr<RenderViewImpl>& render_view); PepperPluginInstanceImpl* instance() { return instance_.get(); } diff --git a/content/renderer/pepper/plugin_delegate.h b/content/renderer/pepper/plugin_delegate.h deleted file mode 100644 index 432b0b9..0000000 --- a/content/renderer/pepper/plugin_delegate.h +++ /dev/null @@ -1,155 +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_PLUGIN_DELEGATE_H_ -#define CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_H_ - -#include <string> -#include <vector> - -#include "base/callback.h" -#include "base/memory/ref_counted.h" -#include "base/memory/shared_memory.h" -#include "base/message_loop/message_loop_proxy.h" -#include "base/platform_file.h" -#include "base/process/process.h" -#include "base/time/time.h" -#include "content/common/content_export.h" -#include "ipc/ipc_platform_file.h" -#include "ppapi/c/dev/pp_video_dev.h" -#include "ppapi/c/pp_completion_callback.h" -#include "ppapi/c/pp_errors.h" -#include "ppapi/c/pp_file_info.h" -#include "ppapi/c/pp_instance.h" -#include "ppapi/c/pp_resource.h" -#include "ppapi/c/pp_stdint.h" -#include "ppapi/c/private/ppb_flash.h" -#include "ppapi/c/private/ppb_udp_socket_private.h" -#include "ppapi/shared_impl/dir_contents.h" -#include "ui/gfx/size.h" -#include "url/gurl.h" -#include "webkit/common/fileapi/file_system_types.h" - -class GURL; -class SkCanvas; -class TransportDIB; -struct PP_NetAddress_Private; - -namespace IPC { -struct ChannelHandle; -} - -namespace WebKit { -class WebGraphicsContext3D; -} - -namespace base { -class MessageLoopProxy; -class Time; -} - -namespace content { -class RendererPpapiHost; -} - -namespace fileapi { -struct DirectoryEntry; -} - -namespace gfx { -class Point; -} - -namespace ppapi { -class PepperFilePath; -class PpapiPermissions; -class SocketOptionData; -struct DeviceRefData; -struct HostPortPair; - -} // namespace ppapi - -namespace WebKit { -typedef SkCanvas WebCanvas; -class WebGamepads; -struct WebCursorInfo; -struct WebURLError; -class WebURLLoaderClient; -class WebURLResponse; -} - -namespace content { - -class FileIO; -class FullscreenContainer; -class PepperPluginInstanceImpl; -class PluginModule; -class PPB_Flash_Menu_Impl; -class PPB_ImageData_Impl; -class PPB_TCPSocket_Private_Impl; - -// Virtual interface that the browser implements to implement features for -// PPAPI plugins. -class PluginDelegate { - public: - // Notification that the given plugin is focused or unfocused. - virtual void PluginFocusChanged(PepperPluginInstanceImpl* instance, - bool focused) = 0; - // Notification that the text input status of the given plugin is changed. - virtual void PluginTextInputTypeChanged( - PepperPluginInstanceImpl* instance) = 0; - // Notification that the caret position in the given plugin is changed. - virtual void PluginCaretPositionChanged( - PepperPluginInstanceImpl* instance) = 0; - // Notification that the plugin requested to cancel the current composition. - virtual void PluginRequestedCancelComposition( - PepperPluginInstanceImpl* instance) = 0; - // Notification that the text selection in the given plugin is changed. - virtual void PluginSelectionChanged(PepperPluginInstanceImpl* instance) = 0; - - // Indicates that the given instance has been created. - virtual void InstanceCreated(PepperPluginInstanceImpl* instance) = 0; - - // Indicates that the given instance is being destroyed. This is called from - // the destructor, so it's important that the instance is not dereferenced - // from this call. - virtual void InstanceDeleted(PepperPluginInstanceImpl* instance) = 0; - - // Sends an async IPC to open a local file. - typedef base::Callback<void (base::PlatformFileError, base::PassPlatformFile)> - AsyncOpenFileCallback; - virtual bool AsyncOpenFile(const base::FilePath& path, - int flags, - const AsyncOpenFileCallback& callback) = 0; - - // Returns a MessageLoopProxy instance associated with the message loop - // of the file thread in this renderer. - virtual scoped_refptr<base::MessageLoopProxy> - GetFileThreadMessageLoopProxy() = 0; - - // Retrieve current gamepad data. - virtual void SampleGamepads(WebKit::WebGamepads* data) = 0; - - // Notifies the plugin of the document load. This should initiate the call to - // PPP_Instance.HandleDocumentLoad. - // - // The loader object should set itself on the PluginInstance as the document - // loader using set_document_loader. - virtual void HandleDocumentLoad(PepperPluginInstanceImpl* instance, - const WebKit::WebURLResponse& response) = 0; - - // Sets up the renderer host and out-of-process proxy for an external plugin - // module. Returns the renderer host, or NULL if it couldn't be created. - virtual RendererPpapiHost* CreateExternalPluginModule( - scoped_refptr<PluginModule> module, - const base::FilePath& path, - ::ppapi::PpapiPermissions permissions, - const IPC::ChannelHandle& channel_handle, - base::ProcessId plugin_pid, - int plugin_child_id) = 0; -}; - -} // namespace content - -#endif // CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_H_ diff --git a/content/renderer/pepper/plugin_module.cc b/content/renderer/pepper/plugin_module.cc index 54129b8..dc8b893 100644 --- a/content/renderer/pepper/plugin_module.cc +++ b/content/renderer/pepper/plugin_module.cc @@ -532,7 +532,7 @@ bool PluginModule::SupportsInterface(const char* name) { } PepperPluginInstanceImpl* PluginModule::CreateInstance( - PluginDelegate* delegate, + PepperPluginDelegateImpl* delegate, RenderViewImpl* render_view, WebKit::WebPluginContainer* container, const GURL& plugin_url) { diff --git a/content/renderer/pepper/plugin_module.h b/content/renderer/pepper/plugin_module.h index 8deeeb1..e177aae 100644 --- a/content/renderer/pepper/plugin_module.h +++ b/content/renderer/pepper/plugin_module.h @@ -18,7 +18,6 @@ #include "base/process/process.h" #include "content/common/content_export.h" #include "content/public/common/pepper_plugin_info.h" -#include "content/renderer/pepper/plugin_delegate.h" #include "ppapi/c/pp_bool.h" #include "ppapi/c/pp_instance.h" #include "ppapi/c/ppb_core.h" @@ -27,6 +26,8 @@ typedef void* NPIdentifier; +class GURL; + namespace base { class FilePath; } @@ -42,9 +43,9 @@ class WebPluginContainer; namespace content { class HostDispatcherWrapper; +class PepperPluginDelegateImpl; class PepperPluginInstanceImpl; class PepperBroker; -class PluginDelegate; class RendererPpapiHostImpl; class RenderViewImpl; @@ -138,7 +139,7 @@ class CONTENT_EXPORT PluginModule : const ::ppapi::PpapiPermissions& permissions() const { return permissions_; } PepperPluginInstanceImpl* CreateInstance( - PluginDelegate* delegate, + PepperPluginDelegateImpl* delegate, RenderViewImpl* render_view, WebKit::WebPluginContainer* container, const GURL& plugin_url); diff --git a/content/renderer/pepper/ppapi_unittest.cc b/content/renderer/pepper/ppapi_unittest.cc index 2503072..7a94d87 100644 --- a/content/renderer/pepper/ppapi_unittest.cc +++ b/content/renderer/pepper/ppapi_unittest.cc @@ -7,9 +7,9 @@ #include "base/message_loop/message_loop.h" #include "content/renderer/pepper/gfx_conversion.h" #include "content/renderer/pepper/host_globals.h" -#include "content/renderer/pepper/mock_plugin_delegate.h" #include "content/renderer/pepper/pepper_plugin_instance_impl.h" #include "content/renderer/pepper/plugin_module.h" +#include "ppapi/c/pp_errors.h" #include "ppapi/c/pp_var.h" #include "ppapi/c/ppp_instance.h" #include "ppapi/shared_impl/ppapi_globals.h" @@ -76,7 +76,6 @@ PpapiUnittest::~PpapiUnittest() { void PpapiUnittest::SetUp() { message_loop_.reset(new base::MessageLoop()); - delegate_.reset(new MockPluginDelegate()); // Initialize the mock module. module_ = new PluginModule("Mock plugin", base::FilePath(), @@ -89,7 +88,7 @@ void PpapiUnittest::SetUp() { // Initialize the mock instance. instance_ = PepperPluginInstanceImpl::Create( - delegate_.get(), NULL, module(), NULL, GURL()); + NULL, NULL, module(), NULL, GURL()); } void PpapiUnittest::TearDown() { diff --git a/content/renderer/pepper/ppapi_unittest.h b/content/renderer/pepper/ppapi_unittest.h index 49a0dbf..4bca4e9 100644 --- a/content/renderer/pepper/ppapi_unittest.h +++ b/content/renderer/pepper/ppapi_unittest.h @@ -8,7 +8,6 @@ #include "base/basictypes.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" -#include "content/renderer/pepper/plugin_delegate.h" #include "testing/gtest/include/gtest/gtest.h" namespace base { @@ -17,7 +16,6 @@ class MessageLoop; namespace content { -class MockPluginDelegate; class PepperPluginInstanceImpl; class PluginModule; @@ -29,7 +27,6 @@ class PpapiUnittest : public testing::Test { virtual void SetUp(); virtual void TearDown(); - MockPluginDelegate* delegate() { return delegate_.get(); } PluginModule* module() const { return module_.get(); } PepperPluginInstanceImpl* instance() const { return instance_.get(); } @@ -44,8 +41,6 @@ class PpapiUnittest : public testing::Test { void SetViewSize(int width, int height) const; private: - scoped_ptr<MockPluginDelegate> delegate_; - // Note: module must be declared first since we want it to get destroyed last. scoped_refptr<PluginModule> module_; scoped_refptr<PepperPluginInstanceImpl> instance_; diff --git a/content/renderer/pepper/ppb_broker_impl.cc b/content/renderer/pepper/ppb_broker_impl.cc index d04017e..6425fb2 100644 --- a/content/renderer/pepper/ppb_broker_impl.cc +++ b/content/renderer/pepper/ppb_broker_impl.cc @@ -11,6 +11,7 @@ #include "content/renderer/pepper/pepper_plugin_instance_impl.h" #include "content/renderer/pepper/plugin_module.h" #include "content/renderer/pepper/resource_helper.h" +#include "ppapi/c/pp_errors.h" #include "ppapi/shared_impl/platform_file.h" #include "third_party/WebKit/public/web/WebDocument.h" #include "third_party/WebKit/public/web/WebElement.h" @@ -65,8 +66,7 @@ int32_t PPB_Broker_Impl::Connect( // ConnectToBroker fails. connect_callback_ = connect_callback; - broker_ = static_cast<PepperPluginDelegateImpl*>( - plugin_instance->delegate())->ConnectToBroker(this); + broker_ = plugin_instance->delegate()->ConnectToBroker(this); if (!broker_) { connect_callback_->Abort(); return PP_ERROR_FAILED; diff --git a/content/renderer/pepper/ppb_buffer_impl.cc b/content/renderer/pepper/ppb_buffer_impl.cc index 1916b90..11fa098 100644 --- a/content/renderer/pepper/ppb_buffer_impl.cc +++ b/content/renderer/pepper/ppb_buffer_impl.cc @@ -9,10 +9,10 @@ #include "base/logging.h" #include "base/memory/scoped_ptr.h" #include "content/renderer/pepper/common.h" -#include "content/renderer/pepper/plugin_delegate.h" #include "content/renderer/pepper/resource_helper.h" #include "content/renderer/render_thread_impl.h" #include "ppapi/c/dev/ppb_buffer_dev.h" +#include "ppapi/c/pp_errors.h" #include "ppapi/c/pp_instance.h" #include "ppapi/c/pp_resource.h" @@ -56,8 +56,7 @@ PPB_Buffer_API* PPB_Buffer_Impl::AsPPB_Buffer_API() { } bool PPB_Buffer_Impl::Init(uint32_t size) { - PluginDelegate* plugin_delegate = ResourceHelper::GetPluginDelegate(this); - if (size == 0 || !plugin_delegate) + if (size == 0) return false; size_ = size; shared_memory_.reset( diff --git a/content/renderer/pepper/ppb_file_ref_impl.cc b/content/renderer/pepper/ppb_file_ref_impl.cc index 589e17e..163c874 100644 --- a/content/renderer/pepper/ppb_file_ref_impl.cc +++ b/content/renderer/pepper/ppb_file_ref_impl.cc @@ -11,8 +11,8 @@ #include "content/child/fileapi/file_system_dispatcher.h" #include "content/renderer/pepper/common.h" #include "content/renderer/pepper/pepper_file_system_host.h" +#include "content/renderer/pepper/pepper_plugin_delegate_impl.h" #include "content/renderer/pepper/pepper_plugin_instance_impl.h" -#include "content/renderer/pepper/plugin_delegate.h" #include "content/renderer/pepper/plugin_module.h" #include "content/renderer/pepper/renderer_ppapi_host_impl.h" #include "content/renderer/pepper/resource_helper.h" @@ -465,7 +465,7 @@ int32_t PPB_FileRef_Impl::QueryInHost( // TODO(teravest): Use the SequencedWorkerPool instead. scoped_refptr<base::TaskRunner> task_runner = - plugin_instance->delegate()->GetFileThreadMessageLoopProxy(); + RenderThreadImpl::current()->GetFileThreadMessageLoopProxy(); if (!plugin_instance->delegate()->AsyncOpenFile( GetSystemPath(), base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ, diff --git a/content/renderer/pepper/ppb_image_data_impl.cc b/content/renderer/pepper/ppb_image_data_impl.cc index 12f9ae5..fc28868 100644 --- a/content/renderer/pepper/ppb_image_data_impl.cc +++ b/content/renderer/pepper/ppb_image_data_impl.cc @@ -13,11 +13,12 @@ #include "content/renderer/pepper/common.h" #include "content/renderer/pepper/resource_helper.h" #include "content/renderer/render_thread_impl.h" -#include "skia/ext/platform_canvas.h" +#include "ppapi/c/pp_errors.h" #include "ppapi/c/pp_instance.h" #include "ppapi/c/pp_resource.h" #include "ppapi/c/ppb_image_data.h" #include "ppapi/thunk/thunk.h" +#include "skia/ext/platform_canvas.h" #include "third_party/skia/include/core/SkColorPriv.h" #include "ui/surface/transport_dib.h" @@ -254,7 +255,8 @@ bool ImageDataSimpleBackend::Init(PPB_ImageData_Impl* impl, bool init_to_zero) { skia_bitmap_.setConfig(SkBitmap::kARGB_8888_Config, impl->width(), impl->height()); - PluginDelegate* plugin_delegate = ResourceHelper::GetPluginDelegate(impl); + PepperPluginDelegateImpl* plugin_delegate = + ResourceHelper::GetPluginDelegate(impl); if (!plugin_delegate) return false; shared_memory_.reset(RenderThread::Get()->HostAllocateSharedMemoryBuffer( diff --git a/content/renderer/pepper/ppb_image_data_impl.h b/content/renderer/pepper/ppb_image_data_impl.h index 481034e..ee05b5a 100644 --- a/content/renderer/pepper/ppb_image_data_impl.h +++ b/content/renderer/pepper/ppb_image_data_impl.h @@ -8,7 +8,6 @@ #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "content/common/content_export.h" -#include "content/renderer/pepper/plugin_delegate.h" #include "ppapi/c/ppb_image_data.h" #include "ppapi/shared_impl/ppb_image_data_shared.h" #include "ppapi/shared_impl/resource.h" @@ -19,6 +18,10 @@ class SkBitmap; class SkCanvas; class TransportDIB; +namespace base { +class SharedMemory; +} + namespace content { class CONTENT_EXPORT PPB_ImageData_Impl diff --git a/content/renderer/pepper/ppb_network_monitor_private_impl.h b/content/renderer/pepper/ppb_network_monitor_private_impl.h index 6e776f5..678ee40 100644 --- a/content/renderer/pepper/ppb_network_monitor_private_impl.h +++ b/content/renderer/pepper/ppb_network_monitor_private_impl.h @@ -8,7 +8,6 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" #include "content/renderer/p2p/network_list_observer.h" -#include "content/renderer/pepper/plugin_delegate.h" #include "ppapi/c/private/ppb_network_monitor_private.h" #include "ppapi/shared_impl/resource.h" #include "ppapi/thunk/ppb_network_monitor_private_api.h" diff --git a/content/renderer/pepper/ppb_tcp_server_socket_private_impl.cc b/content/renderer/pepper/ppb_tcp_server_socket_private_impl.cc index d2b8958..695774b 100644 --- a/content/renderer/pepper/ppb_tcp_server_socket_private_impl.cc +++ b/content/renderer/pepper/ppb_tcp_server_socket_private_impl.cc @@ -86,8 +86,7 @@ void PPB_TCPServerSocket_Private_Impl::SendStopListening() { PepperPluginDelegateImpl* PPB_TCPServerSocket_Private_Impl::GetPluginDelegate() { - return static_cast<PepperPluginDelegateImpl*>( - ResourceHelper::GetPluginDelegate(this)); + return ResourceHelper::GetPluginDelegate(this); } } // namespace content diff --git a/content/renderer/pepper/ppb_tcp_socket_private_impl.cc b/content/renderer/pepper/ppb_tcp_socket_private_impl.cc index 16cf52a9..1022a86 100644 --- a/content/renderer/pepper/ppb_tcp_socket_private_impl.cc +++ b/content/renderer/pepper/ppb_tcp_socket_private_impl.cc @@ -138,7 +138,7 @@ PepperPluginDelegateImpl* PPB_TCPSocket_Private_Impl::GetPluginDelegate( HostGlobals::Get()->GetInstance(instance); if (!plugin_instance) return NULL; - return static_cast<PepperPluginDelegateImpl*>(plugin_instance->delegate()); + return plugin_instance->delegate(); } } // namespace content diff --git a/content/renderer/pepper/ppb_video_decoder_impl.cc b/content/renderer/pepper/ppb_video_decoder_impl.cc index a605ec7..07307dd6 100644 --- a/content/renderer/pepper/ppb_video_decoder_impl.cc +++ b/content/renderer/pepper/ppb_video_decoder_impl.cc @@ -12,6 +12,7 @@ #include "content/renderer/media/pepper_platform_video_decoder.h" #include "content/renderer/pepper/common.h" #include "content/renderer/pepper/pepper_platform_context_3d.h" +#include "content/renderer/pepper/pepper_plugin_delegate_impl.h" #include "content/renderer/pepper/plugin_module.h" #include "content/renderer/pepper/ppb_buffer_impl.h" #include "content/renderer/pepper/ppb_graphics_3d_impl.h" @@ -138,7 +139,8 @@ bool PPB_VideoDecoder_Impl::Init( if (command_buffer_route_id == 0) return false; - PluginDelegate* plugin_delegate = ResourceHelper::GetPluginDelegate(this); + PepperPluginDelegateImpl* plugin_delegate = + ResourceHelper::GetPluginDelegate(this); if (!plugin_delegate) return false; diff --git a/content/renderer/pepper/renderer_ppapi_host_impl.cc b/content/renderer/pepper/renderer_ppapi_host_impl.cc index 1180d39..8f77a62 100644 --- a/content/renderer/pepper/renderer_ppapi_host_impl.cc +++ b/content/renderer/pepper/renderer_ppapi_host_impl.cc @@ -16,7 +16,6 @@ #include "content/renderer/pepper/pepper_in_process_router.h" #include "content/renderer/pepper/pepper_plugin_delegate_impl.h" #include "content/renderer/pepper/pepper_plugin_instance_impl.h" -#include "content/renderer/pepper/plugin_delegate.h" #include "content/renderer/pepper/plugin_module.h" #include "content/renderer/render_view_impl.h" #include "content/renderer/render_widget_fullscreen_pepper.h" @@ -131,8 +130,7 @@ RendererPpapiHostImpl::GetBrowserConnection(PP_Instance instance) const { // Since we're the embedder, we can make assumptions about the delegate on // the instance. - PepperPluginDelegateImpl* delegate = - static_cast<PepperPluginDelegateImpl*>(instance_object->delegate()); + PepperPluginDelegateImpl* delegate = instance_object->delegate(); if (!delegate) return NULL; @@ -156,8 +154,7 @@ RenderView* RendererPpapiHostImpl::GetRenderViewForInstance( // Since we're the embedder, we can make assumptions about the delegate on // the instance and get back to our RenderView. - return static_cast<PepperPluginDelegateImpl*>( - instance_object->delegate())->render_view(); + return instance_object->delegate()->render_view(); } bool RendererPpapiHostImpl::IsValidInstance(PP_Instance instance) const { diff --git a/content/renderer/pepper/renderer_ppapi_host_impl.h b/content/renderer/pepper/renderer_ppapi_host_impl.h index 45929c2..beeb40f 100644 --- a/content/renderer/pepper/renderer_ppapi_host_impl.h +++ b/content/renderer/pepper/renderer_ppapi_host_impl.h @@ -9,7 +9,6 @@ #include "base/memory/scoped_ptr.h" #include "content/public/renderer/renderer_ppapi_host.h" #include "content/renderer/pepper/content_renderer_pepper_host_factory.h" -#include "content/renderer/pepper/plugin_delegate.h" #include "ppapi/host/ppapi_host.h" namespace IPC { diff --git a/content/renderer/pepper/resource_helper.cc b/content/renderer/pepper/resource_helper.cc index 0f4ebda..9a20fe8 100644 --- a/content/renderer/pepper/resource_helper.cc +++ b/content/renderer/pepper/resource_helper.cc @@ -29,7 +29,7 @@ PluginModule* ResourceHelper::GetPluginModule( return instance ? instance->module() : NULL; } -PluginDelegate* ResourceHelper::GetPluginDelegate( +PepperPluginDelegateImpl* ResourceHelper::GetPluginDelegate( const ::ppapi::Resource* resource) { PepperPluginInstanceImpl* instance = GetPluginInstance(resource); return instance ? instance->delegate() : NULL; diff --git a/content/renderer/pepper/resource_helper.h b/content/renderer/pepper/resource_helper.h index 2f855f6..2ace5d1 100644 --- a/content/renderer/pepper/resource_helper.h +++ b/content/renderer/pepper/resource_helper.h @@ -15,9 +15,9 @@ class Resource; namespace content { +class PepperPluginDelegateImpl; class PepperPluginInstanceImpl; class PluginModule; -class PluginDelegate; // Helper functions for Resoruce implementations. // @@ -37,7 +37,8 @@ class ResourceHelper { // Returns the plugin delegate for the given resource, or NULL if the // resource has outlived its instance. - static PluginDelegate* GetPluginDelegate(const ::ppapi::Resource* resource); + static PepperPluginDelegateImpl* GetPluginDelegate( + const ::ppapi::Resource* resource); // Returns the instance implementation object for the pp_instance. static PepperPluginInstanceImpl* PPInstanceToPluginInstance( diff --git a/content/renderer/pepper/url_request_info_util.cc b/content/renderer/pepper/url_request_info_util.cc index 9091203..23fe60f 100644 --- a/content/renderer/pepper/url_request_info_util.cc +++ b/content/renderer/pepper/url_request_info_util.cc @@ -58,7 +58,7 @@ bool AppendFileRefToBody( const PPB_FileRef_Impl* file_ref = static_cast<PPB_FileRef_Impl*>(file_ref_api); - PluginDelegate* plugin_delegate = + PepperPluginDelegateImpl* plugin_delegate = ResourceHelper::GetPluginDelegate(file_ref_resource); if (!plugin_delegate) return false; diff --git a/content/renderer/render_widget_fullscreen_pepper.cc b/content/renderer/render_widget_fullscreen_pepper.cc index e7a7027..1a82018 100644 --- a/content/renderer/render_widget_fullscreen_pepper.cc +++ b/content/renderer/render_widget_fullscreen_pepper.cc @@ -15,7 +15,6 @@ #include "content/renderer/gpu/render_widget_compositor.h" #include "content/renderer/pepper/pepper_platform_context_3d.h" #include "content/renderer/pepper/pepper_plugin_instance_impl.h" -#include "content/renderer/pepper/plugin_delegate.h" #include "content/renderer/render_thread_impl.h" #include "gpu/command_buffer/client/gles2_implementation.h" #include "skia/ext/platform_canvas.h" |