summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.cc9
-rw-r--r--chrome/browser/renderer_host/pepper/pepper_crx_file_system_message_filter.cc119
-rw-r--r--chrome/browser/renderer_host/pepper/pepper_crx_file_system_message_filter.h67
-rw-r--r--chrome/chrome_browser.gypi2
-rw-r--r--content/renderer/pepper/pepper_file_io_host.cc3
-rw-r--r--content/renderer/pepper/pepper_file_system_host.cc41
-rw-r--r--content/renderer/pepper/pepper_file_system_host.h3
-rw-r--r--content/renderer/pepper/pepper_in_process_resource_creation.cc1
-rw-r--r--content/renderer/pepper/renderer_ppapi_host_impl.cc3
-rw-r--r--ppapi/api/pp_file_info.idl4
-rw-r--r--ppapi/api/ppb_file_system.idl4
-rw-r--r--ppapi/api/private/ppb_ext_crx_file_system_private.idl34
-rw-r--r--ppapi/c/pp_file_info.h6
-rw-r--r--ppapi/c/ppb_file_system.h6
-rw-r--r--ppapi/c/private/ppb_ext_crx_file_system_private.h59
-rw-r--r--ppapi/cpp/file_ref.h2
-rw-r--r--ppapi/cpp/file_system.cc4
-rw-r--r--ppapi/cpp/file_system.h6
-rw-r--r--ppapi/cpp/private/ext_crx_file_system_private.cc38
-rw-r--r--ppapi/cpp/private/ext_crx_file_system_private.h31
-rw-r--r--ppapi/examples/crxfs/crxfs.cc147
-rw-r--r--ppapi/examples/crxfs/crxfs.html32
-rw-r--r--ppapi/examples/crxfs/crxfs.js23
-rw-r--r--ppapi/examples/crxfs/manifest.json14
-rw-r--r--ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c22
-rw-r--r--ppapi/ppapi_host.gypi1
-rw-r--r--ppapi/ppapi_proxy.gypi6
-rw-r--r--ppapi/ppapi_shared.gypi2
-rw-r--r--ppapi/ppapi_sources.gypi3
-rw-r--r--ppapi/ppapi_tests.gypi10
-rw-r--r--ppapi/proxy/ext_crx_file_system_private_resource.cc80
-rw-r--r--ppapi/proxy/ext_crx_file_system_private_resource.h68
-rw-r--r--ppapi/proxy/file_system_resource.cc5
-rw-r--r--ppapi/proxy/file_system_resource.h2
-rw-r--r--ppapi/proxy/interface_list.cc1
-rw-r--r--ppapi/proxy/ppapi_messages.h8
-rw-r--r--ppapi/proxy/ppapi_param_traits.cc3
-rw-r--r--ppapi/proxy/ppb_instance_proxy.cc4
-rw-r--r--ppapi/proxy/resource_creation_proxy.cc10
-rw-r--r--ppapi/proxy/resource_creation_proxy.h3
-rw-r--r--ppapi/shared_impl/resource.h1
-rw-r--r--ppapi/shared_impl/singleton_resource_id.h1
-rw-r--r--ppapi/tests/all_c_includes.h1
-rw-r--r--ppapi/thunk/interfaces_ppb_private_no_permissions.h2
-rw-r--r--ppapi/thunk/ppb_ext_crx_file_system_private_api.h34
-rw-r--r--ppapi/thunk/ppb_ext_crx_file_system_private_thunk.cc48
-rw-r--r--ppapi/thunk/ppb_mouse_lock_thunk.cc7
-rw-r--r--ppapi/thunk/resource_creation_api.h2
-rw-r--r--webkit/plugins/ppapi/plugin_module.cc1
-rw-r--r--webkit/plugins/ppapi/ppapi_plugin_instance.cc1
-rw-r--r--webkit/plugins/ppapi/ppb_file_ref_impl.cc6
-rw-r--r--webkit/plugins/ppapi/resource_creation_impl.cc6
-rw-r--r--webkit/plugins/ppapi/resource_creation_impl.h2
53 files changed, 978 insertions, 20 deletions
diff --git a/chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.cc b/chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.cc
index b90d1f1..69a6ef3 100644
--- a/chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.cc
+++ b/chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h"
#include "chrome/browser/renderer_host/pepper/pepper_broker_message_filter.h"
+#include "chrome/browser/renderer_host/pepper/pepper_crx_file_system_message_filter.h"
#include "chrome/browser/renderer_host/pepper/pepper_flash_browser_host.h"
#include "chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.h"
#include "chrome/browser/renderer_host/pepper/pepper_flash_device_id_host.h"
@@ -52,6 +53,14 @@ scoped_ptr<ResourceHost> ChromeBrowserPepperHostFactory::CreateResourceHost(
host_->GetPpapiHost(), instance, params.pp_resource(),
broker_filter));
}
+ case PpapiHostMsg_Ext_CrxFileSystem_Create::ID: {
+ PepperCrxFileSystemMessageFilter* crxfs_filter =
+ PepperCrxFileSystemMessageFilter::Create(instance, host_);
+ if (!crxfs_filter)
+ return scoped_ptr<ResourceHost>();
+ return scoped_ptr<ResourceHost>(new MessageFilterHost(
+ host, instance, params.pp_resource(), crxfs_filter));
+ }
case PpapiHostMsg_Talk_Create::ID:
return scoped_ptr<ResourceHost>(new PepperTalkHost(
host_, instance, params.pp_resource()));
diff --git a/chrome/browser/renderer_host/pepper/pepper_crx_file_system_message_filter.cc b/chrome/browser/renderer_host/pepper/pepper_crx_file_system_message_filter.cc
new file mode 100644
index 0000000..0a95a17
--- /dev/null
+++ b/chrome/browser/renderer_host/pepper/pepper_crx_file_system_message_filter.cc
@@ -0,0 +1,119 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/renderer_host/pepper/pepper_crx_file_system_message_filter.h"
+
+#include "chrome/browser/browser_process.h"
+#include "chrome/browser/extensions/extension_service.h"
+#include "chrome/browser/extensions/extension_system.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/profiles/profile_manager.h"
+#include "chrome/common/extensions/extension.h"
+#include "content/public/browser/browser_ppapi_host.h"
+#include "content/public/browser/child_process_security_policy.h"
+#include "extensions/common/constants.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/host/dispatch_host_message.h"
+#include "ppapi/host/host_message_context.h"
+#include "ppapi/host/ppapi_host.h"
+#include "ppapi/proxy/ppapi_messages.h"
+#include "webkit/fileapi/isolated_context.h"
+
+namespace chrome {
+
+// static
+PepperCrxFileSystemMessageFilter* PepperCrxFileSystemMessageFilter::Create(
+ PP_Instance instance, content::BrowserPpapiHost* host) {
+ int render_process_id;
+ int unused_render_view_id;
+ if (!host->GetRenderViewIDsForInstance(instance,
+ &render_process_id,
+ &unused_render_view_id)) {
+ return NULL;
+ }
+ return new PepperCrxFileSystemMessageFilter(
+ render_process_id,
+ host->GetProfileDataDirectory(),
+ host->GetDocumentURLForInstance(instance));
+}
+
+PepperCrxFileSystemMessageFilter::PepperCrxFileSystemMessageFilter(
+ int render_process_id,
+ const base::FilePath& profile_directory,
+ const GURL& document_url)
+ : render_process_id_(render_process_id),
+ profile_directory_(profile_directory),
+ document_url_(document_url) {
+}
+
+PepperCrxFileSystemMessageFilter::~PepperCrxFileSystemMessageFilter() {
+}
+
+scoped_refptr<base::TaskRunner>
+PepperCrxFileSystemMessageFilter::OverrideTaskRunnerForMessage(
+ const IPC::Message& msg) {
+ // In order to reach ExtensionSystem, we need to get ProfileManager first.
+ // ProfileManager lives in UI thread, so we need to do this in UI thread.
+ return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI);
+}
+
+int32_t PepperCrxFileSystemMessageFilter::OnResourceMessageReceived(
+ const IPC::Message& msg,
+ ppapi::host::HostMessageContext* context) {
+ IPC_BEGIN_MESSAGE_MAP(PepperCrxFileSystemMessageFilter, msg)
+ PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(
+ PpapiHostMsg_Ext_CrxFileSystem_BrowserOpen, OnOpenFileSystem);
+ IPC_END_MESSAGE_MAP()
+ return PP_ERROR_FAILED;
+}
+
+std::string PepperCrxFileSystemMessageFilter::CreateIsolatedFileSystem() {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ if (!document_url_.SchemeIs(extensions::kExtensionScheme))
+ return std::string();
+
+ ProfileManager* profile_manager = g_browser_process->profile_manager();
+ Profile* profile = profile_manager->GetProfile(profile_directory_);
+ extensions::ExtensionSystem* extension_system =
+ extensions::ExtensionSystem::Get(profile);
+ if (!extension_system)
+ return std::string();
+
+ const ExtensionService* extension_service =
+ extension_system->extension_service();
+ if (!extension_service)
+ return std::string();
+
+ const extensions::Extension* extension =
+ extension_service->GetExtensionById(document_url_.host(), false);
+ if (!extension)
+ return std::string();
+
+ // First level directory for isolated filesystem to lookup.
+ std::string kFirstLevelDirectory("crxfs");
+ return fileapi::IsolatedContext::GetInstance()->
+ RegisterFileSystemForPath(fileapi::kFileSystemTypeNativeLocal,
+ extension->path(),
+ &kFirstLevelDirectory);
+}
+
+int32_t PepperCrxFileSystemMessageFilter::OnOpenFileSystem(
+ ppapi::host::HostMessageContext* context) {
+ const std::string fsid = CreateIsolatedFileSystem();
+ if (fsid.empty()) {
+ context->reply_msg =
+ PpapiPluginMsg_Ext_CrxFileSystem_BrowserOpenReply(std::string());
+ return PP_ERROR_NOTSUPPORTED;
+ }
+
+ // Grant readonly access of isolated filesystem to renderer process.
+ content::ChildProcessSecurityPolicy* policy =
+ content::ChildProcessSecurityPolicy::GetInstance();
+ policy->GrantReadFileSystem(render_process_id_, fsid);
+
+ context->reply_msg = PpapiPluginMsg_Ext_CrxFileSystem_BrowserOpenReply(fsid);
+ return PP_OK;
+}
+
+} // namespace chrome
diff --git a/chrome/browser/renderer_host/pepper/pepper_crx_file_system_message_filter.h b/chrome/browser/renderer_host/pepper/pepper_crx_file_system_message_filter.h
new file mode 100644
index 0000000..53669e1
--- /dev/null
+++ b/chrome/browser/renderer_host/pepper/pepper_crx_file_system_message_filter.h
@@ -0,0 +1,67 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_RENDERER_HOST_PEPPER_PEPPER_CRX_FILE_SYSTEM_MESSAGE_FILTER_H_
+#define CHROME_BROWSER_RENDERER_HOST_PEPPER_PEPPER_CRX_FILE_SYSTEM_MESSAGE_FILTER_H_
+
+#include <string>
+
+#include "base/files/file_path.h"
+#include "googleurl/src/gurl.h"
+#include "ppapi/c/pp_instance.h"
+#include "ppapi/c/pp_resource.h"
+#include "ppapi/host/resource_host.h"
+#include "ppapi/host/resource_message_filter.h"
+
+namespace content {
+class BrowserPpapiHost;
+}
+
+namespace ppapi {
+namespace host {
+struct HostMessageContext;
+} // namespace host
+} // namespace ppapi
+
+namespace chrome {
+
+class PepperCrxFileSystemMessageFilter
+ : public ppapi::host::ResourceMessageFilter {
+ public:
+ static PepperCrxFileSystemMessageFilter* Create(
+ PP_Instance instance,
+ content::BrowserPpapiHost* host);
+
+ // ppapi::host::ResourceMessageFilter implementation.
+ virtual scoped_refptr<base::TaskRunner> OverrideTaskRunnerForMessage(
+ const IPC::Message& msg) OVERRIDE;
+ virtual int32_t OnResourceMessageReceived(
+ const IPC::Message& msg,
+ ppapi::host::HostMessageContext* context) OVERRIDE;
+
+ private:
+ PepperCrxFileSystemMessageFilter(
+ int render_process_id,
+ const base::FilePath& profile_directory,
+ const GURL& document_url);
+
+ virtual ~PepperCrxFileSystemMessageFilter();
+
+ // Returns filesystem id of isolated filesystem if valid, or empty string
+ // otherwise. This must run on the UI thread because ProfileManager only
+ // allows access on that thread.
+ std::string CreateIsolatedFileSystem();
+
+ int32_t OnOpenFileSystem(ppapi::host::HostMessageContext* context);
+
+ const int render_process_id_;
+ const base::FilePath& profile_directory_;
+ const GURL document_url_;
+
+ DISALLOW_COPY_AND_ASSIGN(PepperCrxFileSystemMessageFilter);
+};
+
+} // namespace chrome
+
+#endif // CHROME_BROWSER_RENDERER_HOST_PEPPER_PEPPER_CRX_FILE_SYSTEM_MESSAGE_FILTER_H_
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 8daf9b2..2025200 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -1611,6 +1611,8 @@
'browser/renderer_host/pepper/device_id_fetcher.cc',
'browser/renderer_host/pepper/pepper_broker_message_filter.cc',
'browser/renderer_host/pepper/pepper_broker_message_filter.h',
+ 'browser/renderer_host/pepper/pepper_crx_file_system_message_filter.cc',
+ 'browser/renderer_host/pepper/pepper_crx_file_system_message_filter.h',
'browser/renderer_host/pepper/pepper_flash_browser_host.cc',
'browser/renderer_host/pepper/pepper_flash_browser_host.h',
'browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.cc',
diff --git a/content/renderer/pepper/pepper_file_io_host.cc b/content/renderer/pepper/pepper_file_io_host.cc
index cec0b3e..f2e08df 100644
--- a/content/renderer/pepper/pepper_file_io_host.cc
+++ b/content/renderer/pepper/pepper_file_io_host.cc
@@ -149,7 +149,8 @@ int32_t PepperFileIOHost::OnHostMsgOpen(
PP_FileSystemType type = file_ref_api->GetFileSystemType();
if (type != PP_FILESYSTEMTYPE_LOCALPERSISTENT &&
type != PP_FILESYSTEMTYPE_LOCALTEMPORARY &&
- type != PP_FILESYSTEMTYPE_EXTERNAL)
+ type != PP_FILESYSTEMTYPE_EXTERNAL &&
+ type != PP_FILESYSTEMTYPE_ISOLATED)
return PP_ERROR_FAILED;
file_system_type_ = type;
diff --git a/content/renderer/pepper/pepper_file_system_host.cc b/content/renderer/pepper/pepper_file_system_host.cc
index f29ef65..13bff9a 100644
--- a/content/renderer/pepper/pepper_file_system_host.cc
+++ b/content/renderer/pepper/pepper_file_system_host.cc
@@ -8,6 +8,7 @@
#include "base/callback.h"
#include "content/common/child_thread.h"
#include "content/common/fileapi/file_system_dispatcher.h"
+#include "content/public/renderer/render_view.h"
#include "content/public/renderer/renderer_ppapi_host.h"
#include "content/renderer/pepper/null_file_system_callback_dispatcher.h"
#include "ppapi/c/pp_errors.h"
@@ -19,6 +20,8 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
+#include "webkit/fileapi/file_system_util.h"
#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
namespace content {
@@ -50,6 +53,19 @@ class PlatformCallbackAdaptor : public NullFileSystemCallbackDispatcher {
base::WeakPtr<PepperFileSystemHost> weak_host_;
};
+bool LooksLikeAGuid(const std::string& fsid) {
+ const size_t kExpectedFsIdSize = 32;
+ if (fsid.size() != kExpectedFsIdSize)
+ return false;
+ for (std::string::const_iterator it = fsid.begin(); it != fsid.end(); ++it) {
+ if (('A' <= *it && *it <= 'F') ||
+ ('0' <= *it && *it <= '9'))
+ continue;
+ return false;
+ }
+ return true;
+}
+
} // namespace
PepperFileSystemHost::PepperFileSystemHost(RendererPpapiHost* host,
@@ -71,8 +87,12 @@ int32_t PepperFileSystemHost::OnResourceMessageReceived(
const IPC::Message& msg,
ppapi::host::HostMessageContext* context) {
IPC_BEGIN_MESSAGE_MAP(PepperFileSystemHost, msg)
- PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_FileSystem_Open,
- OnHostMsgOpen)
+ PPAPI_DISPATCH_HOST_RESOURCE_CALL(
+ PpapiHostMsg_FileSystem_Open,
+ OnHostMsgOpen)
+ PPAPI_DISPATCH_HOST_RESOURCE_CALL(
+ PpapiHostMsg_FileSystem_InitIsolatedFileSystem,
+ OnHostMsgInitIsolatedFileSystem)
IPC_END_MESSAGE_MAP()
return PP_ERROR_FAILED;
}
@@ -129,4 +149,21 @@ int32_t PepperFileSystemHost::OnHostMsgOpen(
return PP_OK_COMPLETIONPENDING;
}
+int32_t PepperFileSystemHost::OnHostMsgInitIsolatedFileSystem(
+ ppapi::host::HostMessageContext* context,
+ const std::string& fsid) {
+ // Do a sanity check.
+ if (!LooksLikeAGuid(fsid))
+ return PP_ERROR_BADARGUMENT;
+ RenderView* view =
+ renderer_ppapi_host_->GetRenderViewForInstance(pp_instance());
+ if (!view)
+ return PP_ERROR_FAILED;
+ const GURL& url = view->GetWebView()->mainFrame()->document().url();
+ root_url_ = GURL(fileapi::GetIsolatedFileSystemRootURIString(
+ url.GetOrigin(), fsid, "crxfs"));
+ opened_ = true;
+ return PP_OK;
+}
+
} // namespace content
diff --git a/content/renderer/pepper/pepper_file_system_host.h b/content/renderer/pepper/pepper_file_system_host.h
index 92f69a6..90ba4e0 100644
--- a/content/renderer/pepper/pepper_file_system_host.h
+++ b/content/renderer/pepper/pepper_file_system_host.h
@@ -43,6 +43,9 @@ class PepperFileSystemHost :
private:
int32_t OnHostMsgOpen(ppapi::host::HostMessageContext* context,
int64_t expected_size);
+ int32_t OnHostMsgInitIsolatedFileSystem(
+ ppapi::host::HostMessageContext* context,
+ const std::string& fsid);
RendererPpapiHost* renderer_ppapi_host_;
ppapi::host::ReplyMessageContext reply_context_;
diff --git a/content/renderer/pepper/pepper_in_process_resource_creation.cc b/content/renderer/pepper/pepper_in_process_resource_creation.cc
index 4ce8a08..d695697 100644
--- a/content/renderer/pepper/pepper_in_process_resource_creation.cc
+++ b/content/renderer/pepper/pepper_in_process_resource_creation.cc
@@ -15,6 +15,7 @@
#include "ipc/ipc_message_macros.h"
#include "ppapi/host/ppapi_host.h"
#include "ppapi/proxy/browser_font_resource_trusted.h"
+#include "ppapi/proxy/ext_crx_file_system_private_resource.h"
#include "ppapi/proxy/file_chooser_resource.h"
#include "ppapi/proxy/file_io_resource.h"
#include "ppapi/proxy/file_system_resource.h"
diff --git a/content/renderer/pepper/renderer_ppapi_host_impl.cc b/content/renderer/pepper/renderer_ppapi_host_impl.cc
index 4971d51..32ce540 100644
--- a/content/renderer/pepper/renderer_ppapi_host_impl.cc
+++ b/content/renderer/pepper/renderer_ppapi_host_impl.cc
@@ -17,6 +17,9 @@
#include "ppapi/host/ppapi_host.h"
#include "ppapi/proxy/host_dispatcher.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebRect.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h"
#include "ui/gfx/point.h"
#include "webkit/plugins/ppapi/fullscreen_container.h"
#include "webkit/plugins/ppapi/host_globals.h"
diff --git a/ppapi/api/pp_file_info.idl b/ppapi/api/pp_file_info.idl
index 0d2c3b60..9cccc89 100644
--- a/ppapi/api/pp_file_info.idl
+++ b/ppapi/api/pp_file_info.idl
@@ -32,7 +32,9 @@ enum PP_FileSystemType {
/** For local persistent file system types */
PP_FILESYSTEMTYPE_LOCALPERSISTENT = 2,
/** For local temporary file system types */
- PP_FILESYSTEMTYPE_LOCALTEMPORARY = 3
+ PP_FILESYSTEMTYPE_LOCALTEMPORARY = 3,
+ /** For isolated file system types */
+ PP_FILESYSTEMTYPE_ISOLATED = 4
};
/**
diff --git a/ppapi/api/ppb_file_system.idl b/ppapi/api/ppb_file_system.idl
index cd15cc8..c66b6a1 100644
--- a/ppapi/api/ppb_file_system.idl
+++ b/ppapi/api/ppb_file_system.idl
@@ -23,8 +23,8 @@ interface PPB_FileSystem {
* @param[in] instance A <code>PP_Instance</code> identifying the instance
* with the file.
* @param[in] type A file system type as defined by
- * <code>PP_FileSystemType</code> enum.
- *
+ * <code>PP_FileSystemType</code> enum (except PP_FILESYSTEMTYPE_ISOLATED,
+ * which is currently not supported).
* @return A <code>PP_Resource</code> corresponding to a file system if
* successful.
*/
diff --git a/ppapi/api/private/ppb_ext_crx_file_system_private.idl b/ppapi/api/private/ppb_ext_crx_file_system_private.idl
new file mode 100644
index 0000000..0458641
--- /dev/null
+++ b/ppapi/api/private/ppb_ext_crx_file_system_private.idl
@@ -0,0 +1,34 @@
+/* Copyright (c) 2013 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+[generate_thunk,thunk_include="ppapi/thunk/ppb_ext_crx_file_system_private_api.h"]
+
+/**
+ * This file contains the <code>PPB_Ext_CrxFileSystem_Private</code> interface.
+ */
+label Chrome {
+ M28 = 0.1
+};
+
+/* <code>PPB_Ext_CrxFileSystem_Private</code> interface */
+interface PPB_Ext_CrxFileSystem_Private {
+ /**
+ * Open() opens the CRX file system for the current extension. It will fail
+ * when called from non-extension context.
+ *
+ * @param[in] crxfs A <code>PP_Resource</code> corresponding to a
+ * CrxFileSystem.
+ * @param[out] file_system An output <code>PP_Resource</code> corresponding
+ * to a PPB_FileSystem.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
+ * completion of Open.
+ *
+ * @return An int32_t containing an error code from <code>pp_errors.h</code>.
+ */
+ [singleton,api=PPB_Ext_CrxFileSystem_Private_API]
+ int32_t Open([in] PP_Instance instance,
+ [out] PP_Resource file_system,
+ [in] PP_CompletionCallback callback);
+};
diff --git a/ppapi/c/pp_file_info.h b/ppapi/c/pp_file_info.h
index e53cae1..1f0c52a 100644
--- a/ppapi/c/pp_file_info.h
+++ b/ppapi/c/pp_file_info.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From pp_file_info.idl modified Thu Mar 28 11:11:01 2013. */
+/* From pp_file_info.idl modified Thu May 2 16:41:50 2013. */
#ifndef PPAPI_C_PP_FILE_INFO_H_
#define PPAPI_C_PP_FILE_INFO_H_
@@ -46,7 +46,9 @@ typedef enum {
/** For local persistent file system types */
PP_FILESYSTEMTYPE_LOCALPERSISTENT = 2,
/** For local temporary file system types */
- PP_FILESYSTEMTYPE_LOCALTEMPORARY = 3
+ PP_FILESYSTEMTYPE_LOCALTEMPORARY = 3,
+ /** For isolated file system types */
+ PP_FILESYSTEMTYPE_ISOLATED = 4
} PP_FileSystemType;
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_FileSystemType, 4);
/**
diff --git a/ppapi/c/ppb_file_system.h b/ppapi/c/ppb_file_system.h
index 73910d6..28b8cca 100644
--- a/ppapi/c/ppb_file_system.h
+++ b/ppapi/c/ppb_file_system.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From ppb_file_system.idl modified Mon May 21 15:19:32 2012. */
+/* From ppb_file_system.idl modified Thu May 2 16:44:38 2013. */
#ifndef PPAPI_C_PPB_FILE_SYSTEM_H_
#define PPAPI_C_PPB_FILE_SYSTEM_H_
@@ -39,8 +39,8 @@ struct PPB_FileSystem_1_0 {
* @param[in] instance A <code>PP_Instance</code> identifying the instance
* with the file.
* @param[in] type A file system type as defined by
- * <code>PP_FileSystemType</code> enum.
- *
+ * <code>PP_FileSystemType</code> enum (except PP_FILESYSTEMTYPE_ISOLATED,
+ * which is currently not supported).
* @return A <code>PP_Resource</code> corresponding to a file system if
* successful.
*/
diff --git a/ppapi/c/private/ppb_ext_crx_file_system_private.h b/ppapi/c/private/ppb_ext_crx_file_system_private.h
new file mode 100644
index 0000000..114a016
--- /dev/null
+++ b/ppapi/c/private/ppb_ext_crx_file_system_private.h
@@ -0,0 +1,59 @@
+/* Copyright (c) 2013 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* From private/ppb_ext_crx_file_system_private.idl,
+ * modified Fri May 3 09:55:27 2013.
+ */
+
+#ifndef PPAPI_C_PRIVATE_PPB_EXT_CRX_FILE_SYSTEM_PRIVATE_H_
+#define PPAPI_C_PRIVATE_PPB_EXT_CRX_FILE_SYSTEM_PRIVATE_H_
+
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_instance.h"
+#include "ppapi/c/pp_macros.h"
+#include "ppapi/c/pp_resource.h"
+#include "ppapi/c/pp_stdint.h"
+
+#define PPB_EXT_CRXFILESYSTEM_PRIVATE_INTERFACE_0_1 \
+ "PPB_Ext_CrxFileSystem_Private;0.1"
+#define PPB_EXT_CRXFILESYSTEM_PRIVATE_INTERFACE \
+ PPB_EXT_CRXFILESYSTEM_PRIVATE_INTERFACE_0_1
+
+/**
+ * @file
+ */
+
+
+/**
+ * @addtogroup Interfaces
+ * @{
+ */
+/* <code>PPB_Ext_CrxFileSystem_Private</code> interface */
+struct PPB_Ext_CrxFileSystem_Private_0_1 {
+ /**
+ * Open() opens the CRX file system for the current extension. It will fail
+ * when called from non-extension context.
+ *
+ * @param[in] crxfs A <code>PP_Resource</code> corresponding to a
+ * CrxFileSystem.
+ * @param[out] file_system An output <code>PP_Resource</code> corresponding
+ * to a PPB_FileSystem.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
+ * completion of Open.
+ *
+ * @return An int32_t containing an error code from <code>pp_errors.h</code>.
+ */
+ int32_t (*Open)(PP_Instance instance,
+ PP_Resource* file_system,
+ struct PP_CompletionCallback callback);
+};
+
+typedef struct PPB_Ext_CrxFileSystem_Private_0_1 PPB_Ext_CrxFileSystem_Private;
+/**
+ * @}
+ */
+
+#endif /* PPAPI_C_PRIVATE_PPB_EXT_CRX_FILE_SYSTEM_PRIVATE_H_ */
+
diff --git a/ppapi/cpp/file_ref.h b/ppapi/cpp/file_ref.h
index b7e5e65..8b008ac 100644
--- a/ppapi/cpp/file_ref.h
+++ b/ppapi/cpp/file_ref.h
@@ -47,7 +47,7 @@ class FileRef : public Resource {
/// system. File paths are POSIX style.
///
/// @param[in] file_system A <code>FileSystem</code> corresponding to a file
- /// system typ.
+ /// system type.
/// @param[in] path A path to the file.
FileRef(const FileSystem& file_system, const char* path);
diff --git a/ppapi/cpp/file_system.cc b/ppapi/cpp/file_system.cc
index 022288c..de14c36 100644
--- a/ppapi/cpp/file_system.cc
+++ b/ppapi/cpp/file_system.cc
@@ -25,6 +25,10 @@ template <> const char* interface_name<PPB_FileSystem_1_0>() {
FileSystem::FileSystem() {
}
+FileSystem::FileSystem(PassRef, PP_Resource resource)
+ : Resource(PASS_REF, resource) {
+}
+
FileSystem::FileSystem(const InstanceHandle& instance,
PP_FileSystemType type) {
if (!has_interface<PPB_FileSystem_1_0>())
diff --git a/ppapi/cpp/file_system.h b/ppapi/cpp/file_system.h
index 3dc7758..6b67ca3 100644
--- a/ppapi/cpp/file_system.h
+++ b/ppapi/cpp/file_system.h
@@ -28,6 +28,12 @@ class FileSystem : public Resource {
/// use it.
FileSystem();
+ /// A constructor used when you have received a PP_Resource as a return
+ /// value that has already been reference counted.
+ ///
+ /// @param[in] resource A PP_Resource corresponding to a PPB_FileSystem.
+ FileSystem(PassRef, PP_Resource resource);
+
/// This constructor creates a file system object of the given type.
///
/// @param[in] instance The instance with which this resource will be
diff --git a/ppapi/cpp/private/ext_crx_file_system_private.cc b/ppapi/cpp/private/ext_crx_file_system_private.cc
new file mode 100644
index 0000000..87752b9
--- /dev/null
+++ b/ppapi/cpp/private/ext_crx_file_system_private.cc
@@ -0,0 +1,38 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/cpp/private/ext_crx_file_system_private.h"
+
+#include "ppapi/c/private/ppb_ext_crx_file_system_private.h"
+#include "ppapi/cpp/module_impl.h"
+
+namespace pp {
+
+namespace {
+
+template <> const char* interface_name<PPB_Ext_CrxFileSystem_Private_0_1>() {
+ return PPB_EXT_CRXFILESYSTEM_PRIVATE_INTERFACE_0_1;
+}
+
+} // namespace
+
+ExtCrxFileSystemPrivate::ExtCrxFileSystemPrivate() {
+}
+
+ExtCrxFileSystemPrivate::ExtCrxFileSystemPrivate(
+ const InstanceHandle& instance) : instance_(instance.pp_instance()) {
+}
+
+ExtCrxFileSystemPrivate::~ExtCrxFileSystemPrivate() {
+}
+
+int32_t ExtCrxFileSystemPrivate::Open(
+ const CompletionCallbackWithOutput<pp::FileSystem>& cc) {
+ if (!has_interface<PPB_Ext_CrxFileSystem_Private_0_1>())
+ return cc.MayForce(PP_ERROR_NOINTERFACE);
+ return get_interface<PPB_Ext_CrxFileSystem_Private_0_1>()->
+ Open(instance_, cc.output(), cc.pp_completion_callback());
+}
+
+} // namespace pp
diff --git a/ppapi/cpp/private/ext_crx_file_system_private.h b/ppapi/cpp/private/ext_crx_file_system_private.h
new file mode 100644
index 0000000..e307f91
--- /dev/null
+++ b/ppapi/cpp/private/ext_crx_file_system_private.h
@@ -0,0 +1,31 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_CPP_PRIVATE_EXTENSION_CRX_FILE_SYSTEM_PRIVATE_H_
+#define PPAPI_CPP_PRIVATE_EXTENSION_CRX_FILE_SYSTEM_PRIVATE_H_
+
+#include "ppapi/c/pp_instance.h"
+#include "ppapi/cpp/completion_callback.h"
+#include "ppapi/cpp/file_system.h"
+#include "ppapi/cpp/instance_handle.h"
+
+namespace pp {
+
+class CompletionCallback;
+
+class ExtCrxFileSystemPrivate {
+ public:
+ ExtCrxFileSystemPrivate();
+ explicit ExtCrxFileSystemPrivate(const InstanceHandle& instance);
+ virtual ~ExtCrxFileSystemPrivate();
+
+ int32_t Open(const CompletionCallbackWithOutput<pp::FileSystem>& cc);
+
+ private:
+ PP_Instance instance_;
+};
+
+} // namespace pp
+
+#endif // PPAPI_CPP_PRIVATE_EXTENSION_CRX_FILE_SYSTEM_PRIVATE_H_
diff --git a/ppapi/examples/crxfs/crxfs.cc b/ppapi/examples/crxfs/crxfs.cc
new file mode 100644
index 0000000..5e4b422
--- /dev/null
+++ b/ppapi/examples/crxfs/crxfs.cc
@@ -0,0 +1,147 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <sstream>
+
+#include "ppapi/c/ppb_file_io.h"
+#include "ppapi/cpp/file_io.h"
+#include "ppapi/cpp/file_ref.h"
+#include "ppapi/cpp/instance.h"
+#include "ppapi/cpp/module.h"
+#include "ppapi/cpp/private/ext_crx_file_system_private.h"
+#include "ppapi/utility/completion_callback_factory.h"
+
+// When compiling natively on Windows, PostMessage can be #define-d to
+// something else.
+#ifdef PostMessage
+#undef PostMessage
+#endif
+
+// Buffer size for reading file.
+const size_t kBufSize = 1024;
+
+class MyInstance : public pp::Instance {
+ public:
+ explicit MyInstance(PP_Instance instance)
+ : pp::Instance(instance),
+ handle_(instance) {
+ factory_.Initialize(this);
+ }
+ virtual ~MyInstance() {
+ }
+
+ // Handler for the page sending us messages.
+ virtual void HandleMessage(const pp::Var& message_data);
+
+ private:
+ void OpenCrxFsAndReadFile(const std::string& filename);
+
+ void CrxFileSystemCallback(int32_t pp_error, pp::FileSystem file_system);
+ void FileIOOpenCallback(int32_t pp_error);
+ void FileIOReadCallback(int32_t pp_error);
+
+ // Forwards the given string to the page.
+ void ReportResponse(const char* name, int32_t pp_error);
+
+ // Generates completion callbacks scoped to this class.
+ pp::CompletionCallbackFactory<MyInstance> factory_;
+
+ pp::InstanceHandle handle_;
+ pp::ExtCrxFileSystemPrivate crxfs_;
+ pp::FileRef file_ref_;
+ pp::FileIO file_io_;
+ std::string filename_;
+ char read_buf_[kBufSize];
+};
+
+void MyInstance::HandleMessage(const pp::Var& message_data) {
+ if (!message_data.is_string()) {
+ ReportResponse("HandleMessage: not a string", 0);
+ return;
+ }
+ std::string filename = message_data.AsString();
+ OpenCrxFsAndReadFile(filename);
+}
+
+void MyInstance::OpenCrxFsAndReadFile(const std::string& filename) {
+ filename_ = filename;
+
+ pp::CompletionCallbackWithOutput<pp::FileSystem> callback =
+ factory_.NewCallbackWithOutput(&MyInstance::CrxFileSystemCallback);
+
+ crxfs_ = pp::ExtCrxFileSystemPrivate(this);
+ int32_t rv = crxfs_.Open(callback);
+ if (rv != PP_OK_COMPLETIONPENDING)
+ ReportResponse("ExtCrxFileSystemPrivate::Open", rv);
+}
+
+void MyInstance::CrxFileSystemCallback(int32_t pp_error,
+ pp::FileSystem file_system) {
+ if (pp_error != PP_OK) {
+ ReportResponse("CrxFileSystemCallback", pp_error);
+ return;
+ }
+
+ file_io_ = pp::FileIO(handle_);
+ file_ref_ = pp::FileRef(file_system, filename_.c_str());
+ int32_t rv = file_io_.Open(
+ file_ref_, PP_FILEOPENFLAG_READ,
+ factory_.NewCallback(&MyInstance::FileIOOpenCallback));
+ if (rv != PP_OK_COMPLETIONPENDING)
+ ReportResponse("FileIO::Open", rv);
+}
+
+void MyInstance::FileIOOpenCallback(int32_t pp_error) {
+ if (pp_error != PP_OK) {
+ ReportResponse("FileIOOpenCallback", pp_error);
+ return;
+ }
+
+ int32_t rv = file_io_.Read(0, read_buf_, sizeof(read_buf_),
+ factory_.NewCallback(&MyInstance::FileIOReadCallback));
+ if (rv != PP_OK_COMPLETIONPENDING) {
+ ReportResponse("FileIO::Read", rv);
+ return;
+ }
+}
+
+void MyInstance::FileIOReadCallback(int32_t pp_error) {
+ if (pp_error < 0) {
+ ReportResponse("FileIOReadCallback", pp_error);
+ return;
+ }
+
+ std::string content;
+ content.append(read_buf_, pp_error);
+ PostMessage(pp::Var(content));
+}
+
+void MyInstance::ReportResponse(const char* name, int32_t rv) {
+ std::ostringstream out;
+ out << name << " failed, pp_error: " << rv;
+ PostMessage(pp::Var(out.str()));
+}
+
+// This object is the global object representing this plugin library as long
+// as it is loaded.
+class MyModule : public pp::Module {
+ public:
+ MyModule() : pp::Module() {}
+ virtual ~MyModule() {}
+
+ // Override CreateInstance to create your customized Instance object.
+ virtual pp::Instance* CreateInstance(PP_Instance instance) {
+ return new MyInstance(instance);
+ }
+};
+
+namespace pp {
+
+// Factory function for your specialization of the Module object.
+Module* CreateModule() {
+ return new MyModule();
+}
+
+} // namespace pp
+
diff --git a/ppapi/examples/crxfs/crxfs.html b/ppapi/examples/crxfs/crxfs.html
new file mode 100644
index 0000000..05c66a7
--- /dev/null
+++ b/ppapi/examples/crxfs/crxfs.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+ <!--
+ Copyright (c) 2013 The Chromium Authors. All rights reserved.
+ Use of this source code is governed by a BSD-style license that can be
+ found in the LICENSE file.
+
+ This example demostrates how to access CRX file system. The plugin will
+ return the content of the given file to the page to display.
+
+ Since the API is for CRX file system, you need to package this example
+ directory into a .crx to load, or simply click "Load unpacked extension" in
+ chrome://extensions/ with "Developer mode" checked.
+ -->
+<head>
+ <title>CrxFs Example</title>
+ <script src="crxfs.js"></script>
+</head>
+
+<body>
+
+ <button id="start">Open</button>
+ <input type="text" id="filename" value="/manifest.json"></input>
+ <object id="plugin" type="application/x-ppapi-example-crxfs"
+ width="1" height="1">
+ </object>
+ <br>
+ <textarea id="content" style="width: 80%; height: 300px;">
+ (output space)
+ </textarea>
+</body>
+</html>
diff --git a/ppapi/examples/crxfs/crxfs.js b/ppapi/examples/crxfs/crxfs.js
new file mode 100644
index 0000000..383f933
--- /dev/null
+++ b/ppapi/examples/crxfs/crxfs.js
@@ -0,0 +1,23 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+function StartRequest() {
+ var plugin = document.getElementById("plugin");
+ var filename = document.getElementById("filename").value;
+ plugin.postMessage(filename);
+}
+
+function HandleMessage(message_event) {
+ document.getElementById("content").value = message_event.data;
+}
+
+document.addEventListener('DOMContentLoaded', function () {
+ // Attach a listener for the message event. This must happen after the plugin
+ // object was created.
+ document.getElementById("plugin")
+ .addEventListener("message", HandleMessage, false);
+
+ document.getElementById("start")
+ .addEventListener("click", StartRequest, false);
+});
diff --git a/ppapi/examples/crxfs/manifest.json b/ppapi/examples/crxfs/manifest.json
new file mode 100644
index 0000000..5a83cad
--- /dev/null
+++ b/ppapi/examples/crxfs/manifest.json
@@ -0,0 +1,14 @@
+{
+ "name": "Crx FileSystem Test",
+ "version": "0.1",
+ "manifest_version": 2,
+ "description": "Crx FileSystem Test",
+ "app": {
+ "launch": {
+ "local_path": "crxfs.html"
+ }
+ },
+ "web_accessible_resources": [
+ "crxfs.js"
+ ]
+}
diff --git a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
index d14866b..fe06f54 100644
--- a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
+++ b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
@@ -77,6 +77,7 @@
#include "ppapi/c/ppp_messaging.h"
#include "ppapi/c/ppp_mouse_lock.h"
#include "ppapi/c/private/ppb_content_decryptor_private.h"
+#include "ppapi/c/private/ppb_ext_crx_file_system_private.h"
#include "ppapi/c/private/ppb_file_io_private.h"
#include "ppapi/c/private/ppb_file_ref_private.h"
#include "ppapi/c/private/ppb_flash.h"
@@ -234,6 +235,7 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_VideoDecoder_Dev_0_11;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Widget_Dev_0_2;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Zoom_Dev_0_3;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_6;
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Ext_CrxFileSystem_Private_0_1;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileIO_Private_0_1;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileRefPrivate_0_1;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_12_4;
@@ -2281,6 +2283,15 @@ static void Pnacl_M24_PPB_ContentDecryptor_Private_DeliverSamples(PP_Instance in
/* End wrapper methods for PPB_ContentDecryptor_Private_0_6 */
+/* Begin wrapper methods for PPB_Ext_CrxFileSystem_Private_0_1 */
+
+static int32_t Pnacl_M28_PPB_Ext_CrxFileSystem_Private_Open(PP_Instance instance, PP_Resource* file_system, struct PP_CompletionCallback* callback) {
+ const struct PPB_Ext_CrxFileSystem_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_Ext_CrxFileSystem_Private_0_1.real_iface;
+ return iface->Open(instance, file_system, *callback);
+}
+
+/* End wrapper methods for PPB_Ext_CrxFileSystem_Private_0_1 */
+
/* Begin wrapper methods for PPB_FileIO_Private_0_1 */
static int32_t Pnacl_M28_PPB_FileIO_Private_RequestOSFileHandle(PP_Resource file_io, PP_FileHandle* handle, struct PP_CompletionCallback* callback) {
@@ -4206,6 +4217,10 @@ struct PPB_ContentDecryptor_Private_0_6 Pnacl_Wrappers_PPB_ContentDecryptor_Priv
.DeliverSamples = (void (*)(PP_Instance instance, PP_Resource audio_frames, const struct PP_DecryptedBlockInfo* decrypted_block_info))&Pnacl_M24_PPB_ContentDecryptor_Private_DeliverSamples
};
+struct PPB_Ext_CrxFileSystem_Private_0_1 Pnacl_Wrappers_PPB_Ext_CrxFileSystem_Private_0_1 = {
+ .Open = (int32_t (*)(PP_Instance instance, PP_Resource* file_system, struct PP_CompletionCallback callback))&Pnacl_M28_PPB_Ext_CrxFileSystem_Private_Open
+};
+
struct PPB_FileIO_Private_0_1 Pnacl_Wrappers_PPB_FileIO_Private_0_1 = {
.RequestOSFileHandle = (int32_t (*)(PP_Resource file_io, PP_FileHandle* handle, struct PP_CompletionCallback callback))&Pnacl_M28_PPB_FileIO_Private_RequestOSFileHandle
};
@@ -5181,6 +5196,12 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_
.real_iface = NULL
};
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Ext_CrxFileSystem_Private_0_1 = {
+ .iface_macro = PPB_EXT_CRXFILESYSTEM_PRIVATE_INTERFACE_0_1,
+ .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_Ext_CrxFileSystem_Private_0_1,
+ .real_iface = NULL
+};
+
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileIO_Private_0_1 = {
.iface_macro = PPB_FILEIO_PRIVATE_INTERFACE_0_1,
.wrapped_iface = (void *) &Pnacl_Wrappers_PPB_FileIO_Private_0_1,
@@ -5532,6 +5553,7 @@ static struct __PnaclWrapperInfo *s_ppb_wrappers[] = {
&Pnacl_WrapperInfo_PPB_Widget_Dev_0_4,
&Pnacl_WrapperInfo_PPB_Zoom_Dev_0_2,
&Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_6,
+ &Pnacl_WrapperInfo_PPB_Ext_CrxFileSystem_Private_0_1,
&Pnacl_WrapperInfo_PPB_FileIO_Private_0_1,
&Pnacl_WrapperInfo_PPB_FileRefPrivate_0_1,
&Pnacl_WrapperInfo_PPB_Flash_12_4,
diff --git a/ppapi/ppapi_host.gypi b/ppapi/ppapi_host.gypi
index 4031c77..55bc545 100644
--- a/ppapi/ppapi_host.gypi
+++ b/ppapi/ppapi_host.gypi
@@ -13,6 +13,7 @@
'ppapi_internal.gyp:ppapi_ipc',
'ppapi_internal.gyp:ppapi_shared',
'../base/base.gyp:base',
+ '../build/temp_gyp/googleurl.gyp:googleurl',
'../ipc/ipc.gyp:ipc',
'../media/media.gyp:shared_memory_support',
'../ui/surface/surface.gyp:surface',
diff --git a/ppapi/ppapi_proxy.gypi b/ppapi/ppapi_proxy.gypi
index 51be328..242f899 100644
--- a/ppapi/ppapi_proxy.gypi
+++ b/ppapi/ppapi_proxy.gypi
@@ -37,8 +37,8 @@
'proxy/enter_proxy.h',
'proxy/extensions_common_resource.cc',
'proxy/extensions_common_resource.h',
- 'proxy/graphics_2d_resource.cc',
- 'proxy/graphics_2d_resource.h',
+ 'proxy/ext_crx_file_system_private_resource.cc',
+ 'proxy/ext_crx_file_system_private_resource.h',
'proxy/file_chooser_resource.cc',
'proxy/file_chooser_resource.h',
'proxy/flash_clipboard_resource.cc',
@@ -61,6 +61,8 @@
'proxy/file_system_resource.h',
'proxy/gamepad_resource.cc',
'proxy/gamepad_resource.h',
+ 'proxy/graphics_2d_resource.cc',
+ 'proxy/graphics_2d_resource.h',
'proxy/host_dispatcher.cc',
'proxy/host_dispatcher.h',
'proxy/host_resolver_private_resource.cc',
diff --git a/ppapi/ppapi_shared.gypi b/ppapi/ppapi_shared.gypi
index daa04bc..3bba9c6 100644
--- a/ppapi/ppapi_shared.gypi
+++ b/ppapi/ppapi_shared.gypi
@@ -156,6 +156,8 @@
'thunk/ppb_device_ref_api.h',
'thunk/ppb_device_ref_dev_thunk.cc',
'thunk/ppb_ext_alarms_thunk.cc',
+ 'thunk/ppb_ext_crx_file_system_private_api.h',
+ 'thunk/ppb_ext_crx_file_system_private_thunk.cc',
'thunk/ppb_ext_socket_thunk.cc',
'thunk/ppb_file_chooser_api.h',
'thunk/ppb_file_chooser_dev_thunk.cc',
diff --git a/ppapi/ppapi_sources.gypi b/ppapi/ppapi_sources.gypi
index 07a5b5c..95528e0 100644
--- a/ppapi/ppapi_sources.gypi
+++ b/ppapi/ppapi_sources.gypi
@@ -95,6 +95,7 @@
'c/private/pp_private_font_charset.h',
'c/private/pp_video_frame_private.h',
'c/private/ppb_content_decryptor_private.h',
+ 'c/private/ppb_ext_crx_file_system_private.h',
'c/private/ppb_flash.h',
'c/private/ppb_flash_clipboard.h',
'c/private/ppb_flash_file.h',
@@ -274,6 +275,8 @@
# Private interfaces.
'cpp/private/content_decryptor_private.cc',
'cpp/private/content_decryptor_private.h',
+ 'cpp/private/ext_crx_file_system_private.cc',
+ 'cpp/private/ext_crx_file_system_private.h',
'cpp/private/file_io_private.cc',
'cpp/private/file_io_private.h',
'cpp/private/flash.cc',
diff --git a/ppapi/ppapi_tests.gypi b/ppapi/ppapi_tests.gypi
index f1cb93e..ffd577f 100644
--- a/ppapi/ppapi_tests.gypi
+++ b/ppapi/ppapi_tests.gypi
@@ -271,6 +271,16 @@
],
},
{
+ 'target_name': 'ppapi_example_crxfs',
+ 'dependencies': [
+ 'ppapi_example_skeleton',
+ 'ppapi.gyp:ppapi_cpp',
+ ],
+ 'sources': [
+ 'examples/crxfs/crxfs.cc',
+ ],
+ },
+ {
'target_name': 'ppapi_example_audio',
'dependencies': [
'ppapi_example_skeleton',
diff --git a/ppapi/proxy/ext_crx_file_system_private_resource.cc b/ppapi/proxy/ext_crx_file_system_private_resource.cc
new file mode 100644
index 0000000..f0de598
--- /dev/null
+++ b/ppapi/proxy/ext_crx_file_system_private_resource.cc
@@ -0,0 +1,80 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/proxy/ext_crx_file_system_private_resource.h"
+
+#include "base/bind.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/proxy/ppapi_messages.h"
+#include "ppapi/proxy/resource_message_params.h"
+#include "ppapi/shared_impl/host_resource.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+
+namespace ppapi {
+namespace proxy {
+
+ExtCrxFileSystemPrivateResource::ExtCrxFileSystemPrivateResource(
+ Connection connection, PP_Instance instance)
+ : PluginResource(connection, instance), called_open_(false) {
+ SendCreate(BROWSER, PpapiHostMsg_Ext_CrxFileSystem_Create());
+}
+
+ExtCrxFileSystemPrivateResource::~ExtCrxFileSystemPrivateResource() {
+}
+
+thunk::PPB_Ext_CrxFileSystem_Private_API*
+ExtCrxFileSystemPrivateResource::AsPPB_Ext_CrxFileSystem_Private_API() {
+ return this;
+}
+
+int32_t ExtCrxFileSystemPrivateResource::Open(
+ PP_Instance /* unused */,
+ PP_Resource* file_system_resource,
+ scoped_refptr<TrackedCallback> callback) {
+ if (called_open_)
+ return PP_ERROR_FAILED;
+ called_open_ = true;
+
+ if (!file_system_resource)
+ return PP_ERROR_BADARGUMENT;
+
+ Call<PpapiPluginMsg_Ext_CrxFileSystem_BrowserOpenReply>(BROWSER,
+ PpapiHostMsg_Ext_CrxFileSystem_BrowserOpen(),
+ base::Bind(&ExtCrxFileSystemPrivateResource::OnBrowserOpenComplete, this,
+ file_system_resource,
+ callback));
+ return PP_OK_COMPLETIONPENDING;
+}
+
+void ExtCrxFileSystemPrivateResource::OnBrowserOpenComplete(
+ PP_Resource* file_system_resource,
+ scoped_refptr<TrackedCallback> callback,
+ const ResourceMessageReplyParams& params,
+ const std::string& fsid) {
+ if (!TrackedCallback::IsPending(callback))
+ return;
+
+ if (params.result() != PP_OK) {
+ callback->Run(params.result());
+ return;
+ }
+
+ thunk::EnterResourceCreationNoLock enter(pp_instance());
+ if (enter.failed()) {
+ callback->Run(enter.retval());
+ return;
+ }
+
+ *file_system_resource = enter.functions()->CreateIsolatedFileSystem(
+ pp_instance(), fsid.c_str());
+ if (*file_system_resource != 0) {
+ callback->Run(PP_OK);
+ } else {
+ callback->Run(PP_ERROR_FAILED);
+ }
+}
+
+} // namespace proxy
+} // namespace ppapi
diff --git a/ppapi/proxy/ext_crx_file_system_private_resource.h b/ppapi/proxy/ext_crx_file_system_private_resource.h
new file mode 100644
index 0000000..5f2887a
--- /dev/null
+++ b/ppapi/proxy/ext_crx_file_system_private_resource.h
@@ -0,0 +1,68 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// CRX filesystem is a filesystem that allows an extension to read its own
+// package directory tree. See ppapi/examples/crxfs for example.
+//
+// IMPLEMENTATION
+//
+// The implementation involves both browser and renderer. In order to provide
+// readonly access to CRX filesystem (i.e. extension directory), we create an
+// "isolated filesystem" pointing to current extension directory in browser.
+// Then browser grants read permission to renderer, and tells plugin the
+// filesystem id, or fsid.
+//
+// Once the plugin receives the fsid, it creates a PPB_FileSystem and forwards
+// the fsid to PepperFileSystemHost in order to construct root url.
+
+#ifndef PPAPI_PROXY_EXT_CRX_FILE_SYSTEM_PRIVATE_RESOURCE_H_
+#define PPAPI_PROXY_EXT_CRX_FILE_SYSTEM_PRIVATE_RESOURCE_H_
+
+#include <string>
+
+#include "base/memory/ref_counted.h"
+#include "ppapi/proxy/connection.h"
+#include "ppapi/proxy/plugin_resource.h"
+#include "ppapi/proxy/ppapi_proxy_export.h"
+#include "ppapi/thunk/ppb_ext_crx_file_system_private_api.h"
+
+namespace ppapi {
+
+class TrackedCallback;
+
+namespace proxy {
+
+class ResourceMessageReplyParams;
+
+class PPAPI_PROXY_EXPORT ExtCrxFileSystemPrivateResource
+ : public PluginResource,
+ public thunk::PPB_Ext_CrxFileSystem_Private_API {
+ public:
+ ExtCrxFileSystemPrivateResource(Connection connection, PP_Instance instance);
+ virtual ~ExtCrxFileSystemPrivateResource();
+
+ // Resource overrides.
+ virtual thunk::PPB_Ext_CrxFileSystem_Private_API*
+ AsPPB_Ext_CrxFileSystem_Private_API() OVERRIDE;
+
+ // PPB_Ext_CrxFileSystem_Private_API implementation.
+ virtual int32_t Open(PP_Instance instance,
+ PP_Resource* file_system_resource,
+ scoped_refptr<TrackedCallback> callback) OVERRIDE;
+
+ private:
+ void OnBrowserOpenComplete(PP_Resource* file_system_resource,
+ scoped_refptr<TrackedCallback> callback,
+ const ResourceMessageReplyParams& params,
+ const std::string& fsid);
+
+ bool called_open_;
+
+ DISALLOW_COPY_AND_ASSIGN(ExtCrxFileSystemPrivateResource);
+};
+
+} // namespace proxy
+} // namespace ppapi
+
+#endif // PPAPI_PROXY_EXT_CRX_FILE_SYSTEM_PRIVATE_RESOURCE_H_
diff --git a/ppapi/proxy/file_system_resource.cc b/ppapi/proxy/file_system_resource.cc
index 6d8e641..16c92e8 100644
--- a/ppapi/proxy/file_system_resource.cc
+++ b/ppapi/proxy/file_system_resource.cc
@@ -50,6 +50,11 @@ PP_FileSystemType FileSystemResource::GetType() {
return type_;
}
+void FileSystemResource::InitIsolatedFileSystem(const char* fsid) {
+ Post(RENDERER,
+ PpapiHostMsg_FileSystem_InitIsolatedFileSystem(std::string(fsid)));
+}
+
void FileSystemResource::OpenComplete(
scoped_refptr<TrackedCallback> callback,
const ResourceMessageReplyParams& params) {
diff --git a/ppapi/proxy/file_system_resource.h b/ppapi/proxy/file_system_resource.h
index ffd1234..8be0b2d 100644
--- a/ppapi/proxy/file_system_resource.h
+++ b/ppapi/proxy/file_system_resource.h
@@ -38,7 +38,9 @@ class PPAPI_PROXY_EXPORT FileSystemResource
scoped_refptr<TrackedCallback> callback) OVERRIDE;
virtual PP_FileSystemType GetType() OVERRIDE;
+ void InitIsolatedFileSystem(const char* fsid);
private:
+
// Called when the host has responded to our open request.
void OpenComplete(scoped_refptr<TrackedCallback> callback,
const ResourceMessageReplyParams& params);
diff --git a/ppapi/proxy/interface_list.cc b/ppapi/proxy/interface_list.cc
index bf5bb4b..4bd8b40 100644
--- a/ppapi/proxy/interface_list.cc
+++ b/ppapi/proxy/interface_list.cc
@@ -58,6 +58,7 @@
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/ppp_instance.h"
#include "ppapi/c/private/ppb_content_decryptor_private.h"
+#include "ppapi/c/private/ppb_ext_crx_file_system_private.h"
#include "ppapi/c/private/ppb_file_io_private.h"
#include "ppapi/c/private/ppb_file_ref_private.h"
#include "ppapi/c/private/ppb_flash_clipboard.h"
diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h
index 76fe6ec..5770d37 100644
--- a/ppapi/proxy/ppapi_messages.h
+++ b/ppapi/proxy/ppapi_messages.h
@@ -1359,6 +1359,12 @@ IPC_MESSAGE_CONTROL2(PpapiHostMsg_ExtensionsCommon_Call,
IPC_MESSAGE_CONTROL1(PpapiPluginMsg_ExtensionsCommon_CallReply,
base::ListValue /* output */)
+// Ext_CrxFileSystem
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_Ext_CrxFileSystem_Create)
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_Ext_CrxFileSystem_BrowserOpen)
+IPC_MESSAGE_CONTROL1(PpapiPluginMsg_Ext_CrxFileSystem_BrowserOpenReply,
+ std::string /* fsid */)
+
// File chooser.
IPC_MESSAGE_CONTROL0(PpapiHostMsg_FileChooser_Create)
IPC_MESSAGE_CONTROL4(PpapiHostMsg_FileChooser_Show,
@@ -1409,6 +1415,8 @@ IPC_MESSAGE_CONTROL1(PpapiHostMsg_FileSystem_Create,
IPC_MESSAGE_CONTROL1(PpapiHostMsg_FileSystem_Open,
int64_t /* expected_size */)
IPC_MESSAGE_CONTROL0(PpapiPluginMsg_FileSystem_OpenReply)
+IPC_MESSAGE_CONTROL1(PpapiHostMsg_FileSystem_InitIsolatedFileSystem,
+ std::string /* fsid */)
// Flash device ID.
IPC_MESSAGE_CONTROL0(PpapiHostMsg_FlashDeviceID_Create)
diff --git a/ppapi/proxy/ppapi_param_traits.cc b/ppapi/proxy/ppapi_param_traits.cc
index 40a421d..6cbf8a4 100644
--- a/ppapi/proxy/ppapi_param_traits.cc
+++ b/ppapi/proxy/ppapi_param_traits.cc
@@ -129,7 +129,8 @@ bool ParamTraits<PP_FileInfo>::Read(const Message* m, PickleIterator* iter,
if (system_type != PP_FILESYSTEMTYPE_INVALID &&
system_type != PP_FILESYSTEMTYPE_EXTERNAL &&
system_type != PP_FILESYSTEMTYPE_LOCALPERSISTENT &&
- system_type != PP_FILESYSTEMTYPE_LOCALTEMPORARY)
+ system_type != PP_FILESYSTEMTYPE_LOCALTEMPORARY &&
+ system_type != PP_FILESYSTEMTYPE_ISOLATED)
return false;
r->system_type = static_cast<PP_FileSystemType>(system_type);
return true;
diff --git a/ppapi/proxy/ppb_instance_proxy.cc b/ppapi/proxy/ppb_instance_proxy.cc
index ff044b6..528d8e7 100644
--- a/ppapi/proxy/ppb_instance_proxy.cc
+++ b/ppapi/proxy/ppb_instance_proxy.cc
@@ -18,6 +18,7 @@
#include "ppapi/proxy/browser_font_singleton_resource.h"
#include "ppapi/proxy/content_decryptor_private_serializer.h"
#include "ppapi/proxy/enter_proxy.h"
+#include "ppapi/proxy/ext_crx_file_system_private_resource.h"
#include "ppapi/proxy/extensions_common_resource.h"
#include "ppapi/proxy/flash_clipboard_resource.h"
#include "ppapi/proxy/flash_file_resource.h"
@@ -374,6 +375,9 @@ Resource* PPB_Instance_Proxy::GetSingletonResource(PP_Instance instance,
case TRUETYPE_FONT_SINGLETON_ID:
new_singleton = new TrueTypeFontSingletonResource(connection, instance);
break;
+ case CRX_FILESYSTEM_SINGLETON_ID:
+ new_singleton = new ExtCrxFileSystemPrivateResource(connection, instance);
+ break;
// Flash/trusted resources aren't needed for NaCl.
#if !defined(OS_NACL) && !defined(NACL_WIN64)
case BROWSER_FONT_SINGLETON_ID:
diff --git a/ppapi/proxy/resource_creation_proxy.cc b/ppapi/proxy/resource_creation_proxy.cc
index a234ca6..8bbe862 100644
--- a/ppapi/proxy/resource_creation_proxy.cc
+++ b/ppapi/proxy/resource_creation_proxy.cc
@@ -10,6 +10,7 @@
#include "ppapi/proxy/audio_input_resource.h"
#include "ppapi/proxy/browser_font_resource_trusted.h"
#include "ppapi/proxy/connection.h"
+#include "ppapi/proxy/ext_crx_file_system_private_resource.h"
#include "ppapi/proxy/file_chooser_resource.h"
#include "ppapi/proxy/file_io_resource.h"
#include "ppapi/proxy/file_system_resource.h"
@@ -88,6 +89,15 @@ PP_Resource ResourceCreationProxy::CreateFileSystem(
type))->GetReference();
}
+PP_Resource ResourceCreationProxy::CreateIsolatedFileSystem(
+ PP_Instance instance,
+ const char* fsid) {
+ FileSystemResource* fs = new FileSystemResource(
+ GetConnection(), instance, PP_FILESYSTEMTYPE_ISOLATED);
+ fs->InitIsolatedFileSystem(fsid);
+ return fs->GetReference();
+}
+
PP_Resource ResourceCreationProxy::CreateIMEInputEvent(
PP_Instance instance,
PP_InputEvent_Type type,
diff --git a/ppapi/proxy/resource_creation_proxy.h b/ppapi/proxy/resource_creation_proxy.h
index 404c219..0597c11 100644
--- a/ppapi/proxy/resource_creation_proxy.h
+++ b/ppapi/proxy/resource_creation_proxy.h
@@ -43,6 +43,9 @@ class ResourceCreationProxy : public InterfaceProxy,
const char* path) OVERRIDE;
virtual PP_Resource CreateFileSystem(PP_Instance instance,
PP_FileSystemType type) OVERRIDE;
+ virtual PP_Resource CreateIsolatedFileSystem(
+ PP_Instance instance,
+ const char* fsid) OVERRIDE;
virtual PP_Resource CreateIMEInputEvent(PP_Instance instance,
PP_InputEvent_Type type,
PP_TimeTicks time_stamp,
diff --git a/ppapi/shared_impl/resource.h b/ppapi/shared_impl/resource.h
index 9333a0b..50513fd 100644
--- a/ppapi/shared_impl/resource.h
+++ b/ppapi/shared_impl/resource.h
@@ -30,6 +30,7 @@
F(PPB_BrowserFont_Trusted_API) \
F(PPB_Buffer_API) \
F(PPB_DeviceRef_API) \
+ F(PPB_Ext_CrxFileSystem_Private_API) \
F(PPB_FileChooser_API) \
F(PPB_FileIO_API) \
F(PPB_FileRef_API) \
diff --git a/ppapi/shared_impl/singleton_resource_id.h b/ppapi/shared_impl/singleton_resource_id.h
index de9178c..95d387c 100644
--- a/ppapi/shared_impl/singleton_resource_id.h
+++ b/ppapi/shared_impl/singleton_resource_id.h
@@ -15,6 +15,7 @@ enum SingletonResourceID {
// resource model.
BROKER_SINGLETON_ID,
BROWSER_FONT_SINGLETON_ID,
+ CRX_FILESYSTEM_SINGLETON_ID,
EXTENSIONS_COMMON_SINGLETON_ID,
FLASH_CLIPBOARD_SINGLETON_ID,
FLASH_FILE_SINGLETON_ID,
diff --git a/ppapi/tests/all_c_includes.h b/ppapi/tests/all_c_includes.h
index ff5ee00..b878e22 100644
--- a/ppapi/tests/all_c_includes.h
+++ b/ppapi/tests/all_c_includes.h
@@ -98,6 +98,7 @@
#include "ppapi/c/private/pp_private_font_charset.h"
#include "ppapi/c/private/pp_video_frame_private.h"
#include "ppapi/c/private/ppb_content_decryptor_private.h"
+#include "ppapi/c/private/ppb_ext_crx_file_system_private.h"
#include "ppapi/c/private/ppb_file_io_private.h"
#include "ppapi/c/private/ppb_flash.h"
#include "ppapi/c/private/ppb_flash_clipboard.h"
diff --git a/ppapi/thunk/interfaces_ppb_private_no_permissions.h b/ppapi/thunk/interfaces_ppb_private_no_permissions.h
index b00bddc..138ce9c 100644
--- a/ppapi/thunk/interfaces_ppb_private_no_permissions.h
+++ b/ppapi/thunk/interfaces_ppb_private_no_permissions.h
@@ -44,6 +44,8 @@ PROXIED_IFACE(PPB_NetworkMonitor_Private,
PPB_NETWORKMONITOR_PRIVATE_INTERFACE_0_2,
PPB_NetworkMonitor_Private_0_2)
+PROXIED_IFACE(NoAPIName, PPB_EXT_CRXFILESYSTEM_PRIVATE_INTERFACE_0_1,
+ PPB_Ext_CrxFileSystem_Private_0_1)
PROXIED_IFACE(NoAPIName, PPB_FILEIO_PRIVATE_INTERFACE_0_1,
PPB_FileIO_Private_0_1)
diff --git a/ppapi/thunk/ppb_ext_crx_file_system_private_api.h b/ppapi/thunk/ppb_ext_crx_file_system_private_api.h
new file mode 100644
index 0000000..9af926d
--- /dev/null
+++ b/ppapi/thunk/ppb_ext_crx_file_system_private_api.h
@@ -0,0 +1,34 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_THUNK_PPB_EXT_CRX_FILE_SYSTEM_API_H_
+#define PPAPI_THUNK_PPB_EXT_CRX_FILE_SYSTEM_API_H_
+
+#include "base/memory/ref_counted.h"
+#include "ppapi/shared_impl/singleton_resource_id.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+namespace ppapi {
+
+class TrackedCallback;
+
+namespace thunk {
+
+class PPAPI_THUNK_EXPORT PPB_Ext_CrxFileSystem_Private_API {
+ public:
+ virtual ~PPB_Ext_CrxFileSystem_Private_API() {}
+
+ virtual int32_t Open(PP_Instance instance,
+ PP_Resource* file_system,
+ scoped_refptr<TrackedCallback> callback) = 0;
+
+ static const SingletonResourceID kSingletonResourceID =
+ CRX_FILESYSTEM_SINGLETON_ID;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_EXT_CRX_FILE_SYSTEM_API_H_
diff --git a/ppapi/thunk/ppb_ext_crx_file_system_private_thunk.cc b/ppapi/thunk/ppb_ext_crx_file_system_private_thunk.cc
new file mode 100644
index 0000000..7e18ba9
--- /dev/null
+++ b/ppapi/thunk/ppb_ext_crx_file_system_private_thunk.cc
@@ -0,0 +1,48 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// From private/ppb_ext_crx_file_system_private.idl,
+// modified Fri May 3 09:24:58 2013.
+
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/private/ppb_ext_crx_file_system_private.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_ext_crx_file_system_private_api.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+int32_t Open(PP_Instance instance,
+ PP_Resource* file_system,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_Ext_CrxFileSystem_Private::Open()";
+ EnterInstanceAPI<PPB_Ext_CrxFileSystem_Private_API> enter(instance, callback);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.functions()->Open(instance,
+ file_system,
+ enter.callback()));
+}
+
+const PPB_Ext_CrxFileSystem_Private_0_1
+ g_ppb_ext_crxfilesystem_private_thunk_0_1 = {
+ &Open
+};
+
+} // namespace
+
+const PPB_Ext_CrxFileSystem_Private_0_1*
+ GetPPB_Ext_CrxFileSystem_Private_0_1_Thunk() {
+ return &g_ppb_ext_crxfilesystem_private_thunk_0_1;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/ppapi/thunk/ppb_mouse_lock_thunk.cc b/ppapi/thunk/ppb_mouse_lock_thunk.cc
index bd1a193..d9bfa2d 100644
--- a/ppapi/thunk/ppb_mouse_lock_thunk.cc
+++ b/ppapi/thunk/ppb_mouse_lock_thunk.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// From ppb_mouse_lock.idl modified Thu Apr 18 10:43:11 2013.
+// From ppb_mouse_lock.idl modified Mon May 6 13:58:10 2013.
#include "ppapi/c/pp_completion_callback.h"
#include "ppapi/c/pp_errors.h"
@@ -30,8 +30,9 @@ int32_t LockMouse(PP_Instance instance, struct PP_CompletionCallback callback) {
void UnlockMouse(PP_Instance instance) {
VLOG(4) << "PPB_MouseLock::UnlockMouse()";
EnterInstance enter(instance);
- if (enter.succeeded())
- enter.functions()->UnlockMouse(instance);
+ if (enter.failed())
+ return;
+ enter.functions()->UnlockMouse(instance);
}
const PPB_MouseLock_1_0 g_ppb_mouselock_thunk_1_0 = {
diff --git a/ppapi/thunk/resource_creation_api.h b/ppapi/thunk/resource_creation_api.h
index d2c5129..cd7e348 100644
--- a/ppapi/thunk/resource_creation_api.h
+++ b/ppapi/thunk/resource_creation_api.h
@@ -49,6 +49,8 @@ class ResourceCreationAPI {
const char* path) = 0;
virtual PP_Resource CreateFileSystem(PP_Instance instance,
PP_FileSystemType type) = 0;
+ virtual PP_Resource CreateIsolatedFileSystem(PP_Instance instance,
+ const char* fsid) = 0;
virtual PP_Resource CreateIMEInputEvent(PP_Instance instance,
PP_InputEvent_Type type,
PP_TimeTicks time_stamp,
diff --git a/webkit/plugins/ppapi/plugin_module.cc b/webkit/plugins/ppapi/plugin_module.cc
index b029b62..7c5830b 100644
--- a/webkit/plugins/ppapi/plugin_module.cc
+++ b/webkit/plugins/ppapi/plugin_module.cc
@@ -71,6 +71,7 @@
#include "ppapi/c/ppb_view.h"
#include "ppapi/c/ppp.h"
#include "ppapi/c/ppp_instance.h"
+#include "ppapi/c/private/ppb_ext_crx_file_system_private.h"
#include "ppapi/c/private/ppb_file_io_private.h"
#include "ppapi/c/private/ppb_file_ref_private.h"
#include "ppapi/c/private/ppb_flash.h"
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
index 379d18d..c856b1e 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc
+++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
@@ -2155,6 +2155,7 @@ PP_Bool PluginInstance::GetScreenSize(PP_Instance instance, PP_Size* size) {
switch (id) {
case ::ppapi::BROKER_SINGLETON_ID:
case ::ppapi::BROWSER_FONT_SINGLETON_ID:
+ case ::ppapi::CRX_FILESYSTEM_SINGLETON_ID:
case ::ppapi::EXTENSIONS_COMMON_SINGLETON_ID:
case ::ppapi::FLASH_CLIPBOARD_SINGLETON_ID:
case ::ppapi::FLASH_FILE_SINGLETON_ID:
diff --git a/webkit/plugins/ppapi/ppb_file_ref_impl.cc b/webkit/plugins/ppapi/ppb_file_ref_impl.cc
index 736f2b5..d6c7ce8 100644
--- a/webkit/plugins/ppapi/ppb_file_ref_impl.cc
+++ b/webkit/plugins/ppapi/ppb_file_ref_impl.cc
@@ -177,7 +177,8 @@ PPB_FileRef_Impl* PPB_FileRef_Impl::CreateInternal(PP_Instance instance,
plugin_instance->delegate()->GetFileSystemType(instance, pp_file_system);
if (type != PP_FILESYSTEMTYPE_LOCALPERSISTENT &&
type != PP_FILESYSTEMTYPE_LOCALTEMPORARY &&
- type != PP_FILESYSTEMTYPE_EXTERNAL)
+ type != PP_FILESYSTEMTYPE_EXTERNAL &&
+ type != PP_FILESYSTEMTYPE_ISOLATED)
return 0;
PPB_FileRef_CreateInfo info;
@@ -331,7 +332,8 @@ base::FilePath PPB_FileRef_Impl::GetSystemPath() const {
GURL PPB_FileRef_Impl::GetFileSystemURL() const {
if (GetFileSystemType() != PP_FILESYSTEMTYPE_LOCALPERSISTENT &&
GetFileSystemType() != PP_FILESYSTEMTYPE_LOCALTEMPORARY &&
- GetFileSystemType() != PP_FILESYSTEMTYPE_EXTERNAL) {
+ GetFileSystemType() != PP_FILESYSTEMTYPE_EXTERNAL &&
+ GetFileSystemType() != PP_FILESYSTEMTYPE_ISOLATED) {
NOTREACHED();
return GURL();
}
diff --git a/webkit/plugins/ppapi/resource_creation_impl.cc b/webkit/plugins/ppapi/resource_creation_impl.cc
index 47ca3bc..f091a38 100644
--- a/webkit/plugins/ppapi/resource_creation_impl.cc
+++ b/webkit/plugins/ppapi/resource_creation_impl.cc
@@ -154,6 +154,12 @@ PP_Resource ResourceCreationImpl::CreateIMEInputEvent(
segment_offsets, target_segment, selection_start, selection_end);
}
+PP_Resource ResourceCreationImpl::CreateIsolatedFileSystem(PP_Instance instance,
+ const char* fsid) {
+ NOTIMPLEMENTED(); // no need to support in-process
+ return 0;
+}
+
PP_Resource ResourceCreationImpl::CreateKeyboardInputEvent(
PP_Instance instance,
PP_InputEvent_Type type,
diff --git a/webkit/plugins/ppapi/resource_creation_impl.h b/webkit/plugins/ppapi/resource_creation_impl.h
index b682b1a..da48bc8 100644
--- a/webkit/plugins/ppapi/resource_creation_impl.h
+++ b/webkit/plugins/ppapi/resource_creation_impl.h
@@ -73,6 +73,8 @@ class WEBKIT_PLUGINS_EXPORT ResourceCreationImpl
int32_t target_segment,
uint32_t selection_start,
uint32_t selection_end) OVERRIDE;
+ virtual PP_Resource CreateIsolatedFileSystem(PP_Instance instance,
+ const char* fsid) OVERRIDE;
virtual PP_Resource CreateKeyboardInputEvent(
PP_Instance instance,
PP_InputEvent_Type type,