summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-29 23:26:56 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-29 23:26:56 +0000
commit4de8c30842d8b6612a928ca1df06f6fee102c377 (patch)
tree6980e99c259c0e99ac4c84b4938dac0733f3c707
parent4547872a6c90477b127fea4191fff2346efa4175 (diff)
downloadchromium_src-4de8c30842d8b6612a928ca1df06f6fee102c377.zip
chromium_src-4de8c30842d8b6612a928ca1df06f6fee102c377.tar.gz
chromium_src-4de8c30842d8b6612a928ca1df06f6fee102c377.tar.bz2
Remove a bunch of methods from PluginDelegate and have the callers do the work themselves, now that they're in content.
BUG=263054 R=scottmg@chromium.org Review URL: https://codereview.chromium.org/21168002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@214249 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/renderer/pepper/host_array_buffer_var.cc13
-rw-r--r--content/renderer/pepper/mock_plugin_delegate.cc172
-rw-r--r--content/renderer/pepper/mock_plugin_delegate.h77
-rw-r--r--content/renderer/pepper/pepper_file_io_host.cc68
-rw-r--r--content/renderer/pepper/pepper_file_io_host.h13
-rw-r--r--content/renderer/pepper/pepper_plugin_delegate_impl.cc294
-rw-r--r--content/renderer/pepper/pepper_plugin_delegate_impl.h88
-rw-r--r--content/renderer/pepper/pepper_plugin_instance_impl.cc70
-rw-r--r--content/renderer/pepper/pepper_plugin_instance_impl.h10
-rw-r--r--content/renderer/pepper/pepper_webplugin_impl.cc10
-rw-r--r--content/renderer/pepper/pepper_webplugin_impl.h7
-rw-r--r--content/renderer/pepper/plugin_delegate.h157
-rw-r--r--content/renderer/pepper/plugin_module.cc14
-rw-r--r--content/renderer/pepper/plugin_module.h28
-rw-r--r--content/renderer/pepper/ppb_buffer_impl.cc4
-rw-r--r--content/renderer/pepper/ppb_file_ref_impl.cc131
-rw-r--r--content/renderer/pepper/ppb_file_ref_impl.h10
-rw-r--r--content/renderer/pepper/ppb_image_data_impl.cc4
-rw-r--r--content/renderer/pepper/ppb_x509_certificate_private_impl.cc13
-rw-r--r--content/renderer/pepper/renderer_ppapi_host_impl.cc13
-rw-r--r--content/renderer/pepper/renderer_ppapi_host_impl.h7
-rw-r--r--content/renderer/pepper/url_request_info_util.cc7
-rw-r--r--ppapi/thunk/ppb_instance_api.h2
23 files changed, 257 insertions, 955 deletions
diff --git a/content/renderer/pepper/host_array_buffer_var.cc b/content/renderer/pepper/host_array_buffer_var.cc
index e8d349e..b6b719d 100644
--- a/content/renderer/pepper/host_array_buffer_var.cc
+++ b/content/renderer/pepper/host_array_buffer_var.cc
@@ -9,10 +9,12 @@
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
+#include "base/memory/shared_memory.h"
#include "base/process/process_handle.h"
+#include "content/common/sandbox_util.h"
#include "content/renderer/pepper/host_globals.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/c/pp_instance.h"
using ppapi::ArrayBufferVar;
@@ -62,9 +64,9 @@ bool HostArrayBufferVar::CopyToNewShmem(
PP_Instance instance,
int* host_shm_handle_id,
base::SharedMemoryHandle* plugin_shm_handle) {
- PepperPluginInstanceImpl* i = HostGlobals::Get()->GetInstance(instance);
- scoped_ptr<base::SharedMemory> shm(i->delegate()->CreateAnonymousSharedMemory(
- ByteLength()));
+ scoped_ptr<base::SharedMemory> shm(
+ RenderThread::Get()->HostAllocateSharedMemoryBuffer(ByteLength()).
+ release());
if (!shm)
return false;
@@ -91,8 +93,7 @@ bool HostArrayBufferVar::CopyToNewShmem(
#error Not implemented.
#endif
- *plugin_shm_handle =
- i->delegate()->ShareHandleWithRemote(platform_file, p, false);
+ *plugin_shm_handle = BrokerGetFileHandleForProcess(platform_file, p, false);
*host_shm_handle_id = -1;
return true;
}
diff --git a/content/renderer/pepper/mock_plugin_delegate.cc b/content/renderer/pepper/mock_plugin_delegate.cc
index d38567d..894e2e6 100644
--- a/content/renderer/pepper/mock_plugin_delegate.cc
+++ b/content/renderer/pepper/mock_plugin_delegate.cc
@@ -42,17 +42,6 @@ void MockPluginDelegate::PluginSelectionChanged(
PepperPluginInstanceImpl* instance) {
}
-void MockPluginDelegate::SimulateImeSetComposition(
- const base::string16& text,
- const std::vector<WebKit::WebCompositionUnderline>& underlines,
- int selection_start,
- int selection_end) {
-}
-
-void MockPluginDelegate::SimulateImeConfirmComposition(
- const base::string16& text) {
-}
-
void MockPluginDelegate::PluginCrashed(PepperPluginInstanceImpl* instance) {
}
@@ -62,122 +51,12 @@ void MockPluginDelegate::InstanceCreated(PepperPluginInstanceImpl* instance) {
void MockPluginDelegate::InstanceDeleted(PepperPluginInstanceImpl* instance) {
}
-scoped_ptr< ::ppapi::thunk::ResourceCreationAPI>
- MockPluginDelegate::CreateResourceCreationAPI(
- PepperPluginInstanceImpl* instance) {
- return scoped_ptr< ::ppapi::thunk::ResourceCreationAPI>();
-}
-
-SkBitmap* MockPluginDelegate::GetSadPluginBitmap() {
- return NULL;
-}
-
-WebKit::WebPlugin* MockPluginDelegate::CreatePluginReplacement(
- const base::FilePath& file_path) {
- return NULL;
-}
-
-uint32_t MockPluginDelegate::GetAudioHardwareOutputSampleRate() {
- return 0;
-}
-
-uint32_t MockPluginDelegate::GetAudioHardwareOutputBufferSize() {
- return 0;
-}
-
-void MockPluginDelegate::NumberOfFindResultsChanged(int identifier,
- int total,
- bool final_result) {
-}
-
-void MockPluginDelegate::SelectedFindResultChanged(int identifier, int index) {
-}
-
bool MockPluginDelegate::AsyncOpenFile(const base::FilePath& path,
int flags,
const AsyncOpenFileCallback& callback) {
return false;
}
-void MockPluginDelegate::AsyncOpenFileSystemURL(
- const GURL& path,
- int flags,
- const AsyncOpenFileSystemURLCallback& callback) {
-}
-
-bool MockPluginDelegate::IsFileSystemOpened(
- PP_Instance instance,
- PP_Resource resource) const {
- return false;
-}
-
-PP_FileSystemType MockPluginDelegate::GetFileSystemType(
- PP_Instance instance,
- PP_Resource resource) const {
- return PP_FILESYSTEMTYPE_INVALID;
-}
-
-GURL MockPluginDelegate::GetFileSystemRootUrl(
- PP_Instance instance,
- PP_Resource resource) const {
- return GURL();
-}
-
-void MockPluginDelegate::MakeDirectory(
- const GURL& path,
- bool recursive,
- const StatusCallback& callback) {
-}
-
-void MockPluginDelegate::Query(
- const GURL& path,
- const MetadataCallback& success_callback,
- const StatusCallback& error_callback) {
-}
-
-void MockPluginDelegate::ReadDirectoryEntries(
- const GURL& path,
- const ReadDirectoryCallback& success_callback,
- const StatusCallback& error_callback) {
-}
-
-void MockPluginDelegate::Touch(
- const GURL& path,
- const base::Time& last_access_time,
- const base::Time& last_modified_time,
- const StatusCallback& callback) {
-}
-
-void MockPluginDelegate::SetLength(
- const GURL& path,
- int64_t length,
- const StatusCallback& callback) {
-}
-
-void MockPluginDelegate::Delete(
- const GURL& path,
- const StatusCallback& callback) {
-}
-
-void MockPluginDelegate::Rename(
- const GURL& file_path,
- const GURL& new_file_path,
- const StatusCallback& callback) {
-}
-
-void MockPluginDelegate::ReadDirectory(
- const GURL& directory_path,
- const ReadDirectoryCallback& success_callback,
- const StatusCallback& error_callback) {
-}
-
-void MockPluginDelegate::SyncGetFileSystemPlatformPath(
- const GURL& url,
- base::FilePath* platform_path) {
- DCHECK(platform_path);
- *platform_path = base::FilePath();
-}
-
scoped_refptr<base::MessageLoopProxy>
MockPluginDelegate::GetFileThreadMessageLoopProxy() {
return scoped_refptr<base::MessageLoopProxy>();
@@ -242,38 +121,6 @@ void MockPluginDelegate::TCPServerSocketStopListening(
uint32 socket_id) {
}
-bool MockPluginDelegate::X509CertificateParseDER(
- const std::vector<char>& der,
- ::ppapi::PPB_X509Certificate_Fields* fields) {
- return false;
-}
-
-FullscreenContainer* MockPluginDelegate::CreateFullscreenContainer(
- PepperPluginInstanceImpl* instance) {
- return NULL;
-}
-
-gfx::Size MockPluginDelegate::GetScreenSize() {
- return gfx::Size(1024, 768);
-}
-
-std::string MockPluginDelegate::GetDefaultEncoding() {
- return "iso-8859-1";
-}
-
-void MockPluginDelegate::ZoomLimitsChanged(double minimum_factor,
- double maximum_factor) {
-}
-
-base::SharedMemory* MockPluginDelegate::CreateAnonymousSharedMemory(
- size_t size) {
- return NULL;
-}
-
-::ppapi::Preferences MockPluginDelegate::GetPreferences() {
- return ::ppapi::Preferences();
-}
-
bool MockPluginDelegate::LockMouse(PepperPluginInstanceImpl* instance) {
return false;
}
@@ -297,25 +144,6 @@ void MockPluginDelegate::SampleGamepads(WebKit::WebGamepads* data) {
data->length = 0;
}
-bool MockPluginDelegate::IsInFullscreenMode() {
- return false;
-}
-
-bool MockPluginDelegate::IsPageVisible() const {
- return true;
-}
-
-IPC::PlatformFileForTransit MockPluginDelegate::ShareHandleWithRemote(
- base::PlatformFile handle,
- base::ProcessId target_process_id,
- bool should_close_source) const {
- return IPC::InvalidPlatformFileForTransit();
-}
-
-bool MockPluginDelegate::IsRunningInProcess(PP_Instance instance) const {
- return false;
-}
-
void MockPluginDelegate::HandleDocumentLoad(
PepperPluginInstanceImpl* instance,
const WebKit::WebURLResponse& response) {
diff --git a/content/renderer/pepper/mock_plugin_delegate.h b/content/renderer/pepper/mock_plugin_delegate.h
index 398acc7..a5de829 100644
--- a/content/renderer/pepper/mock_plugin_delegate.h
+++ b/content/renderer/pepper/mock_plugin_delegate.h
@@ -27,71 +27,12 @@ class MockPluginDelegate : public PluginDelegate {
PepperPluginInstanceImpl* instance) OVERRIDE;
virtual void PluginSelectionChanged(
PepperPluginInstanceImpl* instance) OVERRIDE;
- virtual void SimulateImeSetComposition(
- const base::string16& text,
- const std::vector<WebKit::WebCompositionUnderline>& underlines,
- int selection_start,
- int selection_end) OVERRIDE;
- virtual void SimulateImeConfirmComposition(
- const base::string16& text) OVERRIDE;
virtual void PluginCrashed(PepperPluginInstanceImpl* instance) OVERRIDE;
virtual void InstanceCreated(PepperPluginInstanceImpl* instance) OVERRIDE;
virtual void InstanceDeleted(PepperPluginInstanceImpl* instance) OVERRIDE;
- virtual scoped_ptr< ::ppapi::thunk::ResourceCreationAPI>
- CreateResourceCreationAPI(PepperPluginInstanceImpl* instance) OVERRIDE;
- virtual SkBitmap* GetSadPluginBitmap() OVERRIDE;
- virtual WebKit::WebPlugin* CreatePluginReplacement(
- const base::FilePath& file_path) OVERRIDE;
- virtual uint32_t GetAudioHardwareOutputSampleRate() OVERRIDE;
- virtual uint32_t GetAudioHardwareOutputBufferSize() OVERRIDE;
- virtual void NumberOfFindResultsChanged(int identifier,
- int total,
- bool final_result) OVERRIDE;
- virtual void SelectedFindResultChanged(int identifier, int index) OVERRIDE;
virtual bool AsyncOpenFile(const base::FilePath& path,
int flags,
const AsyncOpenFileCallback& callback) OVERRIDE;
- virtual void AsyncOpenFileSystemURL(
- const GURL& path,
- int flags,
- const AsyncOpenFileSystemURLCallback& callback) OVERRIDE;
- virtual bool IsFileSystemOpened(PP_Instance instance,
- PP_Resource resource) const OVERRIDE;
- virtual PP_FileSystemType GetFileSystemType(
- PP_Instance instance,
- PP_Resource resource) const OVERRIDE;
- virtual GURL GetFileSystemRootUrl(PP_Instance instance,
- PP_Resource resource) const OVERRIDE;
- virtual void MakeDirectory(
- const GURL& path,
- bool recursive,
- const StatusCallback& callback) OVERRIDE;
- virtual void Query(const GURL& path,
- const MetadataCallback& success_callback,
- const StatusCallback& error_callback) OVERRIDE;
- virtual void ReadDirectoryEntries(
- const GURL& path,
- const ReadDirectoryCallback& success_callback,
- const StatusCallback& error_callback) OVERRIDE;
- virtual void Touch(const GURL& path,
- const base::Time& last_access_time,
- const base::Time& last_modified_time,
- const StatusCallback& callback) OVERRIDE;
- virtual void SetLength(const GURL& path,
- int64_t length,
- const StatusCallback& callback) OVERRIDE;
- virtual void Delete(const GURL& path,
- const StatusCallback& callback) OVERRIDE;
- virtual void Rename(const GURL& file_path,
- const GURL& new_file_path,
- const StatusCallback& callback) OVERRIDE;
- virtual void ReadDirectory(
- const GURL& directory_path,
- const ReadDirectoryCallback& success_callback,
- const StatusCallback& error_callback) OVERRIDE;
- virtual void SyncGetFileSystemPlatformPath(
- const GURL& url,
- base::FilePath* platform_path) OVERRIDE;
virtual scoped_refptr<base::MessageLoopProxy>
GetFileThreadMessageLoopProxy() OVERRIDE;
virtual uint32 TCPSocketCreate() OVERRIDE;
@@ -126,17 +67,6 @@ class MockPluginDelegate : public PluginDelegate {
virtual void TCPServerSocketStopListening(PP_Resource socket_resource,
uint32 socket_id) OVERRIDE;
// Add/remove a network list observer.
- virtual bool X509CertificateParseDER(
- const std::vector<char>& der,
- ::ppapi::PPB_X509Certificate_Fields* fields) OVERRIDE;
- virtual FullscreenContainer* CreateFullscreenContainer(
- PepperPluginInstanceImpl* instance) OVERRIDE;
- virtual gfx::Size GetScreenSize() OVERRIDE;
- virtual std::string GetDefaultEncoding() OVERRIDE;
- virtual void ZoomLimitsChanged(double minimum_factor,
- double maximum_factor) OVERRIDE;
- virtual base::SharedMemory* CreateAnonymousSharedMemory(size_t size) OVERRIDE;
- virtual ::ppapi::Preferences GetPreferences() OVERRIDE;
virtual bool LockMouse(PepperPluginInstanceImpl* instance) OVERRIDE;
virtual void UnlockMouse(PepperPluginInstanceImpl* instance) OVERRIDE;
virtual bool IsMouseLocked(PepperPluginInstanceImpl* instance) OVERRIDE;
@@ -145,13 +75,6 @@ class MockPluginDelegate : public PluginDelegate {
virtual void DidReceiveMouseEvent(
PepperPluginInstanceImpl* instance) OVERRIDE;
virtual void SampleGamepads(WebKit::WebGamepads* data) OVERRIDE;
- virtual bool IsInFullscreenMode() OVERRIDE;
- virtual bool IsPageVisible() const OVERRIDE;
- virtual IPC::PlatformFileForTransit ShareHandleWithRemote(
- base::PlatformFile handle,
- base::ProcessId target_process_id,
- bool should_close_source) const OVERRIDE;
- virtual bool IsRunningInProcess(PP_Instance instance) const OVERRIDE;
virtual void HandleDocumentLoad(
PepperPluginInstanceImpl* instance,
const WebKit::WebURLResponse& response) OVERRIDE;
diff --git a/content/renderer/pepper/pepper_file_io_host.cc b/content/renderer/pepper/pepper_file_io_host.cc
index 74b4c3d..992aa0d 100644
--- a/content/renderer/pepper/pepper_file_io_host.cc
+++ b/content/renderer/pepper/pepper_file_io_host.cc
@@ -10,6 +10,7 @@
#include "base/command_line.h"
#include "base/files/file_util_proxy.h"
#include "content/child/child_thread.h"
+#include "content/child/fileapi/file_system_dispatcher.h"
#include "content/child/quota_dispatcher.h"
#include "content/common/fileapi/file_system_messages.h"
#include "content/public/common/content_client.h"
@@ -96,6 +97,44 @@ class QuotaFileIODelegate : public QuotaFileIO::Delegate {
}
};
+typedef base::Callback<
+ void (base::PlatformFileError error,
+ base::PassPlatformFile file,
+ quota::QuotaLimitType quota_policy,
+ const PepperFileIOHost::NotifyCloseFileCallback& close_file_callback)>
+ AsyncOpenFileSystemURLCallback;
+
+void DoNotifyCloseFile(int file_open_id, base::PlatformFileError error) {
+ ChildThread::current()->file_system_dispatcher()->NotifyCloseFile(
+ file_open_id);
+}
+
+void DidOpenFileSystemURL(const AsyncOpenFileSystemURLCallback& callback,
+ base::PlatformFile file,
+ int file_open_id,
+ quota::QuotaLimitType quota_policy) {
+ callback.Run(base::PLATFORM_FILE_OK,
+ base::PassPlatformFile(&file),
+ quota_policy,
+ base::Bind(&DoNotifyCloseFile, file_open_id));
+ // Make sure we won't leak file handle if the requester has died.
+ if (file != base::kInvalidPlatformFileValue) {
+ base::FileUtilProxy::Close(
+ RenderThreadImpl::current()->GetFileThreadMessageLoopProxy().get(),
+ file,
+ base::Bind(&DoNotifyCloseFile, file_open_id));
+ }
+}
+
+void DidFailOpenFileSystemURL(const AsyncOpenFileSystemURLCallback& callback,
+ base::PlatformFileError error_code) {
+ base::PlatformFile invalid_file = base::kInvalidPlatformFileValue;
+ callback.Run(error_code,
+ base::PassPlatformFile(&invalid_file),
+ quota::kQuotaLimitTypeUnknown,
+ PepperFileIOHost::NotifyCloseFileCallback());
+}
+
} // namespace
PepperFileIOHost::PepperFileIOHost(RendererPpapiHost* host,
@@ -184,12 +223,17 @@ int32_t PepperFileIOHost::OnHostMsgOpen(
PPB_FileRef_Impl* file_ref = static_cast<PPB_FileRef_Impl*>(file_ref_api);
if (file_ref->HasValidFileSystem()) {
file_system_url_ = file_ref->GetFileSystemURL();
- plugin_delegate_->AsyncOpenFileSystemURL(
- file_system_url_, flags,
- base::Bind(
- &PepperFileIOHost::ExecutePlatformOpenFileSystemURLCallback,
- weak_factory_.GetWeakPtr(),
- context->MakeReplyMessageContext()));
+
+ FileSystemDispatcher* file_system_dispatcher =
+ ChildThread::current()->file_system_dispatcher();
+ AsyncOpenFileSystemURLCallback callback = base::Bind(
+ &PepperFileIOHost::ExecutePlatformOpenFileSystemURLCallback,
+ weak_factory_.GetWeakPtr(),
+ context->MakeReplyMessageContext());
+ file_system_dispatcher->OpenFile(
+ file_system_url_, flags,
+ base::Bind(&DidOpenFileSystemURL, callback),
+ base::Bind(&DidFailOpenFileSystemURL, callback));
} else {
if (file_system_type_ != PP_FILESYSTEMTYPE_EXTERNAL)
return PP_ERROR_FAILED;
@@ -240,7 +284,9 @@ int32_t PepperFileIOHost::OnHostMsgTouch(
return PP_ERROR_FAILED;
if (file_system_type_ != PP_FILESYSTEMTYPE_EXTERNAL) {
- plugin_delegate_->Touch(
+ FileSystemDispatcher* file_system_dispatcher =
+ ChildThread::current()->file_system_dispatcher();
+ file_system_dispatcher->TouchFile(
file_system_url_,
PPTimeToTime(last_access_time),
PPTimeToTime(last_modified_time),
@@ -351,8 +397,10 @@ int32_t PepperFileIOHost::OnHostMsgSetLength(
return PP_ERROR_FAILED;
if (file_system_type_ != PP_FILESYSTEMTYPE_EXTERNAL) {
- plugin_delegate_->SetLength(
- file_system_url_, length,
+ FileSystemDispatcher* file_system_dispatcher =
+ ChildThread::current()->file_system_dispatcher();
+ file_system_dispatcher->Truncate(
+ file_system_url_, length, NULL,
base::Bind(&PepperFileIOHost::ExecutePlatformGeneralCallback,
weak_factory_.GetWeakPtr(),
context->MakeReplyMessageContext()));
@@ -538,7 +586,7 @@ void PepperFileIOHost::ExecutePlatformOpenFileSystemURLCallback(
base::PlatformFileError error_code,
base::PassPlatformFile file,
quota::QuotaLimitType quota_policy,
- const PluginDelegate::NotifyCloseFileCallback& callback) {
+ const PepperFileIOHost::NotifyCloseFileCallback& callback) {
if (error_code == base::PLATFORM_FILE_OK)
notify_close_file_callback_ = callback;
quota_policy_ = quota_policy;
diff --git a/content/renderer/pepper/pepper_file_io_host.h b/content/renderer/pepper/pepper_file_io_host.h
index 7efc0af..f23340c 100644
--- a/content/renderer/pepper/pepper_file_io_host.h
+++ b/content/renderer/pepper/pepper_file_io_host.h
@@ -9,22 +9,29 @@
#include <string>
#include "base/basictypes.h"
+#include "base/callback_forward.h"
#include "base/memory/weak_ptr.h"
+#include "base/platform_file.h"
#include "content/public/renderer/renderer_ppapi_host.h"
-#include "content/renderer/pepper/plugin_delegate.h"
#include "ppapi/host/host_message_context.h"
#include "ppapi/host/resource_host.h"
#include "ppapi/shared_impl/file_io_state_manager.h"
#include "ppapi/thunk/ppb_file_ref_api.h"
+#include "url/gurl.h"
+#include "webkit/common/quota/quota_types.h"
using ppapi::host::ReplyMessageContext;
namespace content {
+class PluginDelegate;
class QuotaFileIO;
class PepperFileIOHost : public ppapi::host::ResourceHost,
public base::SupportsWeakPtr<PepperFileIOHost> {
public:
+ typedef base::Callback<void (base::PlatformFileError)>
+ NotifyCloseFileCallback;
+
PepperFileIOHost(RendererPpapiHost* host,
PP_Instance instance,
PP_Resource resource);
@@ -79,7 +86,7 @@ class PepperFileIOHost : public ppapi::host::ResourceHost,
base::PlatformFileError error_code,
base::PassPlatformFile file,
quota::QuotaLimitType quota_policy,
- const PluginDelegate::NotifyCloseFileCallback& callback);
+ const NotifyCloseFileCallback& callback);
void ExecutePlatformQueryCallback(ReplyMessageContext reply_context,
base::PlatformFileError error_code,
const base::PlatformFileInfo& file_info);
@@ -107,7 +114,7 @@ class PepperFileIOHost : public ppapi::host::ResourceHost,
quota::QuotaLimitType quota_policy_;
// Callback function for notifying when the file handle is closed.
- PluginDelegate::NotifyCloseFileCallback notify_close_file_callback_;
+ NotifyCloseFileCallback notify_close_file_callback_;
// Pointer to a QuotaFileIO instance, which is valid only while a file
// of type PP_FILESYSTEMTYPE_LOCAL{PERSISTENT,TEMPORARY} is opened.
diff --git a/content/renderer/pepper/pepper_plugin_delegate_impl.cc b/content/renderer/pepper/pepper_plugin_delegate_impl.cc
index 7d6cc3d..b9c2f11 100644
--- a/content/renderer/pepper/pepper_plugin_delegate_impl.cc
+++ b/content/renderer/pepper/pepper_plugin_delegate_impl.cc
@@ -20,14 +20,11 @@
#include "base/sync_socket.h"
#include "base/time/time.h"
#include "content/child/child_process.h"
-#include "content/child/fileapi/file_system_dispatcher.h"
#include "content/child/npapi/webplugin.h"
#include "content/common/child_process_messages.h"
-#include "content/common/fileapi/file_system_messages.h"
#include "content/common/gpu/client/context_provider_command_buffer.h"
#include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
#include "content/common/pepper_messages.h"
-#include "content/common/sandbox_util.h"
#include "content/common/view_messages.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/context_menu_params.h"
@@ -64,12 +61,10 @@
#include "content/renderer/webplugin_delegate_proxy.h"
#include "ipc/ipc_channel_handle.h"
#include "ipc/ipc_platform_file.h"
-#include "media/base/audio_hardware_config.h"
#include "media/video/capture/video_capture_proxy.h"
#include "ppapi/c/dev/pp_video_dev.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/private/ppb_flash.h"
-#include "ppapi/host/ppapi_host.h"
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/proxy/url_loader_resource.h"
#include "ppapi/shared_impl/api_id.h"
@@ -120,39 +115,6 @@ class PluginInstanceLockTarget : public MouseLockDispatcher::LockTarget {
PepperPluginInstanceImpl* plugin_;
};
-void DoNotifyCloseFile(int file_open_id, base::PlatformFileError /* unused */) {
- ChildThread::current()->file_system_dispatcher()->NotifyCloseFile(
- file_open_id);
-}
-
-void DidOpenFileSystemURL(
- const PluginDelegate::AsyncOpenFileSystemURLCallback& callback,
- base::PlatformFile file,
- int file_open_id,
- quota::QuotaLimitType quota_policy) {
- callback.Run(base::PLATFORM_FILE_OK,
- base::PassPlatformFile(&file),
- quota_policy,
- base::Bind(&DoNotifyCloseFile, file_open_id));
- // Make sure we won't leak file handle if the requester has died.
- if (file != base::kInvalidPlatformFileValue) {
- base::FileUtilProxy::Close(
- RenderThreadImpl::current()->GetFileThreadMessageLoopProxy().get(),
- file,
- base::Bind(&DoNotifyCloseFile, file_open_id));
- }
-}
-
-void DidFailOpenFileSystemURL(
- const PluginDelegate::AsyncOpenFileSystemURLCallback& callback,
- base::PlatformFileError error_code) {
- base::PlatformFile invalid_file = base::kInvalidPlatformFileValue;
- callback.Run(error_code,
- base::PassPlatformFile(&invalid_file),
- quota::kQuotaLimitTypeUnknown,
- PluginDelegate::NotifyCloseFileCallback());
-}
-
void CreateHostForInProcessModule(RenderViewImpl* render_view,
PluginModule* module,
const WebPluginInfo& webplugin_info) {
@@ -172,15 +134,6 @@ void CreateHostForInProcessModule(RenderViewImpl* render_view,
} // namespace
-ppapi::host::ResourceHost* PepperPluginDelegateImpl::GetRendererResourceHost(
- PP_Instance instance, PP_Resource resource) {
- const ppapi::host::PpapiHost* ppapi_host =
- RendererPpapiHost::GetForPPInstance(instance)->GetPpapiHost();
- if (!resource || !ppapi_host)
- return NULL;
- return ppapi_host->GetResourceHost(resource);
-}
-
PepperPluginDelegateImpl::PepperPluginDelegateImpl(RenderViewImpl* render_view)
: RenderViewObserver(render_view),
render_view_(render_view),
@@ -220,7 +173,7 @@ scoped_refptr<PluginModule> PepperPluginDelegateImpl::CreatePepperPluginModule(
scoped_refptr<PluginModule> module =
PepperPluginRegistry::GetInstance()->GetLiveModule(path);
if (module.get()) {
- if (!module->GetEmbedderState()) {
+ if (!module->renderer_ppapi_host()) {
// If the module exists and no embedder state was associated with it,
// then the module was one of the ones preloaded and is an in-process
// plugin. We need to associate our host state with it.
@@ -312,7 +265,7 @@ RendererPpapiHost* PepperPluginDelegateImpl::CreateOutOfProcessModule(
if (!dispatcher->Init(
channel_handle,
PluginModule::GetLocalGetInterfaceFunc(),
- GetPreferences(),
+ ppapi::Preferences(render_view_->webkit_preferences()),
hung_filter.get()))
return NULL;
@@ -468,23 +421,6 @@ void PepperPluginDelegateImpl::PluginSelectionChanged(
render_view_->PpapiPluginSelectionChanged();
}
-void PepperPluginDelegateImpl::SimulateImeSetComposition(
- const string16& text,
- const std::vector<WebKit::WebCompositionUnderline>& underlines,
- int selection_start,
- int selection_end) {
- if (render_view_) {
- render_view_->SimulateImeSetComposition(
- text, underlines, selection_start, selection_end);
- }
-}
-
-void PepperPluginDelegateImpl::SimulateImeConfirmComposition(
- const string16& text) {
- if (render_view_)
- render_view_->SimulateImeConfirmComposition(text, ui::Range());
-}
-
void PepperPluginDelegateImpl::OnImeSetComposition(
const string16& text,
const std::vector<WebKit::WebCompositionUnderline>& underlines,
@@ -599,46 +535,6 @@ void PepperPluginDelegateImpl::InstanceDeleted(
PluginFocusChanged(instance, false);
}
-scoped_ptr< ::ppapi::thunk::ResourceCreationAPI>
-PepperPluginDelegateImpl::CreateResourceCreationAPI(
- PepperPluginInstanceImpl* instance) {
- RendererPpapiHostImpl* host_impl = static_cast<RendererPpapiHostImpl*>(
- instance->module()->GetEmbedderState());
- return host_impl->CreateInProcessResourceCreationAPI(instance);
-}
-
-SkBitmap* PepperPluginDelegateImpl::GetSadPluginBitmap() {
- return GetContentClient()->renderer()->GetSadPluginBitmap();
-}
-
-WebKit::WebPlugin* PepperPluginDelegateImpl::CreatePluginReplacement(
- const base::FilePath& file_path) {
- return GetContentClient()->renderer()->CreatePluginReplacement(
- render_view_, file_path);
-}
-
-void PepperPluginDelegateImpl::NumberOfFindResultsChanged(int identifier,
- int total,
- bool final_result) {
- render_view_->reportFindInPageMatchCount(identifier, total, final_result);
-}
-
-void PepperPluginDelegateImpl::SelectedFindResultChanged(int identifier,
- int index) {
- render_view_->reportFindInPageSelection(
- identifier, index + 1, WebKit::WebRect());
-}
-
-uint32_t PepperPluginDelegateImpl::GetAudioHardwareOutputSampleRate() {
- RenderThreadImpl* thread = RenderThreadImpl::current();
- return thread->GetAudioHardwareConfig()->GetOutputSampleRate();
-}
-
-uint32_t PepperPluginDelegateImpl::GetAudioHardwareOutputBufferSize() {
- RenderThreadImpl* thread = RenderThreadImpl::current();
- return thread->GetAudioHardwareConfig()->GetOutputBufferSize();
-}
-
// If a broker has not already been created for this plugin, creates one.
PepperBroker* PepperPluginDelegateImpl::ConnectToBroker(
PPB_Broker_Impl* client) {
@@ -746,127 +642,6 @@ void PepperPluginDelegateImpl::WillHandleMouseEvent() {
last_mouse_event_target_ = NULL;
}
-bool PepperPluginDelegateImpl::IsFileSystemOpened(PP_Instance instance,
- PP_Resource resource) const {
- ppapi::host::ResourceHost* host = GetRendererResourceHost(instance, resource);
- if (!host)
- return false;
- PepperFileSystemHost* fs_host = host->AsPepperFileSystemHost();
- return fs_host && fs_host->IsOpened();
-}
-
-PP_FileSystemType PepperPluginDelegateImpl::GetFileSystemType(
- PP_Instance instance, PP_Resource resource) const {
- ppapi::host::ResourceHost* host = GetRendererResourceHost(instance, resource);
- if (!host)
- return PP_FILESYSTEMTYPE_INVALID;
- PepperFileSystemHost* fs_host = host->AsPepperFileSystemHost();
- return fs_host ? fs_host->GetType() : PP_FILESYSTEMTYPE_INVALID;
-}
-
-GURL PepperPluginDelegateImpl::GetFileSystemRootUrl(
- PP_Instance instance, PP_Resource resource) const {
- ppapi::host::ResourceHost* host = GetRendererResourceHost(instance, resource);
- if (!host)
- return GURL();
- PepperFileSystemHost* fs_host = host->AsPepperFileSystemHost();
- return fs_host ? fs_host->GetRootUrl() : GURL();
-}
-
-void PepperPluginDelegateImpl::MakeDirectory(
- const GURL& path,
- bool recursive,
- const StatusCallback& callback) {
- FileSystemDispatcher* file_system_dispatcher =
- ChildThread::current()->file_system_dispatcher();
- file_system_dispatcher->CreateDirectory(
- path, false /* exclusive */, recursive, callback);
-}
-
-void PepperPluginDelegateImpl::Query(
- const GURL& path,
- const MetadataCallback& success_callback,
- const StatusCallback& error_callback) {
- FileSystemDispatcher* file_system_dispatcher =
- ChildThread::current()->file_system_dispatcher();
- file_system_dispatcher->ReadMetadata(
- path, success_callback, error_callback);
-}
-
-void PepperPluginDelegateImpl::ReadDirectoryEntries(
- const GURL& path,
- const ReadDirectoryCallback& success_callback,
- const StatusCallback& error_callback) {
- FileSystemDispatcher* file_system_dispatcher =
- ChildThread::current()->file_system_dispatcher();
- file_system_dispatcher->ReadDirectory(
- path, success_callback, error_callback);
-}
-
-void PepperPluginDelegateImpl::Touch(
- const GURL& path,
- const base::Time& last_access_time,
- const base::Time& last_modified_time,
- const StatusCallback& callback) {
- FileSystemDispatcher* file_system_dispatcher =
- ChildThread::current()->file_system_dispatcher();
- file_system_dispatcher->TouchFile(path, last_access_time, last_modified_time,
- callback);
-}
-
-void PepperPluginDelegateImpl::SetLength(
- const GURL& path,
- int64_t length,
- const StatusCallback& callback) {
- FileSystemDispatcher* file_system_dispatcher =
- ChildThread::current()->file_system_dispatcher();
- file_system_dispatcher->Truncate(path, length, NULL, callback);
-}
-
-void PepperPluginDelegateImpl::Delete(
- const GURL& path,
- const StatusCallback& callback) {
- FileSystemDispatcher* file_system_dispatcher =
- ChildThread::current()->file_system_dispatcher();
- file_system_dispatcher->Remove(path, false /* recursive */, callback);
-}
-
-void PepperPluginDelegateImpl::Rename(
- const GURL& file_path,
- const GURL& new_file_path,
- const StatusCallback& callback) {
- FileSystemDispatcher* file_system_dispatcher =
- ChildThread::current()->file_system_dispatcher();
- file_system_dispatcher->Move(file_path, new_file_path, callback);
-}
-
-void PepperPluginDelegateImpl::ReadDirectory(
- const GURL& directory_path,
- const ReadDirectoryCallback& success_callback,
- const StatusCallback& error_callback) {
- FileSystemDispatcher* file_system_dispatcher =
- ChildThread::current()->file_system_dispatcher();
- file_system_dispatcher->ReadDirectory(
- directory_path, success_callback, error_callback);
-}
-
-void PepperPluginDelegateImpl::AsyncOpenFileSystemURL(
- const GURL& path,
- int flags,
- const AsyncOpenFileSystemURLCallback& callback) {
- FileSystemDispatcher* file_system_dispatcher =
- ChildThread::current()->file_system_dispatcher();
- file_system_dispatcher->OpenFile(
- path, flags,
- base::Bind(&DidOpenFileSystemURL, callback),
- base::Bind(&DidFailOpenFileSystemURL, callback));
-}
-
-void PepperPluginDelegateImpl::SyncGetFileSystemPlatformPath(
- const GURL& url, base::FilePath* platform_path) {
- Send(new FileSystemHostMsg_SyncGetPlatformPath(url, platform_path));
-}
-
scoped_refptr<base::MessageLoopProxy>
PepperPluginDelegateImpl::GetFileThreadMessageLoopProxy() {
return RenderThreadImpl::current()->GetFileThreadMessageLoopProxy();
@@ -969,43 +744,13 @@ void PepperPluginDelegateImpl::TCPServerSocketStopListening(
}
}
-bool PepperPluginDelegateImpl::X509CertificateParseDER(
- const std::vector<char>& der,
- ppapi::PPB_X509Certificate_Fields* fields) {
- bool succeeded = false;
- Send(new PpapiHostMsg_PPBX509Certificate_ParseDER(der, &succeeded, fields));
- return succeeded;
-}
-
-FullscreenContainer* PepperPluginDelegateImpl::CreateFullscreenContainer(
- PepperPluginInstanceImpl* instance) {
- return render_view_->CreatePepperFullscreenContainer(instance);
-}
-
-gfx::Size PepperPluginDelegateImpl::GetScreenSize() {
- WebKit::WebScreenInfo info = render_view_->screenInfo();
- return gfx::Size(info.rect.width, info.rect.height);
-}
-
-std::string PepperPluginDelegateImpl::GetDefaultEncoding() {
- return render_view_->webkit_preferences().default_encoding;
-}
-
-void PepperPluginDelegateImpl::ZoomLimitsChanged(double minimum_factor,
- double maximum_factor) {
- double minimum_level = ZoomFactorToZoomLevel(minimum_factor);
- double maximum_level = ZoomFactorToZoomLevel(maximum_factor);
- render_view_->webview()->zoomLimitsChanged(minimum_level, maximum_level);
-}
-
void PepperPluginDelegateImpl::HandleDocumentLoad(
PepperPluginInstanceImpl* instance,
const WebKit::WebURLResponse& response) {
DCHECK(!instance->document_loader());
PP_Instance pp_instance = instance->pp_instance();
- RendererPpapiHostImpl* host_impl = static_cast<RendererPpapiHostImpl*>(
- instance->module()->GetEmbedderState());
+ RendererPpapiHostImpl* host_impl = instance->module()->renderer_ppapi_host();
// Create a loader resource host for this load. Note that we have to set
// the document_loader before issuing the in-process
@@ -1074,15 +819,6 @@ RendererPpapiHost* PepperPluginDelegateImpl::CreateExternalPluginModule(
true); // is_external = true
}
-base::SharedMemory* PepperPluginDelegateImpl::CreateAnonymousSharedMemory(
- size_t size) {
- return RenderThread::Get()->HostAllocateSharedMemoryBuffer(size).release();
-}
-
-ppapi::Preferences PepperPluginDelegateImpl::GetPreferences() {
- return ppapi::Preferences(render_view_->webkit_preferences());
-}
-
bool PepperPluginDelegateImpl::LockMouse(PepperPluginInstanceImpl* instance) {
return GetMouseLockDispatcher(instance)->LockMouse(
GetOrCreateLockTargetAdapter(instance));
@@ -1116,20 +852,12 @@ void PepperPluginDelegateImpl::DidReceiveMouseEvent(
last_mouse_event_target_ = instance;
}
-bool PepperPluginDelegateImpl::IsInFullscreenMode() {
- return render_view_->is_fullscreen();
-}
-
void PepperPluginDelegateImpl::SampleGamepads(WebKit::WebGamepads* data) {
if (!gamepad_shared_memory_reader_)
gamepad_shared_memory_reader_.reset(new GamepadSharedMemoryReader);
gamepad_shared_memory_reader_->SampleGamepads(*data);
}
-bool PepperPluginDelegateImpl::IsPageVisible() const {
- return !render_view_->is_hidden();
-}
-
bool PepperPluginDelegateImpl::OnMessageReceived(const IPC::Message& message) {
if (pepper_browser_connection_.OnMessageReceived(message))
return true;
@@ -1290,20 +1018,4 @@ MouseLockDispatcher* PepperPluginDelegateImpl::GetMouseLockDispatcher(
}
}
-IPC::PlatformFileForTransit PepperPluginDelegateImpl::ShareHandleWithRemote(
- base::PlatformFile handle,
- base::ProcessId target_process_id,
- bool should_close_source) const {
- return BrokerGetFileHandleForProcess(
- handle,
- target_process_id,
- should_close_source);
-}
-
-bool PepperPluginDelegateImpl::IsRunningInProcess(PP_Instance instance) const {
- RendererPpapiHostImpl* host =
- RendererPpapiHostImpl::GetForPPInstance(instance);
- return host && host->IsRunningInProcess();
-}
-
} // namespace content
diff --git a/content/renderer/pepper/pepper_plugin_delegate_impl.h b/content/renderer/pepper/pepper_plugin_delegate_impl.h
index 3128502..d34aa94 100644
--- a/content/renderer/pepper/pepper_plugin_delegate_impl.h
+++ b/content/renderer/pepper/pepper_plugin_delegate_impl.h
@@ -58,9 +58,6 @@ class PepperPluginDelegateImpl
public base::SupportsWeakPtr<PepperPluginDelegateImpl>,
public RenderViewObserver {
public:
- static ppapi::host::ResourceHost* GetRendererResourceHost(
- PP_Instance instance, PP_Resource resource);
-
explicit PepperPluginDelegateImpl(RenderViewImpl* render_view);
virtual ~PepperPluginDelegateImpl();
@@ -123,75 +120,12 @@ class PepperPluginDelegateImpl
PepperPluginInstanceImpl* instance) OVERRIDE;
virtual void PluginSelectionChanged(
PepperPluginInstanceImpl* instance) OVERRIDE;
- virtual void SimulateImeSetComposition(
- const string16& text,
- const std::vector<WebKit::WebCompositionUnderline>& underlines,
- int selection_start,
- int selection_end) OVERRIDE;
- virtual void SimulateImeConfirmComposition(const string16& text) OVERRIDE;
virtual void PluginCrashed(PepperPluginInstanceImpl* instance) OVERRIDE;
virtual void InstanceCreated(PepperPluginInstanceImpl* instance) OVERRIDE;
virtual void InstanceDeleted(PepperPluginInstanceImpl* instance) OVERRIDE;
- virtual scoped_ptr< ::ppapi::thunk::ResourceCreationAPI>
- CreateResourceCreationAPI(PepperPluginInstanceImpl* instance) OVERRIDE;
- virtual SkBitmap* GetSadPluginBitmap() OVERRIDE;
- virtual WebKit::WebPlugin* CreatePluginReplacement(
- const base::FilePath& file_path) OVERRIDE;
- virtual uint32_t GetAudioHardwareOutputSampleRate() OVERRIDE;
- virtual uint32_t GetAudioHardwareOutputBufferSize() OVERRIDE;
- virtual void NumberOfFindResultsChanged(int identifier,
- int total,
- bool final_result) OVERRIDE;
- virtual void SelectedFindResultChanged(int identifier, int index) OVERRIDE;
virtual bool AsyncOpenFile(const base::FilePath& path,
int flags,
const AsyncOpenFileCallback& callback) OVERRIDE;
- virtual void AsyncOpenFileSystemURL(
- const GURL& path,
- int flags,
- const AsyncOpenFileSystemURLCallback& callback) OVERRIDE;
- virtual bool IsFileSystemOpened(PP_Instance instance,
- PP_Resource resource) const OVERRIDE;
- virtual PP_FileSystemType GetFileSystemType(
- PP_Instance instance,
- PP_Resource resource) const OVERRIDE;
- virtual GURL GetFileSystemRootUrl(PP_Instance instance,
- PP_Resource resource) const OVERRIDE;
- virtual void MakeDirectory(
- const GURL& path,
- bool recursive,
- const StatusCallback& callback) OVERRIDE;
- virtual void Query(
- const GURL& path,
- const MetadataCallback& success_callback,
- const StatusCallback& error_callback) OVERRIDE;
- virtual void ReadDirectoryEntries(
- const GURL& path,
- const ReadDirectoryCallback& success_callback,
- const StatusCallback& error_callback) OVERRIDE;
- virtual void Touch(
- const GURL& path,
- const base::Time& last_access_time,
- const base::Time& last_modified_time,
- const StatusCallback& callback) OVERRIDE;
- virtual void SetLength(
- const GURL& path,
- int64_t length,
- const StatusCallback& callback) OVERRIDE;
- virtual void Delete(
- const GURL& path,
- const StatusCallback& callback) OVERRIDE;
- virtual void Rename(
- const GURL& file_path,
- const GURL& new_file_path,
- const StatusCallback& callback) OVERRIDE;
- virtual void ReadDirectory(
- const GURL& directory_path,
- const ReadDirectoryCallback& success_callback,
- const StatusCallback& error_callback) OVERRIDE;
- virtual void SyncGetFileSystemPlatformPath(
- const GURL& url,
- base::FilePath* platform_path) OVERRIDE;
virtual scoped_refptr<base::MessageLoopProxy>
GetFileThreadMessageLoopProxy() OVERRIDE;
virtual uint32 TCPSocketCreate() OVERRIDE;
@@ -227,18 +161,6 @@ class PepperPluginDelegateImpl
virtual void TCPServerSocketStopListening(
PP_Resource socket_resource,
uint32 socket_id) OVERRIDE;
- virtual bool X509CertificateParseDER(
- const std::vector<char>& der,
- ppapi::PPB_X509Certificate_Fields* fields) OVERRIDE;
- virtual FullscreenContainer* CreateFullscreenContainer(
- PepperPluginInstanceImpl* instance) OVERRIDE;
- virtual gfx::Size GetScreenSize() OVERRIDE;
- virtual std::string GetDefaultEncoding() OVERRIDE;
- virtual void ZoomLimitsChanged(double minimum_factor, double maximum_factor)
- OVERRIDE;
- virtual base::SharedMemory* CreateAnonymousSharedMemory(size_t size)
- OVERRIDE;
- virtual ::ppapi::Preferences GetPreferences() OVERRIDE;
virtual bool LockMouse(PepperPluginInstanceImpl* instance) OVERRIDE;
virtual void UnlockMouse(PepperPluginInstanceImpl* instance) OVERRIDE;
virtual bool IsMouseLocked(PepperPluginInstanceImpl* instance) OVERRIDE;
@@ -246,9 +168,7 @@ class PepperPluginDelegateImpl
const WebKit::WebCursorInfo& cursor) OVERRIDE;
virtual void DidReceiveMouseEvent(
PepperPluginInstanceImpl* instance) OVERRIDE;
- virtual bool IsInFullscreenMode() OVERRIDE;
virtual void SampleGamepads(WebKit::WebGamepads* data) OVERRIDE;
- virtual bool IsPageVisible() const OVERRIDE;
virtual void HandleDocumentLoad(
PepperPluginInstanceImpl* instance,
const WebKit::WebURLResponse& response) OVERRIDE;
@@ -336,14 +256,6 @@ class PepperPluginDelegateImpl
MouseLockDispatcher* GetMouseLockDispatcher(
PepperPluginInstanceImpl* instance);
- // Share a given handle with the target process.
- virtual IPC::PlatformFileForTransit ShareHandleWithRemote(
- base::PlatformFile handle,
- base::ProcessId target_process_id,
- bool should_close_source) const OVERRIDE;
-
- virtual bool IsRunningInProcess(PP_Instance instance) const OVERRIDE;
-
// Pointer to the RenderView that owns us.
RenderViewImpl* render_view_;
diff --git a/content/renderer/pepper/pepper_plugin_instance_impl.cc b/content/renderer/pepper/pepper_plugin_instance_impl.cc
index 61b5419..44821ea 100644
--- a/content/renderer/pepper/pepper_plugin_instance_impl.cc
+++ b/content/renderer/pepper/pepper_plugin_instance_impl.cc
@@ -17,6 +17,7 @@
#include "base/time/time.h"
#include "cc/layers/texture_layer.h"
#include "content/public/common/page_zoom.h"
+#include "content/public/renderer/content_renderer_client.h"
#include "content/renderer/pepper/common.h"
#include "content/renderer/pepper/content_decryptor_delegate.h"
#include "content/renderer/pepper/event_conversion.h"
@@ -35,7 +36,12 @@
#include "content/renderer/pepper/ppb_graphics_3d_impl.h"
#include "content/renderer/pepper/ppb_image_data_impl.h"
#include "content/renderer/pepper/ppp_pdf.h"
+#include "content/renderer/pepper/renderer_ppapi_host_impl.h"
#include "content/renderer/pepper/url_request_info_util.h"
+#include "content/renderer/render_thread_impl.h"
+#include "content/renderer/render_view_impl.h"
+#include "content/renderer/render_widget_fullscreen_pepper.h"
+#include "media/base/audio_hardware_config.h"
#include "ppapi/c/dev/ppb_find_dev.h"
#include "ppapi/c/dev/ppb_zoom_dev.h"
#include "ppapi/c/dev/ppp_find_dev.h"
@@ -51,6 +57,7 @@
#include "ppapi/c/ppp_messaging.h"
#include "ppapi/c/ppp_mouse_lock.h"
#include "ppapi/c/private/ppp_instance_private.h"
+#include "ppapi/host/ppapi_host.h"
#include "ppapi/shared_impl/ppapi_permissions.h"
#include "ppapi/shared_impl/ppapi_preferences.h"
#include "ppapi/shared_impl/ppb_gamepad_shared.h"
@@ -322,7 +329,7 @@ scoped_ptr<const char*[]> StringVectorToArgArray(
// static
PepperPluginInstanceImpl* PepperPluginInstanceImpl::Create(
PluginDelegate* delegate,
- RenderView* render_view,
+ RenderViewImpl* render_view,
PluginModule* module,
WebPluginContainer* container,
const GURL& plugin_url) {
@@ -405,7 +412,7 @@ void PepperPluginInstanceImpl::GamepadImpl::Sample(
PepperPluginInstanceImpl::PepperPluginInstanceImpl(
PluginDelegate* delegate,
- RenderView* render_view,
+ RenderViewImpl* render_view,
PluginModule* module,
::ppapi::PPP_Instance_Combined* instance_interface,
WebPluginContainer* container,
@@ -465,8 +472,11 @@ PepperPluginInstanceImpl::PepperPluginInstanceImpl(
module_->InstanceCreated(this);
delegate_->InstanceCreated(this);
- view_data_.is_page_visible = delegate->IsPageVisible();
- resource_creation_ = delegate_->CreateResourceCreationAPI(this);
+ if (render_view) // NULL in tests
+ view_data_.is_page_visible = !render_view->is_hidden();
+
+ RendererPpapiHostImpl* host_impl = module_->renderer_ppapi_host();
+ resource_creation_ = host_impl->CreateInProcessResourceCreationAPI(this);
// TODO(bbudge) remove this when the trusted NaCl plugin has been removed.
// We must defer certain plugin events for NaCl instances since we switch
@@ -549,7 +559,7 @@ void PepperPluginInstanceImpl::Paint(WebCanvas* canvas,
if (module()->is_crashed()) {
// Crashed plugin painting.
if (!sad_plugin_) // Lazily initialize bitmap.
- sad_plugin_ = delegate_->GetSadPluginBitmap();
+ sad_plugin_ = GetContentClient()->renderer()->GetSadPluginBitmap();
if (sad_plugin_)
webkit::PaintSadPlugin(canvas, plugin_rect, *sad_plugin_);
return;
@@ -654,7 +664,8 @@ bool PepperPluginInstanceImpl::Initialize(
UpdateTouchEventRequest();
container_->setWantsWheelEvents(IsAcceptingWheelEvents());
- SetGPUHistogram(delegate_->GetPreferences(), arg_names, arg_values);
+ SetGPUHistogram(ppapi::Preferences(render_view_->webkit_preferences()),
+ arg_names, arg_values);
argn_ = arg_names;
argv_ = arg_values;
@@ -951,7 +962,7 @@ void PepperPluginInstanceImpl::ViewChanged(
WebDocument document = element.document();
bool is_fullscreen_element = (element == document.fullScreenElement());
if (!view_data_.is_fullscreen && desired_fullscreen_state_ &&
- delegate()->IsInFullscreenMode() && is_fullscreen_element) {
+ render_view_->is_fullscreen() && is_fullscreen_element) {
// Entered fullscreen. Only possible via SetFullscreen().
view_data_.is_fullscreen = true;
} else if (view_data_.is_fullscreen && !is_fullscreen_element) {
@@ -1824,8 +1835,8 @@ bool PepperPluginInstanceImpl::SimulateIMEEvent(
SimulateImeSetCompositionEvent(input_event);
break;
case PP_INPUTEVENT_TYPE_IME_TEXT:
- delegate()->SimulateImeConfirmComposition(
- UTF8ToUTF16(input_event.character_text));
+ render_view_->SimulateImeConfirmComposition(
+ UTF8ToUTF16(input_event.character_text), ui::Range());
break;
default:
return false;
@@ -1855,7 +1866,7 @@ void PepperPluginInstanceImpl::SimulateImeSetCompositionEvent(
underlines.push_back(underline);
}
- delegate()->SimulateImeSetComposition(
+ render_view_->SimulateImeSetComposition(
utf16_text, underlines, offsets[0], offsets[1]);
}
@@ -1904,8 +1915,9 @@ PP_Bool PepperPluginInstanceImpl::BindGraphics(PP_Instance instance,
desired_fullscreen_state_ != view_data_.is_fullscreen)
return PP_FALSE;
- ppapi::host::ResourceHost* host =
- PepperPluginDelegateImpl::GetRendererResourceHost(pp_instance(), device);
+ const ppapi::host::PpapiHost* ppapi_host =
+ RendererPpapiHost::GetForPPInstance(instance)->GetPpapiHost();
+ ppapi::host::ResourceHost* host = ppapi_host->GetResourceHost(device);
PepperGraphics2DHost* graphics_2d = NULL;
if (host) {
graphics_2d = host->AsPepperGraphics2DHost();
@@ -2019,17 +2031,19 @@ PP_Var PepperPluginInstanceImpl::ExecuteScript(PP_Instance instance,
uint32_t PepperPluginInstanceImpl::GetAudioHardwareOutputSampleRate(
PP_Instance instance) {
- return delegate()->GetAudioHardwareOutputSampleRate();
+ RenderThreadImpl* thread = RenderThreadImpl::current();
+ return thread->GetAudioHardwareConfig()->GetOutputSampleRate();
}
uint32_t PepperPluginInstanceImpl::GetAudioHardwareOutputBufferSize(
PP_Instance instance) {
- return delegate()->GetAudioHardwareOutputBufferSize();
+ RenderThreadImpl* thread = RenderThreadImpl::current();
+ return thread->GetAudioHardwareConfig()->GetOutputBufferSize();
}
PP_Var PepperPluginInstanceImpl::GetDefaultCharSet(PP_Instance instance) {
- std::string encoding = delegate()->GetDefaultEncoding();
- return StringVar::StringToPPVar(encoding);
+ return StringVar::StringToPPVar(
+ render_view_->webkit_preferences().default_encoding);
}
// These PPB_ContentDecryptor_Private calls are responses to
@@ -2119,14 +2133,15 @@ void PepperPluginInstanceImpl::NumberOfFindResultsChanged(
int32_t total,
PP_Bool final_result) {
DCHECK_NE(find_identifier_, -1);
- delegate_->NumberOfFindResultsChanged(find_identifier_, total,
- PP_ToBool(final_result));
+ render_view_->reportFindInPageMatchCount(
+ find_identifier_, total, PP_ToBool(final_result));
}
void PepperPluginInstanceImpl::SelectedFindResultChanged(PP_Instance instance,
int32_t index) {
DCHECK_NE(find_identifier_, -1);
- delegate_->SelectedFindResultChanged(find_identifier_, index);
+ render_view_->reportFindInPageSelection(
+ find_identifier_, index + 1, WebKit::WebRect());
}
PP_Bool PepperPluginInstanceImpl::IsFullscreen(PP_Instance instance) {
@@ -2140,8 +2155,8 @@ PP_Bool PepperPluginInstanceImpl::SetFullscreen(PP_Instance instance,
PP_Bool PepperPluginInstanceImpl::GetScreenSize(PP_Instance instance,
PP_Size* size) {
- gfx::Size screen_size = delegate()->GetScreenSize();
- *size = PP_MakeSize(screen_size.width(), screen_size.height());
+ WebKit::WebScreenInfo info = render_view_->screenInfo();
+ *size = PP_MakeSize(info.rect.width, info.rect.height);
return PP_TRUE;
}
@@ -2206,12 +2221,14 @@ void PepperPluginInstanceImpl::ZoomChanged(PP_Instance instance,
void PepperPluginInstanceImpl::ZoomLimitsChanged(PP_Instance instance,
double minimum_factor,
- double maximium_factor) {
- if (minimum_factor > maximium_factor) {
+ double maximum_factor) {
+ if (minimum_factor > maximum_factor) {
NOTREACHED();
return;
}
- delegate()->ZoomLimitsChanged(minimum_factor, maximium_factor);
+ double minimum_level = ZoomFactorToZoomLevel(minimum_factor);
+ double maximum_level = ZoomFactorToZoomLevel(maximum_factor);
+ render_view_->webview()->zoomLimitsChanged(minimum_level, maximum_level);
}
void PepperPluginInstanceImpl::PostMessage(PP_Instance instance,
@@ -2614,7 +2631,7 @@ void PepperPluginInstanceImpl::FlashSetFullscreen(bool fullscreen,
VLOG(1) << "Setting fullscreen to " << (fullscreen ? "on" : "off");
if (fullscreen) {
DCHECK(!fullscreen_container_);
- fullscreen_container_ = delegate_->CreateFullscreenContainer(this);
+ fullscreen_container_ = render_view_->CreatePepperFullscreenContainer(this);
UpdateLayer();
} else {
DCHECK(fullscreen_container_);
@@ -2711,7 +2728,8 @@ void PepperPluginInstanceImpl::KeepSizeAttributesBeforeFullscreen() {
}
void PepperPluginInstanceImpl::SetSizeAttributesForFullscreen() {
- screen_size_for_fullscreen_ = delegate()->GetScreenSize();
+ WebKit::WebScreenInfo info = render_view_->screenInfo();
+ screen_size_for_fullscreen_ = gfx::Size(info.rect.width, info.rect.height);
std::string width = StringPrintf("%d", screen_size_for_fullscreen_.width());
std::string height = StringPrintf("%d", screen_size_for_fullscreen_.height());
diff --git a/content/renderer/pepper/pepper_plugin_instance_impl.h b/content/renderer/pepper/pepper_plugin_instance_impl.h
index d7a061b..43b363d 100644
--- a/content/renderer/pepper/pepper_plugin_instance_impl.h
+++ b/content/renderer/pepper/pepper_plugin_instance_impl.h
@@ -105,6 +105,7 @@ class PluginObject;
class PPB_Graphics3D_Impl;
class PPB_ImageData_Impl;
class PPB_URLLoader_Impl;
+class RenderViewImpl;
// Represents one time a plugin appears on one web page.
//
@@ -122,11 +123,12 @@ class CONTENT_EXPORT PepperPluginInstanceImpl
// PPP_Instance interface, returns NULL.
static PepperPluginInstanceImpl* Create(
PluginDelegate* delegate,
- RenderView* render_view,
+ RenderViewImpl* render_view,
PluginModule* module,
WebKit::WebPluginContainer* container,
const GURL& plugin_url);
PluginDelegate* delegate() const { return delegate_; }
+ RenderViewImpl* render_view() const { return render_view_; }
PluginModule* module() const { return module_.get(); }
MessageChannel& message_channel() { return *message_channel_; }
@@ -407,7 +409,7 @@ class CONTENT_EXPORT PepperPluginInstanceImpl
virtual void ZoomChanged(PP_Instance instance, double factor) OVERRIDE;
virtual void ZoomLimitsChanged(PP_Instance instance,
double minimum_factor,
- double maximium_factor) OVERRIDE;
+ double maximum_factor) OVERRIDE;
virtual void PostMessage(PP_Instance instance, PP_Var message) OVERRIDE;
virtual PP_Bool SetCursor(PP_Instance instance,
PP_MouseCursor_Type type,
@@ -553,7 +555,7 @@ class CONTENT_EXPORT PepperPluginInstanceImpl
// PPP_Instance_Combined details while still having 1 constructor to maintain
// for member initialization.
PepperPluginInstanceImpl(PluginDelegate* delegate,
- RenderView* render_view,
+ RenderViewImpl* render_view,
PluginModule* module,
::ppapi::PPP_Instance_Combined* instance_interface,
WebKit::WebPluginContainer* container,
@@ -639,7 +641,7 @@ class CONTENT_EXPORT PepperPluginInstanceImpl
void ResetSizeAttributesAfterFullscreen();
PluginDelegate* delegate_;
- RenderView* render_view_;
+ RenderViewImpl* render_view_;
scoped_refptr<PluginModule> module_;
scoped_ptr< ::ppapi::PPP_Instance_Combined> instance_interface_;
// If this is the NaCl plugin, we create a new module when we switch to the
diff --git a/content/renderer/pepper/pepper_webplugin_impl.cc b/content/renderer/pepper/pepper_webplugin_impl.cc
index e32ae38..11e9fc1 100644
--- a/content/renderer/pepper/pepper_webplugin_impl.cc
+++ b/content/renderer/pepper/pepper_webplugin_impl.cc
@@ -9,10 +9,12 @@
#include "base/debug/crash_logging.h"
#include "base/message_loop/message_loop.h"
#include "content/public/common/page_zoom.h"
+#include "content/public/renderer/content_renderer_client.h"
#include "content/renderer/pepper/message_channel.h"
#include "content/renderer/pepper/npobject_var.h"
#include "content/renderer/pepper/pepper_plugin_instance_impl.h"
#include "content/renderer/pepper/plugin_module.h"
+#include "content/renderer/render_view_impl.h"
#include "ppapi/shared_impl/ppapi_globals.h"
#include "ppapi/shared_impl/var_tracker.h"
#include "third_party/WebKit/public/platform/WebPoint.h"
@@ -47,7 +49,7 @@ namespace content {
struct PepperWebPluginImpl::InitData {
scoped_refptr<PluginModule> module;
base::WeakPtr<PluginDelegate> delegate;
- base::WeakPtr<RenderView> render_view;
+ base::WeakPtr<RenderViewImpl> render_view;
std::vector<std::string> arg_names;
std::vector<std::string> arg_values;
GURL url;
@@ -57,7 +59,7 @@ PepperWebPluginImpl::PepperWebPluginImpl(
PluginModule* plugin_module,
const WebPluginParams& params,
const base::WeakPtr<PluginDelegate>& plugin_delegate,
- const base::WeakPtr<RenderView>& render_view)
+ const base::WeakPtr<RenderViewImpl>& render_view)
: init_data_(new InitData()),
full_frame_(params.loadManually),
instance_object_(PP_MakeUndefined()),
@@ -105,8 +107,8 @@ bool PepperWebPluginImpl::initialize(WebPluginContainer* container) {
instance_ = NULL;
WebKit::WebPlugin* replacement_plugin =
- init_data_->delegate->CreatePluginReplacement(
- init_data_->module->path());
+ GetContentClient()->renderer()->CreatePluginReplacement(
+ init_data_->render_view.get(), init_data_->module->path());
if (!replacement_plugin || !replacement_plugin->initialize(container))
return false;
diff --git a/content/renderer/pepper/pepper_webplugin_impl.h b/content/renderer/pepper/pepper_webplugin_impl.h
index 11bd750..09d068e 100644
--- a/content/renderer/pepper/pepper_webplugin_impl.h
+++ b/content/renderer/pepper/pepper_webplugin_impl.h
@@ -17,10 +17,6 @@
struct _NPP;
-namespace content {
-class RenderView;
-}
-
namespace WebKit {
struct WebPluginParams;
struct WebPrintParams;
@@ -32,13 +28,14 @@ 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<RenderView>& render_view);
+ 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
index 9500a11..c22b89d 100644
--- a/content/renderer/pepper/plugin_delegate.h
+++ b/content/renderer/pepper/plugin_delegate.h
@@ -32,10 +32,8 @@
#include "ui/gfx/size.h"
#include "url/gurl.h"
#include "webkit/common/fileapi/file_system_types.h"
-#include "webkit/common/quota/quota_types.h"
class GURL;
-class SkBitmap;
class SkCanvas;
class TransportDIB;
struct PP_NetAddress_Private;
@@ -68,23 +66,15 @@ class Point;
namespace ppapi {
class PepperFilePath;
class PpapiPermissions;
-class PPB_X509Certificate_Fields;
class SocketOptionData;
struct DeviceRefData;
struct HostPortPair;
-struct Preferences;
-
-namespace thunk {
-class ResourceCreationAPI;
-}
} // namespace ppapi
namespace WebKit {
typedef SkCanvas WebCanvas;
class WebGamepads;
-class WebPlugin;
-struct WebCompositionUnderline;
struct WebCursorInfo;
struct WebURLError;
class WebURLLoaderClient;
@@ -119,13 +109,6 @@ class PluginDelegate {
PepperPluginInstanceImpl* instance) = 0;
// Notification that the text selection in the given plugin is changed.
virtual void PluginSelectionChanged(PepperPluginInstanceImpl* instance) = 0;
- // Requests simulating IME events for testing purpose.
- virtual void SimulateImeSetComposition(
- const base::string16& text,
- const std::vector<WebKit::WebCompositionUnderline>& underlines,
- int selection_start,
- int selection_end) = 0;
- virtual void SimulateImeConfirmComposition(const base::string16& text) = 0;
// Notification that the given plugin has crashed. When a plugin crashes, all
// instances associated with that plugin will notify that they've crashed via
@@ -140,33 +123,6 @@ class PluginDelegate {
// from this call.
virtual void InstanceDeleted(PepperPluginInstanceImpl* instance) = 0;
- // Creates the resource creation API for the given instance.
- virtual scoped_ptr< ::ppapi::thunk::ResourceCreationAPI>
- CreateResourceCreationAPI(PepperPluginInstanceImpl* instance) = 0;
-
- // Returns a pointer (ownership not transferred) to the bitmap to paint the
- // sad plugin screen with. Returns NULL on failure.
- virtual SkBitmap* GetSadPluginBitmap() = 0;
-
- // Creates a replacement plug-in that is shown when the plug-in at |file_path|
- // couldn't be loaded.
- virtual WebKit::WebPlugin* CreatePluginReplacement(
- const base::FilePath& file_path) = 0;
-
- // Get audio hardware output sample rate.
- virtual uint32_t GetAudioHardwareOutputSampleRate() = 0;
-
- // Get audio hardware output buffer size.
- virtual uint32_t GetAudioHardwareOutputBufferSize() = 0;
-
- // Notifies that the number of find results has changed.
- virtual void NumberOfFindResultsChanged(int identifier,
- int total,
- bool final_result) = 0;
-
- // Notifies that the index of the currently selected item has been updated.
- virtual void SelectedFindResultChanged(int identifier, int index) = 0;
-
// Sends an async IPC to open a local file.
typedef base::Callback<void (base::PlatformFileError, base::PassPlatformFile)>
AsyncOpenFileCallback;
@@ -174,76 +130,6 @@ class PluginDelegate {
int flags,
const AsyncOpenFileCallback& callback) = 0;
- // These functions expose some of PepperFileSystemHost methods for
- // PPB_FileRef_Impl (which is in webkit) to access. Once we migrate FileRef
- // to the new design in content/, we won't need this delegation.
- // TODO(victorhsieh): remove these delegation.
- virtual bool IsFileSystemOpened(PP_Instance instance,
- PP_Resource resource) const = 0;
- virtual PP_FileSystemType GetFileSystemType(PP_Instance instance,
- PP_Resource resource) const = 0;
- virtual GURL GetFileSystemRootUrl(PP_Instance instance,
- PP_Resource resource) const = 0;
-
- // Sends an async IPC to open a file through filesystem API.
- // When a file is successfully opened, |callback| is invoked with
- // PLATFORM_FILE_OK, the opened file handle, and a callback function for
- // notifying that the file is closed. When the users of this function
- // finished using the file, they must close the file handle and then must call
- // the supplied callback function.
- typedef base::Callback<void (base::PlatformFileError)>
- NotifyCloseFileCallback;
- typedef base::Callback<
- void (base::PlatformFileError error,
- base::PassPlatformFile file,
- quota::QuotaLimitType quota_policy,
- const NotifyCloseFileCallback& close_file_callback)>
- AsyncOpenFileSystemURLCallback;
- virtual void AsyncOpenFileSystemURL(
- const GURL& path,
- int flags,
- const AsyncOpenFileSystemURLCallback& callback) = 0;
-
- // Callback typedefs for FileSystem related methods.
- typedef base::Callback<void (base::PlatformFileError)> StatusCallback;
- typedef base::Callback<void(
- const std::vector<fileapi::DirectoryEntry>& entries,
- bool has_more)> ReadDirectoryCallback;
- typedef base::Callback<void(
- const base::PlatformFileInfo& file_info)> MetadataCallback;
-
- virtual void MakeDirectory(
- const GURL& path,
- bool recursive,
- const StatusCallback& callback) = 0;
- virtual void Query(const GURL& path,
- const MetadataCallback& success_callback,
- const StatusCallback& error_callback) = 0;
- virtual void ReadDirectoryEntries(
- const GURL& path,
- const ReadDirectoryCallback& success_callback,
- const StatusCallback& error_callback) = 0;
- virtual void Touch(const GURL& path,
- const base::Time& last_access_time,
- const base::Time& last_modified_time,
- const StatusCallback& callback) = 0;
- virtual void SetLength(const GURL& path,
- int64_t length,
- const StatusCallback& callback) = 0;
- virtual void Delete(const GURL& path,
- const StatusCallback& callback) = 0;
- virtual void Rename(const GURL& file_path,
- const GURL& new_file_path,
- const StatusCallback& callback) = 0;
- virtual void ReadDirectory(
- const GURL& directory_path,
- const ReadDirectoryCallback& success_callback,
- const StatusCallback& error_callback) = 0;
-
- // Synchronously returns the platform file path for a filesystem URL.
- virtual void SyncGetFileSystemPlatformPath(const GURL& url,
- base::FilePath* platform_path) = 0;
-
// Returns a MessageLoopProxy instance associated with the message loop
// of the file thread in this renderer.
virtual scoped_refptr<base::MessageLoopProxy>
@@ -283,34 +169,6 @@ class PluginDelegate {
PP_Resource socket_resource,
uint32 socket_id) = 0;
- // For PPB_X509Certificate_Private.
- virtual bool X509CertificateParseDER(
- const std::vector<char>& der,
- ::ppapi::PPB_X509Certificate_Fields* fields) = 0;
-
- // Create a fullscreen container for a plugin instance. This effectively
- // switches the plugin to fullscreen.
- virtual FullscreenContainer* CreateFullscreenContainer(
- PepperPluginInstanceImpl* instance) = 0;
-
- // Gets the size of the screen. The fullscreen window will be created at that
- // size.
- virtual gfx::Size GetScreenSize() = 0;
-
- // Returns a string with the name of the default 8-bit char encoding.
- virtual std::string GetDefaultEncoding() = 0;
-
- // Sets the minimum and maximum zoom factors.
- virtual void ZoomLimitsChanged(double minimum_factor,
- double maximum_factor) = 0;
-
- // Create an anonymous shared memory segment of size |size| bytes, and return
- // a pointer to it, or NULL on error. Caller owns the returned pointer.
- virtual base::SharedMemory* CreateAnonymousSharedMemory(size_t size) = 0;
-
- // Returns the current preferences.
- virtual ::ppapi::Preferences GetPreferences() = 0;
-
// Locks the mouse for |instance|. If false is returned, the lock is not
// possible. If true is returned then the lock is pending. Success or
// failure will be delivered asynchronously via
@@ -337,24 +195,9 @@ class PluginDelegate {
// Notifies that |instance| has received a mouse event.
virtual void DidReceiveMouseEvent(PepperPluginInstanceImpl* instance) = 0;
- // Determines if the browser entered fullscreen mode.
- virtual bool IsInFullscreenMode() = 0;
-
// Retrieve current gamepad data.
virtual void SampleGamepads(WebKit::WebGamepads* data) = 0;
- // Returns true if the containing page is visible.
- virtual bool IsPageVisible() const = 0;
-
- // Share a given handle with the target process.
- virtual IPC::PlatformFileForTransit ShareHandleWithRemote(
- base::PlatformFile handle,
- base::ProcessId target_process_id,
- bool should_close_source) const = 0;
-
- // Returns true if running in process.
- virtual bool IsRunningInProcess(PP_Instance instance) const = 0;
-
// Notifies the plugin of the document load. This should initiate the call to
// PPP_Instance.HandleDocumentLoad.
//
diff --git a/content/renderer/pepper/plugin_module.cc b/content/renderer/pepper/plugin_module.cc
index ef34c10..54129b8 100644
--- a/content/renderer/pepper/plugin_module.cc
+++ b/content/renderer/pepper/plugin_module.cc
@@ -26,6 +26,7 @@
#include "content/renderer/pepper/ppb_uma_private_impl.h"
#include "content/renderer/pepper/ppb_var_deprecated_impl.h"
#include "content/renderer/pepper/ppb_video_decoder_impl.h"
+#include "content/renderer/pepper/renderer_ppapi_host_impl.h"
#include "ppapi/c/dev/ppb_audio_input_dev.h"
#include "ppapi/c/dev/ppb_buffer_dev.h"
#include "ppapi/c/dev/ppb_char_set_dev.h"
@@ -411,7 +412,7 @@ PluginModule::~PluginModule() {
// Some resources and other stuff are hung off of the embedder state, which
// should be torn down before the routing stuff below.
- embedder_state_.reset();
+ renderer_ppapi_host_.reset();
GetLivePluginSet()->erase(this);
@@ -437,12 +438,9 @@ PluginModule::~PluginModule() {
// previous parts of the destructor.
}
-void PluginModule::SetEmbedderState(scoped_ptr<EmbedderState> state) {
- embedder_state_ = state.Pass();
-}
-
-PluginModule::EmbedderState* PluginModule::GetEmbedderState() {
- return embedder_state_.get();
+void PluginModule::SetRendererPpapiHost(
+ scoped_ptr<RendererPpapiHostImpl> host) {
+ renderer_ppapi_host_ = host.Pass();
}
bool PluginModule::InitAsInternalPlugin(
@@ -535,7 +533,7 @@ bool PluginModule::SupportsInterface(const char* name) {
PepperPluginInstanceImpl* PluginModule::CreateInstance(
PluginDelegate* delegate,
- RenderView* render_view,
+ RenderViewImpl* render_view,
WebKit::WebPluginContainer* container,
const GURL& plugin_url) {
PepperPluginInstanceImpl* instance = PepperPluginInstanceImpl::Create(
diff --git a/content/renderer/pepper/plugin_module.h b/content/renderer/pepper/plugin_module.h
index d2854fc..8deeeb1 100644
--- a/content/renderer/pepper/plugin_module.h
+++ b/content/renderer/pepper/plugin_module.h
@@ -31,10 +31,6 @@ namespace base {
class FilePath;
}
-namespace content {
-class RenderView;
-}
-
namespace ppapi {
class CallbackTracker;
class WebKitForwarding;
@@ -49,6 +45,8 @@ class HostDispatcherWrapper;
class PepperPluginInstanceImpl;
class PepperBroker;
class PluginDelegate;
+class RendererPpapiHostImpl;
+class RenderViewImpl;
// Represents one plugin library loaded into one renderer. This library may
// have multiple instances.
@@ -59,14 +57,6 @@ class CONTENT_EXPORT PluginModule :
public base::RefCounted<PluginModule>,
public base::SupportsWeakPtr<PluginModule> {
public:
- // Allows the embedder to associate a class with this module. This is opaque
- // from the PluginModule's perspective (see Set/GetEmbedderState below) but
- // the module is in charge of deleting the class.
- class EmbedderState {
- public:
- virtual ~EmbedderState() {}
- };
-
typedef std::set<PepperPluginInstanceImpl*> PluginInstanceSet;
// You must call one of the Init functions after the constructor to create a
@@ -82,10 +72,7 @@ class CONTENT_EXPORT PluginModule :
// Sets the given class as being associated with this module. It will be
// deleted when the module is destroyed. You can only set it once, subsequent
// sets will assert.
- //
- // See EmbedderState above for more.
- void SetEmbedderState(scoped_ptr<EmbedderState> state);
- EmbedderState* GetEmbedderState();
+ void SetRendererPpapiHost(scoped_ptr<RendererPpapiHostImpl> host);
// Initializes this module as an internal plugin with the given entrypoints.
// This is used for "plugins" compiled into Chrome. Returns true on success.
@@ -138,6 +125,10 @@ class CONTENT_EXPORT PluginModule :
// considered when called on the browser process.
static bool SupportsInterface(const char* name);
+ RendererPpapiHostImpl* renderer_ppapi_host() {
+ return renderer_ppapi_host_.get();
+ }
+
// Returns the module handle. This may be used before Init() is called (the
// proxy needs this information to set itself up properly).
PP_Module pp_module() const { return pp_module_; }
@@ -148,7 +139,7 @@ class CONTENT_EXPORT PluginModule :
PepperPluginInstanceImpl* CreateInstance(
PluginDelegate* delegate,
- RenderView* render_view,
+ RenderViewImpl* render_view,
WebKit::WebPluginContainer* container,
const GURL& plugin_url);
@@ -209,8 +200,7 @@ class CONTENT_EXPORT PluginModule :
// entrypoints in that case).
bool InitializeModule(const PepperPluginInfo::EntryPoints& entry_points);
- // See EmbedderState above.
- scoped_ptr<EmbedderState> embedder_state_;
+ scoped_ptr<RendererPpapiHostImpl> renderer_ppapi_host_;
// Tracker for completion callbacks, used mainly to ensure that all callbacks
// are properly aborted on module shutdown.
diff --git a/content/renderer/pepper/ppb_buffer_impl.cc b/content/renderer/pepper/ppb_buffer_impl.cc
index 808ebfb..1916b90 100644
--- a/content/renderer/pepper/ppb_buffer_impl.cc
+++ b/content/renderer/pepper/ppb_buffer_impl.cc
@@ -11,6 +11,7 @@
#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_instance.h"
#include "ppapi/c/pp_resource.h"
@@ -59,7 +60,8 @@ bool PPB_Buffer_Impl::Init(uint32_t size) {
if (size == 0 || !plugin_delegate)
return false;
size_ = size;
- shared_memory_.reset(plugin_delegate->CreateAnonymousSharedMemory(size));
+ shared_memory_.reset(
+ RenderThread::Get()->HostAllocateSharedMemoryBuffer(size).release());
return shared_memory_.get() != NULL;
}
diff --git a/content/renderer/pepper/ppb_file_ref_impl.cc b/content/renderer/pepper/ppb_file_ref_impl.cc
index e0e2edc..589e17e 100644
--- a/content/renderer/pepper/ppb_file_ref_impl.cc
+++ b/content/renderer/pepper/ppb_file_ref_impl.cc
@@ -8,13 +8,18 @@
#include "base/platform_file.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
+#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_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"
+#include "content/renderer/render_thread_impl.h"
#include "net/base/escape.h"
#include "ppapi/c/pp_errors.h"
+#include "ppapi/host/ppapi_host.h"
#include "ppapi/shared_impl/file_type_conversion.h"
#include "ppapi/shared_impl/time_conversion.h"
#include "ppapi/shared_impl/var.h"
@@ -236,8 +241,16 @@ PPB_FileRef_Impl* PPB_FileRef_Impl::CreateInternal(PP_Instance instance,
if (!plugin_instance || !plugin_instance->delegate())
return 0;
- PP_FileSystemType type =
- plugin_instance->delegate()->GetFileSystemType(instance, pp_file_system);
+ ppapi::host::ResourceHost* host = GetResourceHostInternal(
+ instance, pp_file_system);
+ if (!host)
+ return 0;
+
+ PepperFileSystemHost* fs_host = host->AsPepperFileSystemHost();
+ if (!fs_host)
+ return 0;
+
+ PP_FileSystemType type = fs_host->GetType();
if (type != PP_FILESYSTEMTYPE_LOCALPERSISTENT &&
type != PP_FILESYSTEMTYPE_LOCALTEMPORARY &&
type != PP_FILESYSTEMTYPE_EXTERNAL &&
@@ -258,7 +271,10 @@ PPB_FileRef_Impl* PPB_FileRef_Impl::CreateInternal(PP_Instance instance,
info.name = GetNameForVirtualFilePath(info.path);
PPB_FileRef_Impl* file_ref = new PPB_FileRef_Impl(info, pp_file_system);
- if (plugin_instance->delegate()->IsRunningInProcess(instance))
+
+ RendererPpapiHostImpl* renderer_host =
+ RendererPpapiHostImpl::GetForPPInstance(instance);
+ if (renderer_host && renderer_host->IsRunningInProcess())
file_ref->AddFileSystemRefCount();
return file_ref;
}
@@ -308,12 +324,10 @@ int32_t PPB_FileRef_Impl::MakeDirectory(
if (!IsValidNonExternalFileSystem())
return PP_ERROR_NOACCESS;
- PepperPluginInstanceImpl* plugin_instance =
- ResourceHelper::GetPluginInstance(this);
- if (!plugin_instance)
- return PP_ERROR_FAILED;
- plugin_instance->delegate()->MakeDirectory(
- GetFileSystemURL(), PP_ToBool(make_ancestors),
+ FileSystemDispatcher* file_system_dispatcher =
+ ChildThread::current()->file_system_dispatcher();
+ file_system_dispatcher->CreateDirectory(
+ GetFileSystemURL(), false /* exclusive */, PP_ToBool(make_ancestors),
base::Bind(&DidFinishFileOperation, callback));
return PP_OK_COMPLETIONPENDING;
}
@@ -324,11 +338,9 @@ int32_t PPB_FileRef_Impl::Touch(PP_Time last_access_time,
if (!IsValidNonExternalFileSystem())
return PP_ERROR_NOACCESS;
- PepperPluginInstanceImpl* plugin_instance =
- ResourceHelper::GetPluginInstance(this);
- if (!plugin_instance)
- return PP_ERROR_FAILED;
- plugin_instance->delegate()->Touch(
+ FileSystemDispatcher* file_system_dispatcher =
+ ChildThread::current()->file_system_dispatcher();
+ file_system_dispatcher->TouchFile(
GetFileSystemURL(),
PPTimeToTime(last_access_time),
PPTimeToTime(last_modified_time),
@@ -340,12 +352,11 @@ int32_t PPB_FileRef_Impl::Delete(scoped_refptr<TrackedCallback> callback) {
if (!IsValidNonExternalFileSystem())
return PP_ERROR_NOACCESS;
- PepperPluginInstanceImpl* plugin_instance =
- ResourceHelper::GetPluginInstance(this);
- if (!plugin_instance)
- return PP_ERROR_FAILED;
- plugin_instance->delegate()->Delete(
+ FileSystemDispatcher* file_system_dispatcher =
+ ChildThread::current()->file_system_dispatcher();
+ file_system_dispatcher->Remove(
GetFileSystemURL(),
+ false /* recursive */,
base::Bind(&DidFinishFileOperation, callback));
return PP_OK_COMPLETIONPENDING;
}
@@ -364,11 +375,9 @@ int32_t PPB_FileRef_Impl::Rename(PP_Resource new_pp_file_ref,
// TODO(viettrungluu): Also cancel when the new file ref is destroyed?
// http://crbug.com/67624
- PepperPluginInstanceImpl* plugin_instance =
- ResourceHelper::GetPluginInstance(this);
- if (!plugin_instance)
- return PP_ERROR_FAILED;
- plugin_instance->delegate()->Rename(
+ FileSystemDispatcher* file_system_dispatcher =
+ ChildThread::current()->file_system_dispatcher();
+ file_system_dispatcher->Move(
GetFileSystemURL(), new_file_ref->GetFileSystemURL(),
base::Bind(&DidFinishFileOperation, callback));
return PP_OK_COMPLETIONPENDING;
@@ -408,33 +417,32 @@ GURL PPB_FileRef_Impl::GetFileSystemURL() const {
// We need to trim off the '/' before calling Resolve, as FileSystem URLs
// start with a storage type identifier that looks like a path segment.
- PepperPluginInstanceImpl* plugin_instance =
- ResourceHelper::GetPluginInstance(this);
- PluginDelegate* delegate =
- plugin_instance ? plugin_instance->delegate() : NULL;
- if (!delegate)
+ ppapi::host::ResourceHost* host = GetResourceHost();
+ if (!host)
return GURL();
- return GURL(delegate->GetFileSystemRootUrl(pp_instance(), file_system_))
- .Resolve(net::EscapePath(virtual_path.substr(1)));
+
+ PepperFileSystemHost* fs_host = host->AsPepperFileSystemHost();
+ if (!fs_host)
+ return GURL();
+
+ return GURL(fs_host->GetRootUrl()).Resolve(net::EscapePath(
+ virtual_path.substr(1)));
}
bool PPB_FileRef_Impl::IsValidNonExternalFileSystem() const {
- PepperPluginInstanceImpl* plugin_instance =
- ResourceHelper::GetPluginInstance(this);
- PluginDelegate* delegate =
- plugin_instance ? plugin_instance->delegate() : NULL;
- return delegate &&
- delegate->IsFileSystemOpened(pp_instance(), file_system_) &&
- delegate->GetFileSystemType(pp_instance(), file_system_) !=
+ ppapi::host::ResourceHost* host = GetResourceHost();
+ return HasValidFileSystem() &&
+ host->AsPepperFileSystemHost()->GetType() !=
PP_FILESYSTEMTYPE_EXTERNAL;
}
bool PPB_FileRef_Impl::HasValidFileSystem() const {
- PepperPluginInstanceImpl* plugin_instance =
- ResourceHelper::GetPluginInstance(this);
- PluginDelegate* delegate =
- plugin_instance ? plugin_instance->delegate() : NULL;
- return delegate && delegate->IsFileSystemOpened(pp_instance(), file_system_);
+ ppapi::host::ResourceHost* host = GetResourceHost();
+ if (!host)
+ return false;
+
+ PepperFileSystemHost* fs_host = host->AsPepperFileSystemHost();
+ return fs_host && fs_host->IsOpened();
}
int32_t PPB_FileRef_Impl::Query(PP_FileInfo* info,
@@ -468,16 +476,11 @@ int32_t PPB_FileRef_Impl::QueryInHost(
if (!HasValidFileSystem())
return PP_ERROR_NOACCESS;
- PepperPluginInstanceImpl* plugin_instance =
- ResourceHelper::GetPluginInstance(this);
- PluginDelegate* delegate =
- plugin_instance ? plugin_instance->delegate() : NULL;
- if (!delegate)
- return PP_ERROR_FAILED;
-
- PP_FileSystemType file_system_type =
- delegate->GetFileSystemType(pp_instance(), file_system_);
- plugin_instance->delegate()->Query(
+ PP_FileSystemType file_system_type = GetResourceHost()->
+ AsPepperFileSystemHost()->GetType();
+ FileSystemDispatcher* file_system_dispatcher =
+ ChildThread::current()->file_system_dispatcher();
+ file_system_dispatcher->ReadMetadata(
GetFileSystemURL(),
base::Bind(&DidReadMetadata, callback, info, file_system_type),
base::Bind(&DidFinishFileOperation, callback));
@@ -499,14 +502,11 @@ int32_t PPB_FileRef_Impl::ReadDirectoryEntriesInHost(
if (!IsValidNonExternalFileSystem())
return PP_ERROR_NOACCESS;
- PepperPluginInstanceImpl* plugin_instance =
- ResourceHelper::GetPluginInstance(this);
- if (!plugin_instance)
- return PP_ERROR_FAILED;
-
// TODO(yzshen): Passing base::Unretained(this) to the callback could
// be dangerous.
- plugin_instance->delegate()->ReadDirectoryEntries(
+ FileSystemDispatcher* file_system_dispatcher =
+ ChildThread::current()->file_system_dispatcher();
+ file_system_dispatcher->ReadDirectory(
GetFileSystemURL(),
base::Bind(&DidReadDirectory,
callback, base::Unretained(this), files, file_types),
@@ -514,4 +514,17 @@ int32_t PPB_FileRef_Impl::ReadDirectoryEntriesInHost(
return PP_OK_COMPLETIONPENDING;
}
+ppapi::host::ResourceHost* PPB_FileRef_Impl::GetResourceHost() const {
+ return GetResourceHostInternal(pp_instance(), file_system_);
+}
+
+ppapi::host::ResourceHost* PPB_FileRef_Impl::GetResourceHostInternal(
+ PP_Instance instance, PP_Resource resource) {
+ const ppapi::host::PpapiHost* ppapi_host =
+ RendererPpapiHost::GetForPPInstance(instance)->GetPpapiHost();
+ if (!resource || !ppapi_host)
+ return NULL;
+ return ppapi_host->GetResourceHost(resource);
+}
+
} // namespace content
diff --git a/content/renderer/pepper/ppb_file_ref_impl.h b/content/renderer/pepper/ppb_file_ref_impl.h
index 75dda3e..0ec2164 100644
--- a/content/renderer/pepper/ppb_file_ref_impl.h
+++ b/content/renderer/pepper/ppb_file_ref_impl.h
@@ -17,6 +17,12 @@
#include "ppapi/shared_impl/var.h"
#include "url/gurl.h"
+namespace ppapi {
+namespace host {
+class ResourceHost;
+}
+}
+
namespace content {
using ::ppapi::StringVar;
@@ -94,6 +100,10 @@ class PPB_FileRef_Impl : public ::ppapi::PPB_FileRef_Shared {
// access check for these functions.
bool IsValidNonExternalFileSystem() const;
+ ppapi::host::ResourceHost* GetResourceHost() const;
+ static ppapi::host::ResourceHost* GetResourceHostInternal(
+ PP_Instance instance, PP_Resource resource);
+
// 0 for external filesystems. This is a plugin side resource that we don't
// hold a reference here, so file_system_ could be destroyed earlier than
// this object. Right now we checked the existance in plugin delegate before
diff --git a/content/renderer/pepper/ppb_image_data_impl.cc b/content/renderer/pepper/ppb_image_data_impl.cc
index de94152..12f9ae5 100644
--- a/content/renderer/pepper/ppb_image_data_impl.cc
+++ b/content/renderer/pepper/ppb_image_data_impl.cc
@@ -257,8 +257,8 @@ bool ImageDataSimpleBackend::Init(PPB_ImageData_Impl* impl,
PluginDelegate* plugin_delegate = ResourceHelper::GetPluginDelegate(impl);
if (!plugin_delegate)
return false;
- shared_memory_.reset(
- plugin_delegate->CreateAnonymousSharedMemory(skia_bitmap_.getSize()));
+ shared_memory_.reset(RenderThread::Get()->HostAllocateSharedMemoryBuffer(
+ skia_bitmap_.getSize()).release());
return !!shared_memory_.get();
}
diff --git a/content/renderer/pepper/ppb_x509_certificate_private_impl.cc b/content/renderer/pepper/ppb_x509_certificate_private_impl.cc
index 6b60a42..6c287a3 100644
--- a/content/renderer/pepper/ppb_x509_certificate_private_impl.cc
+++ b/content/renderer/pepper/ppb_x509_certificate_private_impl.cc
@@ -4,8 +4,8 @@
#include "content/renderer/pepper/ppb_x509_certificate_private_impl.h"
-#include "content/renderer/pepper/plugin_delegate.h"
-#include "content/renderer/pepper/resource_helper.h"
+#include "content/renderer/render_thread_impl.h"
+#include "ppapi/proxy/ppapi_messages.h"
namespace content {
@@ -23,11 +23,10 @@ PP_Resource PPB_X509Certificate_Private_Impl::CreateResource(
bool PPB_X509Certificate_Private_Impl::ParseDER(
const std::vector<char>& der,
::ppapi::PPB_X509Certificate_Fields* result) {
- PluginDelegate* plugin_delegate = ResourceHelper::GetPluginDelegate(this);
- if (!plugin_delegate)
- return false;
-
- return plugin_delegate->X509CertificateParseDER(der, result);
+ bool succeeded = false;
+ RenderThreadImpl::current()->Send(
+ new PpapiHostMsg_PPBX509Certificate_ParseDER(der, &succeeded, result));
+ return succeeded;
}
PPB_X509Certificate_Private_Impl::~PPB_X509Certificate_Private_Impl() {
diff --git a/content/renderer/pepper/renderer_ppapi_host_impl.cc b/content/renderer/pepper/renderer_ppapi_host_impl.cc
index 3d371bb..1180d39 100644
--- a/content/renderer/pepper/renderer_ppapi_host_impl.cc
+++ b/content/renderer/pepper/renderer_ppapi_host_impl.cc
@@ -79,13 +79,12 @@ RendererPpapiHostImpl* RendererPpapiHostImpl::CreateOnModuleForOutOfProcess(
PluginModule* module,
ppapi::proxy::HostDispatcher* dispatcher,
const ppapi::PpapiPermissions& permissions) {
- DCHECK(!module->GetEmbedderState());
+ DCHECK(!module->renderer_ppapi_host());
RendererPpapiHostImpl* result = new RendererPpapiHostImpl(
module, dispatcher, permissions);
// Takes ownership of pointer.
- module->SetEmbedderState(
- scoped_ptr<PluginModule::EmbedderState>(result));
+ module->SetRendererPpapiHost(scoped_ptr<RendererPpapiHostImpl>(result));
return result;
}
@@ -94,13 +93,12 @@ RendererPpapiHostImpl* RendererPpapiHostImpl::CreateOnModuleForOutOfProcess(
RendererPpapiHostImpl* RendererPpapiHostImpl::CreateOnModuleForInProcess(
PluginModule* module,
const ppapi::PpapiPermissions& permissions) {
- DCHECK(!module->GetEmbedderState());
+ DCHECK(!module->renderer_ppapi_host());
RendererPpapiHostImpl* result = new RendererPpapiHostImpl(
module, permissions);
// Takes ownership of pointer.
- module->SetEmbedderState(
- scoped_ptr<PluginModule::EmbedderState>(result));
+ module->SetRendererPpapiHost(scoped_ptr<RendererPpapiHostImpl>(result));
return result;
}
@@ -115,8 +113,7 @@ RendererPpapiHostImpl* RendererPpapiHostImpl::GetForPPInstance(
// All modules created by content will have their embedder state be the
// host impl.
- return static_cast<RendererPpapiHostImpl*>(
- instance->module()->GetEmbedderState());
+ return instance->module()->renderer_ppapi_host();
}
scoped_ptr< ::ppapi::thunk::ResourceCreationAPI>
diff --git a/content/renderer/pepper/renderer_ppapi_host_impl.h b/content/renderer/pepper/renderer_ppapi_host_impl.h
index c62009a..45929c2 100644
--- a/content/renderer/pepper/renderer_ppapi_host_impl.h
+++ b/content/renderer/pepper/renderer_ppapi_host_impl.h
@@ -10,7 +10,6 @@
#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 "content/renderer/pepper/plugin_module.h"
#include "ppapi/host/ppapi_host.h"
namespace IPC {
@@ -36,10 +35,8 @@ class PepperInProcessRouter;
class PepperPluginInstanceImpl;
class PluginModule;
-// This class is attached to a PluginModule via the module's embedder state.
-// The plugin module manages our lifetime.
-class RendererPpapiHostImpl : public RendererPpapiHost,
- public PluginModule::EmbedderState {
+// This class is attached to a PluginModule which manages our lifetime.
+class RendererPpapiHostImpl : public RendererPpapiHost {
public:
virtual ~RendererPpapiHostImpl();
diff --git a/content/renderer/pepper/url_request_info_util.cc b/content/renderer/pepper/url_request_info_util.cc
index d3c4506..8e2988a 100644
--- a/content/renderer/pepper/url_request_info_util.cc
+++ b/content/renderer/pepper/url_request_info_util.cc
@@ -6,10 +6,12 @@
#include "base/logging.h"
#include "base/strings/string_util.h"
+#include "content/common/fileapi/file_system_messages.h"
#include "content/renderer/pepper/common.h"
#include "content/renderer/pepper/plugin_module.h"
#include "content/renderer/pepper/ppb_file_ref_impl.h"
#include "content/renderer/pepper/resource_helper.h"
+#include "content/renderer/render_thread_impl.h"
#include "net/http/http_util.h"
#include "ppapi/shared_impl/url_request_info_data.h"
#include "ppapi/shared_impl/var.h"
@@ -67,8 +69,9 @@ bool AppendFileRefToBody(
case PP_FILESYSTEMTYPE_LOCALPERSISTENT:
// TODO(kinuko): remove this sync IPC when we fully support
// AppendURLRange for FileSystem URL.
- plugin_delegate->SyncGetFileSystemPlatformPath(
- file_ref->GetFileSystemURL(), &platform_path);
+ RenderThreadImpl::current()->Send(
+ new FileSystemHostMsg_SyncGetPlatformPath(
+ file_ref->GetFileSystemURL(), &platform_path));
break;
case PP_FILESYSTEMTYPE_EXTERNAL:
platform_path = file_ref->GetSystemPath();
diff --git a/ppapi/thunk/ppb_instance_api.h b/ppapi/thunk/ppb_instance_api.h
index 0bd2afe..3fa2edf 100644
--- a/ppapi/thunk/ppb_instance_api.h
+++ b/ppapi/thunk/ppb_instance_api.h
@@ -136,7 +136,7 @@ class PPB_Instance_API {
virtual void ZoomChanged(PP_Instance instance, double factor) = 0;
virtual void ZoomLimitsChanged(PP_Instance instance,
double minimum_factor,
- double maximium_factor) = 0;
+ double maximum_factor) = 0;
// Testing and URLUtil.
virtual PP_Var GetDocumentURL(PP_Instance instance,
PP_URLComponents_Dev* components) = 0;