summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authornhiroki@chromium.org <nhiroki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-20 13:44:37 +0000
committernhiroki@chromium.org <nhiroki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-20 13:44:37 +0000
commitc54d9901b794be04a72d671fc8b1ccb67da164ed (patch)
tree24396dd41e451cb223483f49cfef3a4b11cdf88c /ppapi
parent0ddf07794e7f3a93d291cda697e87550fe402830 (diff)
downloadchromium_src-c54d9901b794be04a72d671fc8b1ccb67da164ed.zip
chromium_src-c54d9901b794be04a72d671fc8b1ccb67da164ed.tar.gz
chromium_src-c54d9901b794be04a72d671fc8b1ccb67da164ed.tar.bz2
PPAPI: Add PluginPrivateFileSystem
This change introduces PluginPrivate fileSystem, a brand-new per-plugin sandboxed-isolated filesystem, in PPB_IsolatedFileSystem_Private. Key points in this CL: - Adding new isolated filesystem type for PluginPrivate filesystem. - Granting full access of the filesystem to renderer process. - Generating plugin ID from plugin's MIME type. BUG=286242 TEST=manual (see https://codereview.chromium.org/77813004/) TEST=content_unittests --gtest_filter=PepperFileSystemBrowserHostTest.* TBR=jochen@chromium.org Review URL: https://codereview.chromium.org/26803004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@236241 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/api/private/ppb_isolated_file_system_private.idl6
-rw-r--r--ppapi/c/private/ppb_isolated_file_system_private.h16
-rw-r--r--ppapi/cpp/private/isolated_file_system_private.cc8
-rw-r--r--ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c18
-rw-r--r--ppapi/proxy/file_system_resource.cc17
-rw-r--r--ppapi/proxy/file_system_resource.h1
-rw-r--r--ppapi/proxy/ppapi_messages.h2
-rw-r--r--ppapi/shared_impl/file_system_util.cc15
-rw-r--r--ppapi/shared_impl/file_system_util.h6
-rw-r--r--ppapi/thunk/interfaces_ppb_private_no_permissions.h4
-rw-r--r--ppapi/thunk/ppb_isolated_file_system_private_thunk.cc12
11 files changed, 70 insertions, 35 deletions
diff --git a/ppapi/api/private/ppb_isolated_file_system_private.idl b/ppapi/api/private/ppb_isolated_file_system_private.idl
index cbbeb03..c42d520 100644
--- a/ppapi/api/private/ppb_isolated_file_system_private.idl
+++ b/ppapi/api/private/ppb_isolated_file_system_private.idl
@@ -9,7 +9,7 @@
* This file contains the <code>PPB_IsolatedFileSystem_Private</code> interface.
*/
label Chrome {
- M33 = 0.1
+ M33 = 0.2
};
@@ -22,7 +22,9 @@ enum PP_IsolatedFileSystemType_Private {
/** Type for invalid file systems */
PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_INVALID = 0,
/** Type for CRX file systems */
- PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_CRX = 1
+ PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_CRX = 1,
+ /** Type for PluginPrivate file systems */
+ PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_PLUGINPRIVATE = 2
};
/* <code>PPB_IsolatedFileSystem_Private</code> interface */
diff --git a/ppapi/c/private/ppb_isolated_file_system_private.h b/ppapi/c/private/ppb_isolated_file_system_private.h
index 4b9af4f..410108b 100644
--- a/ppapi/c/private/ppb_isolated_file_system_private.h
+++ b/ppapi/c/private/ppb_isolated_file_system_private.h
@@ -4,7 +4,7 @@
*/
/* From private/ppb_isolated_file_system_private.idl,
- * modified Sat Nov 2 00:10:18 2013.
+ * modified Fri Nov 8 02:21:15 2013.
*/
#ifndef PPAPI_C_PRIVATE_PPB_ISOLATED_FILE_SYSTEM_PRIVATE_H_
@@ -16,10 +16,10 @@
#include "ppapi/c/pp_resource.h"
#include "ppapi/c/pp_stdint.h"
-#define PPB_ISOLATEDFILESYSTEM_PRIVATE_INTERFACE_0_1 \
- "PPB_IsolatedFileSystem_Private;0.1"
+#define PPB_ISOLATEDFILESYSTEM_PRIVATE_INTERFACE_0_2 \
+ "PPB_IsolatedFileSystem_Private;0.2"
#define PPB_ISOLATEDFILESYSTEM_PRIVATE_INTERFACE \
- PPB_ISOLATEDFILESYSTEM_PRIVATE_INTERFACE_0_1
+ PPB_ISOLATEDFILESYSTEM_PRIVATE_INTERFACE_0_2
/**
* @file
@@ -38,7 +38,9 @@ typedef enum {
/** Type for invalid file systems */
PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_INVALID = 0,
/** Type for CRX file systems */
- PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_CRX = 1
+ PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_CRX = 1,
+ /** Type for PluginPrivate file systems */
+ PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_PLUGINPRIVATE = 2
} PP_IsolatedFileSystemType_Private;
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_IsolatedFileSystemType_Private, 4);
/**
@@ -50,7 +52,7 @@ PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_IsolatedFileSystemType_Private, 4);
* @{
*/
/* <code>PPB_IsolatedFileSystem_Private</code> interface */
-struct PPB_IsolatedFileSystem_Private_0_1 {
+struct PPB_IsolatedFileSystem_Private_0_2 {
/**
* Open() opens a file system corresponding the given file system type.
*
@@ -74,7 +76,7 @@ struct PPB_IsolatedFileSystem_Private_0_1 {
struct PP_CompletionCallback callback);
};
-typedef struct PPB_IsolatedFileSystem_Private_0_1
+typedef struct PPB_IsolatedFileSystem_Private_0_2
PPB_IsolatedFileSystem_Private;
/**
* @}
diff --git a/ppapi/cpp/private/isolated_file_system_private.cc b/ppapi/cpp/private/isolated_file_system_private.cc
index 3500795..f0a20ca 100644
--- a/ppapi/cpp/private/isolated_file_system_private.cc
+++ b/ppapi/cpp/private/isolated_file_system_private.cc
@@ -10,8 +10,8 @@ namespace pp {
namespace {
-template <> const char* interface_name<PPB_IsolatedFileSystem_Private_0_1>() {
- return PPB_ISOLATEDFILESYSTEM_PRIVATE_INTERFACE_0_1;
+template <> const char* interface_name<PPB_IsolatedFileSystem_Private_0_2>() {
+ return PPB_ISOLATEDFILESYSTEM_PRIVATE_INTERFACE_0_2;
}
} // namespace
@@ -31,9 +31,9 @@ IsolatedFileSystemPrivate::~IsolatedFileSystemPrivate() {
int32_t IsolatedFileSystemPrivate::Open(
const CompletionCallbackWithOutput<pp::FileSystem>& cc) {
- if (!has_interface<PPB_IsolatedFileSystem_Private_0_1>())
+ if (!has_interface<PPB_IsolatedFileSystem_Private_0_2>())
return cc.MayForce(PP_ERROR_NOINTERFACE);
- return get_interface<PPB_IsolatedFileSystem_Private_0_1>()->
+ return get_interface<PPB_IsolatedFileSystem_Private_0_2>()->
Open(instance_, type_, cc.output(), cc.pp_completion_callback());
}
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 ff41829..4e3274e 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
@@ -213,7 +213,7 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_DRM_1_0;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_Menu_0_2;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_HostResolver_Private_0_1;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Instance_Private_0_1;
-static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_IsolatedFileSystem_Private_0_1;
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_IsolatedFileSystem_Private_0_2;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_NaCl_Private_1_0;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_NetAddress_Private_0_1;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_NetAddress_Private_1_0;
@@ -3045,14 +3045,14 @@ static void Pnacl_M13_PPB_Instance_Private_ExecuteScript(struct PP_Var* _struct_
/* End wrapper methods for PPB_Instance_Private_0_1 */
-/* Begin wrapper methods for PPB_IsolatedFileSystem_Private_0_1 */
+/* Begin wrapper methods for PPB_IsolatedFileSystem_Private_0_2 */
static int32_t Pnacl_M33_PPB_IsolatedFileSystem_Private_Open(PP_Instance instance, PP_IsolatedFileSystemType_Private type, PP_Resource* file_system, struct PP_CompletionCallback* callback) {
- const struct PPB_IsolatedFileSystem_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_IsolatedFileSystem_Private_0_1.real_iface;
+ const struct PPB_IsolatedFileSystem_Private_0_2 *iface = Pnacl_WrapperInfo_PPB_IsolatedFileSystem_Private_0_2.real_iface;
return iface->Open(instance, type, file_system, *callback);
}
-/* End wrapper methods for PPB_IsolatedFileSystem_Private_0_1 */
+/* End wrapper methods for PPB_IsolatedFileSystem_Private_0_2 */
/* Begin wrapper methods for PPB_NaCl_Private_1_0 */
@@ -4959,7 +4959,7 @@ struct PPB_Instance_Private_0_1 Pnacl_Wrappers_PPB_Instance_Private_0_1 = {
.ExecuteScript = (struct PP_Var (*)(PP_Instance instance, struct PP_Var script, struct PP_Var* exception))&Pnacl_M13_PPB_Instance_Private_ExecuteScript
};
-struct PPB_IsolatedFileSystem_Private_0_1 Pnacl_Wrappers_PPB_IsolatedFileSystem_Private_0_1 = {
+struct PPB_IsolatedFileSystem_Private_0_2 Pnacl_Wrappers_PPB_IsolatedFileSystem_Private_0_2 = {
.Open = (int32_t (*)(PP_Instance instance, PP_IsolatedFileSystemType_Private type, PP_Resource* file_system, struct PP_CompletionCallback callback))&Pnacl_M33_PPB_IsolatedFileSystem_Private_Open
};
@@ -5693,9 +5693,9 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Instance_Private_0_1 = {
.real_iface = NULL
};
-static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_IsolatedFileSystem_Private_0_1 = {
- .iface_macro = PPB_ISOLATEDFILESYSTEM_PRIVATE_INTERFACE_0_1,
- .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_IsolatedFileSystem_Private_0_1,
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_IsolatedFileSystem_Private_0_2 = {
+ .iface_macro = PPB_ISOLATEDFILESYSTEM_PRIVATE_INTERFACE_0_2,
+ .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_IsolatedFileSystem_Private_0_2,
.real_iface = NULL
};
@@ -5930,7 +5930,7 @@ static struct __PnaclWrapperInfo *s_ppb_wrappers[] = {
&Pnacl_WrapperInfo_PPB_Flash_Menu_0_2,
&Pnacl_WrapperInfo_PPB_HostResolver_Private_0_1,
&Pnacl_WrapperInfo_PPB_Instance_Private_0_1,
- &Pnacl_WrapperInfo_PPB_IsolatedFileSystem_Private_0_1,
+ &Pnacl_WrapperInfo_PPB_IsolatedFileSystem_Private_0_2,
&Pnacl_WrapperInfo_PPB_NaCl_Private_1_0,
&Pnacl_WrapperInfo_PPB_NetAddress_Private_0_1,
&Pnacl_WrapperInfo_PPB_NetAddress_Private_1_0,
diff --git a/ppapi/proxy/file_system_resource.cc b/ppapi/proxy/file_system_resource.cc
index 1839930..df8c390 100644
--- a/ppapi/proxy/file_system_resource.cc
+++ b/ppapi/proxy/file_system_resource.cc
@@ -21,7 +21,8 @@ FileSystemResource::FileSystemResource(Connection connection,
: PluginResource(connection, instance),
type_(type),
called_open_(false),
- callback_count_(0) {
+ callback_count_(0),
+ callback_result_(PP_OK) {
DCHECK(type_ != PP_FILESYSTEMTYPE_INVALID);
SendCreate(RENDERER, PpapiHostMsg_FileSystem_Create(type_));
SendCreate(BROWSER, PpapiHostMsg_FileSystem_Create(type_));
@@ -34,7 +35,9 @@ FileSystemResource::FileSystemResource(Connection connection,
PP_FileSystemType type)
: PluginResource(connection, instance),
type_(type),
- called_open_(true) {
+ called_open_(true),
+ callback_count_(0),
+ callback_result_(PP_OK) {
DCHECK(type_ != PP_FILESYSTEMTYPE_INVALID);
AttachToPendingHost(RENDERER, pending_renderer_id);
AttachToPendingHost(BROWSER, pending_browser_id);
@@ -99,18 +102,24 @@ void FileSystemResource::OpenComplete(
scoped_refptr<TrackedCallback> callback,
const ResourceMessageReplyParams& params) {
++callback_count_;
+ // Prioritize worse result since only one status can be returned.
+ if (params.result() != PP_OK)
+ callback_result_ = params.result();
// Received callback from browser and renderer.
if (callback_count_ == 2)
- callback->Run(params.result());
+ callback->Run(callback_result_);
}
void FileSystemResource::InitIsolatedFileSystemComplete(
const base::Callback<void(int32_t)>& callback,
const ResourceMessageReplyParams& params) {
++callback_count_;
+ // Prioritize worse result since only one status can be returned.
+ if (params.result() != PP_OK)
+ callback_result_ = params.result();
// Received callback from browser and renderer.
if (callback_count_ == 2)
- callback.Run(params.result());
+ callback.Run(callback_result_);
}
} // namespace proxy
diff --git a/ppapi/proxy/file_system_resource.h b/ppapi/proxy/file_system_resource.h
index a54a1c8..9029583 100644
--- a/ppapi/proxy/file_system_resource.h
+++ b/ppapi/proxy/file_system_resource.h
@@ -65,6 +65,7 @@ class PPAPI_PROXY_EXPORT FileSystemResource
PP_FileSystemType type_;
bool called_open_;
uint32_t callback_count_;
+ int32_t callback_result_;
DISALLOW_COPY_AND_ASSIGN(FileSystemResource);
};
diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h
index 3e7b1d2..e41284c 100644
--- a/ppapi/proxy/ppapi_messages.h
+++ b/ppapi/proxy/ppapi_messages.h
@@ -93,7 +93,7 @@ IPC_ENUM_TRAITS(PP_ImageDataFormat)
IPC_ENUM_TRAITS(PP_InputEvent_MouseButton)
IPC_ENUM_TRAITS(PP_InputEvent_Type)
IPC_ENUM_TRAITS_MAX_VALUE(PP_IsolatedFileSystemType_Private,
- PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_CRX)
+ PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_PLUGINPRIVATE)
IPC_ENUM_TRAITS_MAX_VALUE(PP_NetAddressFamily_Private,
PP_NETADDRESSFAMILY_PRIVATE_IPV6)
IPC_ENUM_TRAITS_MAX_VALUE(PP_NetworkList_State, PP_NETWORKLIST_STATE_UP)
diff --git a/ppapi/shared_impl/file_system_util.cc b/ppapi/shared_impl/file_system_util.cc
index 27bcf7b..330995c 100644
--- a/ppapi/shared_impl/file_system_util.cc
+++ b/ppapi/shared_impl/file_system_util.cc
@@ -4,6 +4,8 @@
#include "ppapi/shared_impl/file_system_util.h"
+#include "base/logging.h"
+
namespace ppapi {
fileapi::FileSystemType PepperFileSystemTypeToFileSystemType(
@@ -32,4 +34,17 @@ bool FileSystemTypeHasQuota(PP_FileSystemType type) {
type == PP_FILESYSTEMTYPE_LOCALPERSISTENT);
}
+std::string IsolatedFileSystemTypeToRootName(
+ PP_IsolatedFileSystemType_Private type) {
+ switch (type) {
+ case PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_CRX:
+ return "crxfs";
+ case PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_PLUGINPRIVATE:
+ return "pluginprivate";
+ default:
+ NOTREACHED() << type;
+ return std::string();
+ }
+}
+
} // namespace ppapi
diff --git a/ppapi/shared_impl/file_system_util.h b/ppapi/shared_impl/file_system_util.h
index 2495a82..5b39f69 100644
--- a/ppapi/shared_impl/file_system_util.h
+++ b/ppapi/shared_impl/file_system_util.h
@@ -5,7 +5,10 @@
#ifndef PPAPI_SHARED_IMPL_FILE_SYSTEM_UTIL_H_
#define PPAPI_SHARED_IMPL_FILE_SYSTEM_UTIL_H_
+#include <string>
+
#include "ppapi/c/pp_file_info.h"
+#include "ppapi/c/private/ppb_isolated_file_system_private.h"
#include "ppapi/shared_impl/ppapi_shared_export.h"
#include "webkit/common/fileapi/file_system_types.h"
@@ -19,6 +22,9 @@ PPAPI_SHARED_EXPORT bool FileSystemTypeIsValid(PP_FileSystemType type);
PPAPI_SHARED_EXPORT bool FileSystemTypeHasQuota(PP_FileSystemType type);
+PPAPI_SHARED_EXPORT std::string IsolatedFileSystemTypeToRootName(
+ PP_IsolatedFileSystemType_Private type);
+
} // namespace ppapi
#endif // PPAPI_SHARED_IMPL_FILE_SYSTEM_UTIL_H_
diff --git a/ppapi/thunk/interfaces_ppb_private_no_permissions.h b/ppapi/thunk/interfaces_ppb_private_no_permissions.h
index 8fe92f1..3b4446f 100644
--- a/ppapi/thunk/interfaces_ppb_private_no_permissions.h
+++ b/ppapi/thunk/interfaces_ppb_private_no_permissions.h
@@ -40,8 +40,8 @@ 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)
-PROXIED_IFACE(NoAPIName, PPB_ISOLATEDFILESYSTEM_PRIVATE_INTERFACE_0_1,
- PPB_IsolatedFileSystem_Private_0_1)
+PROXIED_IFACE(NoAPIName, PPB_ISOLATEDFILESYSTEM_PRIVATE_INTERFACE_0_2,
+ PPB_IsolatedFileSystem_Private_0_2)
PROXIED_IFACE(NoAPIName, PPB_VIDEODESTINATION_PRIVATE_INTERFACE_0_1,
PPB_VideoDestination_Private_0_1)
diff --git a/ppapi/thunk/ppb_isolated_file_system_private_thunk.cc b/ppapi/thunk/ppb_isolated_file_system_private_thunk.cc
index 04b1bab..cd58b24 100644
--- a/ppapi/thunk/ppb_isolated_file_system_private_thunk.cc
+++ b/ppapi/thunk/ppb_isolated_file_system_private_thunk.cc
@@ -3,7 +3,7 @@
// found in the LICENSE file.
// From private/ppb_isolated_file_system_private.idl,
-// modified Thu Oct 31 20:52:54 2013.
+// modified Fri Nov 8 02:21:15 2013.
#include "ppapi/c/pp_completion_callback.h"
#include "ppapi/c/pp_errors.h"
@@ -35,16 +35,16 @@ int32_t Open(PP_Instance instance,
enter.callback()));
}
-const PPB_IsolatedFileSystem_Private_0_1
- g_ppb_isolatedfilesystem_private_thunk_0_1 = {
+const PPB_IsolatedFileSystem_Private_0_2
+ g_ppb_isolatedfilesystem_private_thunk_0_2 = {
&Open
};
} // namespace
-const PPB_IsolatedFileSystem_Private_0_1*
- GetPPB_IsolatedFileSystem_Private_0_1_Thunk() {
- return &g_ppb_isolatedfilesystem_private_thunk_0_1;
+const PPB_IsolatedFileSystem_Private_0_2*
+ GetPPB_IsolatedFileSystem_Private_0_2_Thunk() {
+ return &g_ppb_isolatedfilesystem_private_thunk_0_2;
}
} // namespace thunk