diff options
author | ericu@google.com <ericu@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-16 00:02:53 +0000 |
---|---|---|
committer | ericu@google.com <ericu@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-16 00:02:53 +0000 |
commit | 07c3d212963a1638659c4130f05bd5196957b2f6 (patch) | |
tree | f9fcfd54a7e26b443b1b941f80475725cb4d79cd /content/renderer/pepper_plugin_delegate_impl.cc | |
parent | 5800f19aa9967928eca31752678ac7d8e4e0cd1d (diff) | |
download | chromium_src-07c3d212963a1638659c4130f05bd5196957b2f6.zip chromium_src-07c3d212963a1638659c4130f05bd5196957b2f6.tar.gz chromium_src-07c3d212963a1638659c4130f05bd5196957b2f6.tar.bz2 |
Let Pepper open FileSystem files again.
TEST=none [existing tests, but they're not currently run automatically]
BUG=none
Review URL: http://codereview.chromium.org/6850027
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81837 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer/pepper_plugin_delegate_impl.cc')
-rw-r--r-- | content/renderer/pepper_plugin_delegate_impl.cc | 57 |
1 files changed, 56 insertions, 1 deletions
diff --git a/content/renderer/pepper_plugin_delegate_impl.cc b/content/renderer/pepper_plugin_delegate_impl.cc index e819c56..e63dd01 100644 --- a/content/renderer/pepper_plugin_delegate_impl.cc +++ b/content/renderer/pepper_plugin_delegate_impl.cc @@ -703,7 +703,7 @@ bool PepperPluginDelegateImpl::OpenFileSystem( FileSystemDispatcher* file_system_dispatcher = ChildThread::current()->file_system_dispatcher(); return file_system_dispatcher->OpenFileSystem( - url, type, size, true /* create */, dispatcher); + url.GetWithEmptyPath(), type, size, true /* create */, dispatcher); } bool PepperPluginDelegateImpl::MakeDirectory( @@ -761,6 +761,61 @@ bool PepperPluginDelegateImpl::ReadDirectory( return file_system_dispatcher->ReadDirectory(directory_path, dispatcher); } +class AsyncOpenFileSystemURLCallbackTranslator : + public fileapi::FileSystemCallbackDispatcher { +public: + AsyncOpenFileSystemURLCallbackTranslator( + webkit::ppapi::PluginDelegate::AsyncOpenFileCallback* callback) + : callback_(callback) { + } + + virtual ~AsyncOpenFileSystemURLCallbackTranslator() {} + + virtual void DidSucceed() { + NOTREACHED(); + } + virtual void DidReadMetadata( + const base::PlatformFileInfo& file_info, + const FilePath& platform_path) { + NOTREACHED(); + } + virtual void DidReadDirectory( + const std::vector<base::FileUtilProxy::Entry>& entries, + bool has_more) { + NOTREACHED(); + } + virtual void DidOpenFileSystem(const std::string& name, + const GURL& root) { + NOTREACHED(); + } + + virtual void DidFail(base::PlatformFileError error_code) { + callback_->Run(error_code, base::kInvalidPlatformFileValue); + } + + virtual void DidWrite(int64 bytes, bool complete) { + NOTREACHED(); + } + + virtual void DidOpenFile( + base::PlatformFile file, + base::ProcessHandle unused) { + callback_->Run(base::PLATFORM_FILE_OK, file); + } + +private: // TODO(ericu): Delete this? + webkit::ppapi::PluginDelegate::AsyncOpenFileCallback* callback_; +}; + +bool PepperPluginDelegateImpl::AsyncOpenFileSystemURL( + const GURL& path, int flags, AsyncOpenFileCallback* callback) { + + FileSystemDispatcher* file_system_dispatcher = + ChildThread::current()->file_system_dispatcher(); + return file_system_dispatcher->OpenFile(path, flags, + new AsyncOpenFileSystemURLCallbackTranslator(callback)); +} + base::PlatformFileError PepperPluginDelegateImpl::OpenFile( const webkit::ppapi::PepperFilePath& path, int flags, |