summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorericu@google.com <ericu@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-16 00:02:53 +0000
committerericu@google.com <ericu@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-16 00:02:53 +0000
commit07c3d212963a1638659c4130f05bd5196957b2f6 (patch)
treef9fcfd54a7e26b443b1b941f80475725cb4d79cd
parent5800f19aa9967928eca31752678ac7d8e4e0cd1d (diff)
downloadchromium_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
-rw-r--r--content/browser/file_system/file_system_dispatcher_host.cc29
-rw-r--r--content/browser/file_system/file_system_dispatcher_host.h1
-rw-r--r--content/common/file_system/file_system_dispatcher.cc27
-rw-r--r--content/common/file_system/file_system_dispatcher.h10
-rw-r--r--content/common/file_system_messages.h10
-rw-r--r--content/renderer/pepper_plugin_delegate_impl.cc57
-rw-r--r--content/renderer/pepper_plugin_delegate_impl.h3
-rw-r--r--webkit/fileapi/file_system_callback_dispatcher.h11
-rw-r--r--webkit/fileapi/file_system_operation.cc57
-rw-r--r--webkit/fileapi/file_system_operation.h14
-rw-r--r--webkit/plugins/ppapi/mock_plugin_delegate.cc5
-rw-r--r--webkit/plugins/ppapi/mock_plugin_delegate.h3
-rw-r--r--webkit/plugins/ppapi/plugin_delegate.h3
-rw-r--r--webkit/plugins/ppapi/ppb_file_io_impl.cc25
-rw-r--r--webkit/plugins/ppapi/ppb_file_ref_impl.cc4
15 files changed, 251 insertions, 8 deletions
diff --git a/content/browser/file_system/file_system_dispatcher_host.cc b/content/browser/file_system/file_system_dispatcher_host.cc
index 053d31a4..8069f42 100644
--- a/content/browser/file_system/file_system_dispatcher_host.cc
+++ b/content/browser/file_system/file_system_dispatcher_host.cc
@@ -8,6 +8,7 @@
#include <vector>
#include "base/file_path.h"
+#include "base/platform_file.h"
#include "base/threading/thread.h"
#include "base/time.h"
#include "chrome/browser/content_settings/host_content_settings_map.h"
@@ -15,6 +16,7 @@
#include "chrome/browser/profiles/profile.h"
#include "content/common/file_system_messages.h"
#include "googleurl/src/gurl.h"
+#include "ipc/ipc_platform_file.h"
#include "net/url_request/url_request_context.h"
#include "webkit/fileapi/file_system_callback_dispatcher.h"
#include "webkit/fileapi/file_system_context.h"
@@ -72,6 +74,27 @@ class BrowserFileSystemCallbackDispatcher
request_id_, bytes, complete));
}
+ virtual void DidOpenFile(
+ base::PlatformFile file,
+ base::ProcessHandle peer_handle) {
+ IPC::PlatformFileForTransit file_for_transit =
+ IPC::InvalidPlatformFileForTransit();
+ if (file != base::kInvalidPlatformFileValue) {
+#if defined(OS_WIN)
+ if (!::DuplicateHandle(::GetCurrentProcess(), file, peer_handle,
+ &file_for_transit, 0, false,
+ DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE))
+ file_for_transit = IPC::InvalidPlatformFileForTransit();
+#elif defined(OS_POSIX)
+ file_for_transit = base::FileDescriptor(file, true);
+#else
+ #error Not implemented.
+#endif
+ }
+ dispatcher_host_->Send(new FileSystemMsg_DidOpenFile(
+ request_id_, file_for_transit));
+ }
+
private:
scoped_refptr<FileSystemDispatcherHost> dispatcher_host_;
int request_id_;
@@ -120,6 +143,7 @@ bool FileSystemDispatcherHost::OnMessageReceived(
IPC_MESSAGE_HANDLER(FileSystemHostMsg_Truncate, OnTruncate)
IPC_MESSAGE_HANDLER(FileSystemHostMsg_TouchFile, OnTouchFile)
IPC_MESSAGE_HANDLER(FileSystemHostMsg_CancelWrite, OnCancel)
+ IPC_MESSAGE_HANDLER(FileSystemHostMsg_OpenFile, OnOpenFile)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP_EX()
return handled;
@@ -228,6 +252,11 @@ void FileSystemDispatcherHost::OnCancel(
}
}
+void FileSystemDispatcherHost::OnOpenFile(
+ int request_id, const GURL& path, int file_flags) {
+ GetNewOperation(request_id)->OpenFile(path, file_flags, peer_handle());
+}
+
FileSystemOperation* FileSystemDispatcherHost::GetNewOperation(
int request_id) {
BrowserFileSystemCallbackDispatcher* dispatcher =
diff --git a/content/browser/file_system/file_system_dispatcher_host.h b/content/browser/file_system/file_system_dispatcher_host.h
index a0b8474..4dc001f 100644
--- a/content/browser/file_system/file_system_dispatcher_host.h
+++ b/content/browser/file_system/file_system_dispatcher_host.h
@@ -79,6 +79,7 @@ class FileSystemDispatcherHost : public BrowserMessageFilter {
const base::Time& last_access_time,
const base::Time& last_modified_time);
void OnCancel(int request_id, int request_to_cancel);
+ void OnOpenFile(int request_id, const GURL& path, int file_flags);
// Creates a new FileSystemOperation.
fileapi::FileSystemOperation* GetNewOperation(int request_id);
diff --git a/content/common/file_system/file_system_dispatcher.cc b/content/common/file_system/file_system_dispatcher.cc
index c4fe701..eed8f10 100644
--- a/content/common/file_system/file_system_dispatcher.cc
+++ b/content/common/file_system/file_system_dispatcher.cc
@@ -5,6 +5,7 @@
#include "content/common/file_system/file_system_dispatcher.h"
#include "base/file_util.h"
+#include "base/process.h"
#include "content/common/child_thread.h"
#include "content/common/file_system_messages.h"
@@ -32,6 +33,7 @@ bool FileSystemDispatcher::OnMessageReceived(const IPC::Message& msg) {
IPC_MESSAGE_HANDLER(FileSystemMsg_DidReadMetadata, OnDidReadMetadata)
IPC_MESSAGE_HANDLER(FileSystemMsg_DidFail, OnDidFail)
IPC_MESSAGE_HANDLER(FileSystemMsg_DidWrite, OnDidWrite)
+ IPC_MESSAGE_HANDLER(FileSystemMsg_DidOpenFile, OnDidOpenFile)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
@@ -213,6 +215,21 @@ bool FileSystemDispatcher::TouchFile(
return true;
}
+bool FileSystemDispatcher::OpenFile(
+ const GURL& file_path,
+ int file_flags,
+ fileapi::FileSystemCallbackDispatcher* dispatcher) {
+ int request_id = dispatchers_.Add(dispatcher);
+ if (!ChildThread::current()->Send(
+ new FileSystemHostMsg_OpenFile(
+ request_id, file_path, file_flags))) {
+ dispatchers_.Remove(request_id); // destroys |dispatcher|
+ return false;
+ }
+
+ return true;
+}
+
void FileSystemDispatcher::OnOpenComplete(
int request_id, bool accepted, const std::string& name,
const GURL& root) {
@@ -273,3 +290,13 @@ void FileSystemDispatcher::OnDidWrite(
if (complete)
dispatchers_.Remove(request_id);
}
+
+void FileSystemDispatcher::OnDidOpenFile(
+ int request_id, IPC::PlatformFileForTransit file) {
+ fileapi::FileSystemCallbackDispatcher* dispatcher =
+ dispatchers_.Lookup(request_id);
+ DCHECK(dispatcher);
+ dispatcher->DidOpenFile(IPC::PlatformFileForTransitToPlatformFile(file),
+ base::kNullProcessHandle);
+ dispatchers_.Remove(request_id);
+}
diff --git a/content/common/file_system/file_system_dispatcher.h b/content/common/file_system/file_system_dispatcher.h
index b898eae..b480ce8 100644
--- a/content/common/file_system/file_system_dispatcher.h
+++ b/content/common/file_system/file_system_dispatcher.h
@@ -10,8 +10,10 @@
#include "base/basictypes.h"
#include "base/file_util_proxy.h"
#include "base/id_map.h"
+#include "base/process.h"
#include "ipc/ipc_channel.h"
#include "ipc/ipc_message.h"
+#include "ipc/ipc_platform_file.h"
#include "webkit/fileapi/file_system_callback_dispatcher.h"
#include "webkit/fileapi/file_system_types.h"
@@ -75,6 +77,11 @@ class FileSystemDispatcher : public IPC::Channel::Listener {
const base::Time& last_modified_time,
fileapi::FileSystemCallbackDispatcher* dispatcher);
+ // This returns a raw open PlatformFile, unlike the above, which are
+ // self-contained operations.
+ bool OpenFile(const GURL& file_path,
+ int file_flags, // passed to FileUtilProxy::CreateOrOpen
+ fileapi::FileSystemCallbackDispatcher* dispatcher);
private:
// Message handlers.
void OnOpenComplete(
@@ -92,6 +99,9 @@ class FileSystemDispatcher : public IPC::Channel::Listener {
bool has_more);
void OnDidFail(int request_id, base::PlatformFileError error_code);
void OnDidWrite(int request_id, int64 bytes, bool complete);
+ void OnDidOpenFile(
+ int request_id,
+ IPC::PlatformFileForTransit file);
IDMap<fileapi::FileSystemCallbackDispatcher, IDMapOwnPointer> dispatchers_;
diff --git a/content/common/file_system_messages.h b/content/common/file_system_messages.h
index d91a7a6..0df4b0ce 100644
--- a/content/common/file_system_messages.h
+++ b/content/common/file_system_messages.h
@@ -7,6 +7,7 @@
#include "base/file_util_proxy.h"
#include "ipc/ipc_message_macros.h"
+#include "ipc/ipc_platform_file.h"
#include "webkit/fileapi/file_system_types.h"
#define IPC_MESSAGE_START FileSystemMsgStart
@@ -42,6 +43,9 @@ IPC_MESSAGE_CONTROL3(FileSystemMsg_DidWrite,
int /* request_id */,
int64 /* byte count */,
bool /* complete */)
+IPC_MESSAGE_CONTROL2(FileSystemMsg_DidOpenFile,
+ int /* request_id */,
+ IPC::PlatformFileForTransit)
IPC_MESSAGE_CONTROL2(FileSystemMsg_DidFail,
int /* request_id */,
base::PlatformFileError /* error_code */)
@@ -122,3 +126,9 @@ IPC_MESSAGE_CONTROL4(FileSystemHostMsg_TouchFile,
IPC_MESSAGE_CONTROL2(FileSystemHostMsg_CancelWrite,
int /* request id */,
int /* id of request to cancel */)
+
+// Pepper's OpenFile message.
+IPC_MESSAGE_CONTROL3(FileSystemHostMsg_OpenFile,
+ int /* request id */,
+ GURL /* file path */,
+ int /* file flags */)
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,
diff --git a/content/renderer/pepper_plugin_delegate_impl.h b/content/renderer/pepper_plugin_delegate_impl.h
index 9554cdd..f8cb567 100644
--- a/content/renderer/pepper_plugin_delegate_impl.h
+++ b/content/renderer/pepper_plugin_delegate_impl.h
@@ -144,6 +144,9 @@ class PepperPluginDelegateImpl
virtual bool AsyncOpenFile(const FilePath& path,
int flags,
AsyncOpenFileCallback* callback);
+ virtual bool AsyncOpenFileSystemURL(const GURL& path,
+ int flags,
+ AsyncOpenFileCallback* callback);
virtual bool OpenFileSystem(
const GURL& url,
fileapi::FileSystemType type,
diff --git a/webkit/fileapi/file_system_callback_dispatcher.h b/webkit/fileapi/file_system_callback_dispatcher.h
index 8504af9..c32e333 100644
--- a/webkit/fileapi/file_system_callback_dispatcher.h
+++ b/webkit/fileapi/file_system_callback_dispatcher.h
@@ -8,6 +8,9 @@
#include <vector>
#include "base/file_util_proxy.h"
+#include "base/logging.h"
+#include "base/platform_file.h"
+#include "base/process.h"
class GURL;
@@ -50,6 +53,14 @@ class FileSystemCallbackDispatcher {
// Callback for FileWriter's write() call.
virtual void DidWrite(int64 bytes, bool complete) = 0;
+
+ // Callback for OpenFile. This isn't in WebFileSystemCallbacks, as it's just
+ // for Pepper.
+ virtual void DidOpenFile(
+ base::PlatformFile file,
+ base::ProcessHandle peer_handle) {
+ NOTREACHED();
+ }
};
} // namespace fileapi
diff --git a/webkit/fileapi/file_system_operation.cc b/webkit/fileapi/file_system_operation.cc
index 0e258c1..e242e86 100644
--- a/webkit/fileapi/file_system_operation.cc
+++ b/webkit/fileapi/file_system_operation.cc
@@ -375,6 +375,52 @@ void FileSystemOperation::TouchFile(const GURL& path,
callback_factory_.NewCallback(&FileSystemOperation::DidTouchFile));
}
+void FileSystemOperation::OpenFile(const GURL& path,
+ int file_flags,
+ base::ProcessHandle peer_handle) {
+#ifndef NDEBUG
+ DCHECK(kOperationNone == pending_operation_);
+ pending_operation_ = kOperationOpenFile;
+#endif
+
+ peer_handle_ = peer_handle;
+ FilePath virtual_path;
+ GURL origin_url;
+ FileSystemType type;
+ if (file_flags & (
+ (base::PLATFORM_FILE_ENUMERATE | base::PLATFORM_FILE_TEMPORARY |
+ base::PLATFORM_FILE_HIDDEN))) {
+ delete this;
+ return;
+ }
+ if (file_flags &
+ (base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_OPEN_ALWAYS |
+ base::PLATFORM_FILE_CREATE_ALWAYS |
+ base::PLATFORM_FILE_WRITE | base::PLATFORM_FILE_EXCLUSIVE_WRITE |
+ base::PLATFORM_FILE_DELETE_ON_CLOSE | base::PLATFORM_FILE_TRUNCATE |
+ base::PLATFORM_FILE_WRITE_ATTRIBUTES)) {
+ if (!VerifyFileSystemPathForWrite(path, true /* create */, &origin_url,
+ &type, &virtual_path)) {
+ delete this;
+ return;
+ }
+ } else {
+ if (!VerifyFileSystemPathForRead(path, &origin_url, &type, &virtual_path)) {
+ delete this;
+ return;
+ }
+ }
+ file_system_operation_context_.set_src_origin_url(origin_url);
+ file_system_operation_context_.set_src_type(type);
+ FileSystemFileUtilProxy::CreateOrOpen(
+ file_system_operation_context_,
+ proxy_,
+ virtual_path,
+ file_flags,
+ callback_factory_.NewCallback(
+ &FileSystemOperation::DidOpenFile));
+}
+
// We can only get here on a write or truncate that's not yet completed.
// We don't support cancelling any other operation at this time.
void FileSystemOperation::Cancel(FileSystemOperation* cancel_operation_ptr) {
@@ -527,6 +573,17 @@ void FileSystemOperation::DidTouchFile(base::PlatformFileError rv) {
delete this;
}
+void FileSystemOperation::DidOpenFile(
+ base::PlatformFileError rv,
+ base::PassPlatformFile file,
+ bool unused) {
+ if (rv == base::PLATFORM_FILE_OK)
+ dispatcher_->DidOpenFile(file.ReleaseValue(), peer_handle_);
+ else
+ dispatcher_->DidFail(rv);
+ delete this;
+}
+
void FileSystemOperation::OnFileOpenedForWrite(
base::PlatformFileError rv,
base::PassPlatformFile file,
diff --git a/webkit/fileapi/file_system_operation.h b/webkit/fileapi/file_system_operation.h
index 8ca3be5..c726403 100644
--- a/webkit/fileapi/file_system_operation.h
+++ b/webkit/fileapi/file_system_operation.h
@@ -15,6 +15,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/message_loop_proxy.h"
#include "base/platform_file.h"
+#include "base/process.h"
#include "googleurl/src/gurl.h"
#include "webkit/fileapi/file_system_types.h"
#include "webkit/fileapi/file_system_operation_context.h"
@@ -79,6 +80,10 @@ class FileSystemOperation {
void TouchFile(const GURL& path,
const base::Time& last_access_time,
const base::Time& last_modified_time);
+ void OpenFile(
+ const GURL& path,
+ int file_flags,
+ base::ProcessHandle peer_handle);
// Try to cancel the current operation [we support cancelling write or
// truncate only]. Report failure for the current operation, then tell the
@@ -129,6 +134,10 @@ class FileSystemOperation {
int64 bytes,
bool complete);
void DidTouchFile(base::PlatformFileError rv);
+ void DidOpenFile(
+ base::PlatformFileError rv,
+ base::PassPlatformFile file,
+ bool created);
// Helper for Write().
void OnFileOpenedForWrite(
@@ -184,6 +193,7 @@ class FileSystemOperation {
kOperationWrite,
kOperationTruncate,
kOperationTouchFile,
+ kOperationOpenFile,
kOperationCancel,
};
@@ -206,6 +216,10 @@ class FileSystemOperation {
scoped_ptr<net::URLRequest> blob_request_;
scoped_ptr<FileSystemOperation> cancel_operation_;
+ // Used only by OpenFile, in order to clone the file handle back to the
+ // requesting process.
+ base::ProcessHandle peer_handle_;
+
DISALLOW_COPY_AND_ASSIGN(FileSystemOperation);
};
diff --git a/webkit/plugins/ppapi/mock_plugin_delegate.cc b/webkit/plugins/ppapi/mock_plugin_delegate.cc
index a893956..b0185ab 100644
--- a/webkit/plugins/ppapi/mock_plugin_delegate.cc
+++ b/webkit/plugins/ppapi/mock_plugin_delegate.cc
@@ -77,6 +77,11 @@ bool MockPluginDelegate::AsyncOpenFile(const FilePath& path,
return false;
}
+bool MockPluginDelegate::AsyncOpenFileSystemURL(
+ const GURL& path, int flags, AsyncOpenFileCallback* callback) {
+ return false;
+}
+
bool MockPluginDelegate::OpenFileSystem(
const GURL& url,
fileapi::FileSystemType type,
diff --git a/webkit/plugins/ppapi/mock_plugin_delegate.h b/webkit/plugins/ppapi/mock_plugin_delegate.h
index 557d7f3..98f769f 100644
--- a/webkit/plugins/ppapi/mock_plugin_delegate.h
+++ b/webkit/plugins/ppapi/mock_plugin_delegate.h
@@ -37,6 +37,9 @@ class MockPluginDelegate : public PluginDelegate {
virtual bool AsyncOpenFile(const FilePath& path,
int flags,
AsyncOpenFileCallback* callback);
+ virtual bool AsyncOpenFileSystemURL(const GURL& path,
+ int flags,
+ AsyncOpenFileCallback* callback);
virtual bool OpenFileSystem(
const GURL& url,
fileapi::FileSystemType type,
diff --git a/webkit/plugins/ppapi/plugin_delegate.h b/webkit/plugins/ppapi/plugin_delegate.h
index 68a6471..212889a 100644
--- a/webkit/plugins/ppapi/plugin_delegate.h
+++ b/webkit/plugins/ppapi/plugin_delegate.h
@@ -284,6 +284,9 @@ class PluginDelegate {
virtual bool AsyncOpenFile(const FilePath& path,
int flags,
AsyncOpenFileCallback* callback) = 0;
+ virtual bool AsyncOpenFileSystemURL(const GURL& path,
+ int flags,
+ AsyncOpenFileCallback* callback) = 0;
virtual bool OpenFileSystem(
const GURL& url,
diff --git a/webkit/plugins/ppapi/ppb_file_io_impl.cc b/webkit/plugins/ppapi/ppb_file_io_impl.cc
index 624ced4..20a95db 100644
--- a/webkit/plugins/ppapi/ppb_file_io_impl.cc
+++ b/webkit/plugins/ppapi/ppb_file_io_impl.cc
@@ -253,13 +253,26 @@ int32_t PPB_FileIO_Impl::Open(PPB_FileRef_Impl* file_ref,
} else {
flags |= base::PLATFORM_FILE_OPEN;
}
-
file_system_type_ = file_ref->GetFileSystemType();
- if (!instance()->delegate()->AsyncOpenFile(
- file_ref->GetSystemPath(), flags,
- callback_factory_.NewCallback(
- &PPB_FileIO_Impl::AsyncOpenFileCallback)))
- return PP_ERROR_FAILED;
+ switch (file_system_type_) {
+ case PP_FILESYSTEMTYPE_EXTERNAL:
+ if (!instance()->delegate()->AsyncOpenFile(
+ file_ref->GetSystemPath(), flags,
+ callback_factory_.NewCallback(
+ &PPB_FileIO_Impl::AsyncOpenFileCallback)))
+ return PP_ERROR_FAILED;
+ break;
+ case PP_FILESYSTEMTYPE_LOCALPERSISTENT:
+ case PP_FILESYSTEMTYPE_LOCALTEMPORARY:
+ if (!instance()->delegate()->AsyncOpenFileSystemURL(
+ file_ref->GetFileSystemURL(), flags,
+ callback_factory_.NewCallback(
+ &PPB_FileIO_Impl::AsyncOpenFileCallback)))
+ return PP_ERROR_FAILED;
+ break;
+ default:
+ return PP_ERROR_FAILED;
+ }
RegisterCallback(callback);
return PP_OK_COMPLETIONPENDING;
diff --git a/webkit/plugins/ppapi/ppb_file_ref_impl.cc b/webkit/plugins/ppapi/ppb_file_ref_impl.cc
index b048caf..8ab57e7 100644
--- a/webkit/plugins/ppapi/ppb_file_ref_impl.cc
+++ b/webkit/plugins/ppapi/ppb_file_ref_impl.cc
@@ -340,7 +340,9 @@ GURL PPB_FileRef_Impl::GetFileSystemURL() const {
// Since |virtual_path_| starts with a '/', it looks like an absolute path.
// We need to trim off the '/' before calling Resolve, as FileSystem URLs
// start with a storage type identifier that looks like a path segment.
- return file_system_->root_url().Resolve(virtual_path_.substr(1));
+ // TODO(ericu): Switch this to use Resolve after fixing GURL to understand
+ // FileSystem URLs.
+ return GURL(file_system_->root_url().spec() + virtual_path_.substr(1));
}
} // namespace ppapi