summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorraymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-04 23:32:50 +0000
committerraymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-04 23:32:50 +0000
commit2432c058351cb5b4da6b1c5a9c756d1758c9ee5d (patch)
tree372850500a04180aa8e45c38347010a15398eaee /webkit
parentf574c40f701805a0da0129915a9dc691cd79d355 (diff)
downloadchromium_src-2432c058351cb5b4da6b1c5a9c756d1758c9ee5d.zip
chromium_src-2432c058351cb5b4da6b1c5a9c756d1758c9ee5d.tar.gz
chromium_src-2432c058351cb5b4da6b1c5a9c756d1758c9ee5d.tar.bz2
The refactors PPB_Flash_File_ModuleLocal/FileRef to the new resource model. Calls for both these interfaces are now made directly to the browser. This removes the in-process implementation for these interfaces also (as they are flash-only). Tests are added for PPB_Flash_File_ModuleLocal.
Review URL: https://codereview.chromium.org/11359097 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@171080 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/plugins/ppapi/mock_plugin_delegate.cc41
-rw-r--r--webkit/plugins/ppapi/mock_plugin_delegate.h20
-rw-r--r--webkit/plugins/ppapi/plugin_delegate.h21
-rw-r--r--webkit/plugins/ppapi/ppapi_plugin_instance.cc1
-rw-r--r--webkit/plugins/ppapi/ppb_flash_impl.cc229
-rw-r--r--webkit/plugins/ppapi/ppb_flash_impl.h32
6 files changed, 3 insertions, 341 deletions
diff --git a/webkit/plugins/ppapi/mock_plugin_delegate.cc b/webkit/plugins/ppapi/mock_plugin_delegate.cc
index 54947e7..eec48da 100644
--- a/webkit/plugins/ppapi/mock_plugin_delegate.cc
+++ b/webkit/plugins/ppapi/mock_plugin_delegate.cc
@@ -220,47 +220,6 @@ void MockPluginDelegate::WillUpdateFile(const GURL& file_path) {
void MockPluginDelegate::DidUpdateFile(const GURL& file_path, int64_t delta) {
}
-base::PlatformFileError MockPluginDelegate::OpenFile(
- const ::ppapi::PepperFilePath& path,
- int flags,
- base::PlatformFile* file) {
- return base::PLATFORM_FILE_ERROR_FAILED;
-}
-
-base::PlatformFileError MockPluginDelegate::RenameFile(
- const ::ppapi::PepperFilePath& from_path,
- const ::ppapi::PepperFilePath& to_path) {
- return base::PLATFORM_FILE_ERROR_FAILED;
-}
-
-base::PlatformFileError MockPluginDelegate::DeleteFileOrDir(
- const ::ppapi::PepperFilePath& path,
- bool recursive) {
- return base::PLATFORM_FILE_ERROR_FAILED;
-}
-
-base::PlatformFileError MockPluginDelegate::CreateDir(
- const ::ppapi::PepperFilePath& path) {
- return base::PLATFORM_FILE_ERROR_FAILED;
-}
-
-base::PlatformFileError MockPluginDelegate::QueryFile(
- const ::ppapi::PepperFilePath& path,
- base::PlatformFileInfo* info) {
- return base::PLATFORM_FILE_ERROR_FAILED;
-}
-
-base::PlatformFileError MockPluginDelegate::GetDirContents(
- const ::ppapi::PepperFilePath& path,
- ::ppapi::DirContents* contents) {
- return base::PLATFORM_FILE_ERROR_FAILED;
-}
-
-base::PlatformFileError MockPluginDelegate::CreateTemporaryFile(
- base::PlatformFile* file) {
- return base::PLATFORM_FILE_ERROR_FAILED;
-}
-
void MockPluginDelegate::SyncGetFileSystemPlatformPath(
const GURL& url,
FilePath* platform_path) {
diff --git a/webkit/plugins/ppapi/mock_plugin_delegate.h b/webkit/plugins/ppapi/mock_plugin_delegate.h
index 5ce5819..f2f3407 100644
--- a/webkit/plugins/ppapi/mock_plugin_delegate.h
+++ b/webkit/plugins/ppapi/mock_plugin_delegate.h
@@ -101,26 +101,6 @@ class MockPluginDelegate : public PluginDelegate {
const AvailableSpaceCallback& callback);
virtual void WillUpdateFile(const GURL& file_path);
virtual void DidUpdateFile(const GURL& file_path, int64_t delta);
- virtual base::PlatformFileError OpenFile(
- const ::ppapi::PepperFilePath& path,
- int flags,
- base::PlatformFile* file);
- virtual base::PlatformFileError RenameFile(
- const ::ppapi::PepperFilePath& from_path,
- const ::ppapi::PepperFilePath& to_path);
- virtual base::PlatformFileError DeleteFileOrDir(
- const ::ppapi::PepperFilePath& path,
- bool recursive);
- virtual base::PlatformFileError CreateDir(
- const ::ppapi::PepperFilePath& path);
- virtual base::PlatformFileError QueryFile(
- const ::ppapi::PepperFilePath& path,
- base::PlatformFileInfo* info);
- virtual base::PlatformFileError GetDirContents(
- const ::ppapi::PepperFilePath& path,
- ::ppapi::DirContents* contents);
- virtual base::PlatformFileError CreateTemporaryFile(
- base::PlatformFile* file);
virtual void SyncGetFileSystemPlatformPath(const GURL& url,
FilePath* platform_path);
virtual scoped_refptr<base::MessageLoopProxy>
diff --git a/webkit/plugins/ppapi/plugin_delegate.h b/webkit/plugins/ppapi/plugin_delegate.h
index a3cbd89..695b0f7 100644
--- a/webkit/plugins/ppapi/plugin_delegate.h
+++ b/webkit/plugins/ppapi/plugin_delegate.h
@@ -507,27 +507,6 @@ class PluginDelegate {
virtual void WillUpdateFile(const GURL& file_path) = 0;
virtual void DidUpdateFile(const GURL& file_path, int64_t delta) = 0;
- virtual base::PlatformFileError OpenFile(
- const ::ppapi::PepperFilePath& path,
- int flags,
- base::PlatformFile* file) = 0;
- virtual base::PlatformFileError RenameFile(
- const ::ppapi::PepperFilePath& from_path,
- const ::ppapi::PepperFilePath& to_path) = 0;
- virtual base::PlatformFileError DeleteFileOrDir(
- const ::ppapi::PepperFilePath& path,
- bool recursive) = 0;
- virtual base::PlatformFileError CreateDir(
- const ::ppapi::PepperFilePath& path) = 0;
- virtual base::PlatformFileError QueryFile(
- const ::ppapi::PepperFilePath& path,
- base::PlatformFileInfo* info) = 0;
- virtual base::PlatformFileError GetDirContents(
- const ::ppapi::PepperFilePath& path,
- ::ppapi::DirContents* contents) = 0;
- virtual base::PlatformFileError CreateTemporaryFile(
- base::PlatformFile* file) = 0;
-
// Synchronously returns the platform file path for a filesystem URL.
virtual void SyncGetFileSystemPlatformPath(const GURL& url,
FilePath* platform_path) = 0;
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
index 3cae57c..5bdacb0 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc
+++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
@@ -2133,6 +2133,7 @@ PP_Bool PluginInstance::GetScreenSize(PP_Instance instance, PP_Size* size) {
// Flash APIs aren't implemented in-process.
switch (id) {
case ::ppapi::FLASH_CLIPBOARD_SINGLETON_ID:
+ case ::ppapi::FLASH_FILE_SINGLETON_ID:
case ::ppapi::FLASH_FULLSCREEN_SINGLETON_ID:
case ::ppapi::FLASH_SINGLETON_ID:
NOTIMPLEMENTED();
diff --git a/webkit/plugins/ppapi/ppb_flash_impl.cc b/webkit/plugins/ppapi/ppb_flash_impl.cc
index 237caf3..f1f72ab 100644
--- a/webkit/plugins/ppapi/ppb_flash_impl.cc
+++ b/webkit/plugins/ppapi/ppb_flash_impl.cc
@@ -7,17 +7,12 @@
#include <string>
#include <vector>
-#include "base/time.h"
-#include "base/utf_string_conversions.h"
#include "googleurl/src/gurl.h"
#include "ppapi/c/dev/ppb_font_dev.h"
#include "ppapi/c/private/ppb_flash.h"
-#include "ppapi/shared_impl/file_path.h"
-#include "ppapi/shared_impl/file_type_conversion.h"
#include "ppapi/shared_impl/time_conversion.h"
#include "ppapi/shared_impl/var.h"
#include "ppapi/thunk/enter.h"
-#include "ppapi/thunk/ppb_file_ref_api.h"
#include "ppapi/thunk/ppb_image_data_api.h"
#include "ppapi/thunk/ppb_url_request_info_api.h"
#include "skia/ext/platform_canvas.h"
@@ -36,16 +31,12 @@
#include "webkit/plugins/ppapi/plugin_delegate.h"
#include "webkit/plugins/ppapi/plugin_module.h"
#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
-#include "webkit/plugins/ppapi/ppb_file_ref_impl.h"
#include "webkit/plugins/ppapi/resource_helper.h"
#include "webkit/plugins/ppapi/ppb_image_data_impl.h"
using ppapi::PPTimeToTime;
using ppapi::StringVar;
-using ppapi::TimeToPPTime;
-using ppapi::thunk::EnterResource;
using ppapi::thunk::EnterResourceNoLock;
-using ppapi::thunk::PPB_FileRef_API;
using ppapi::thunk::PPB_ImageData_API;
using ppapi::thunk::PPB_URLRequestInfo_API;
@@ -213,225 +204,5 @@ PP_Var PPB_Flash_Impl::GetSetting(PP_Instance instance,
}
}
-bool PPB_Flash_Impl::CreateThreadAdapterForInstance(PP_Instance instance) {
- return false; // No multithreaded access allowed.
-}
-
-void PPB_Flash_Impl::ClearThreadAdapterForInstance(PP_Instance instance) {
-}
-
-int32_t PPB_Flash_Impl::OpenFile(PP_Instance pp_instance,
- const char* path,
- int32_t mode,
- PP_FileHandle* file) {
- int flags = 0;
- if (!path ||
- !::ppapi::PepperFileOpenFlagsToPlatformFileFlags(mode, &flags) ||
- !file)
- return PP_ERROR_BADARGUMENT;
-
- PluginInstance* instance = HostGlobals::Get()->GetInstance(pp_instance);
- if (!instance)
- return PP_ERROR_FAILED;
-
- base::PlatformFile base_file;
- base::PlatformFileError result = instance->delegate()->OpenFile(
- ::ppapi::PepperFilePath::MakeModuleLocal(
- instance->module()->name(), path),
- flags,
- &base_file);
- *file = base_file;
- return ::ppapi::PlatformFileErrorToPepperError(result);
-}
-
-int32_t PPB_Flash_Impl::RenameFile(PP_Instance pp_instance,
- const char* path_from,
- const char* path_to) {
- if (!path_from || !path_to)
- return PP_ERROR_BADARGUMENT;
-
- PluginInstance* instance = HostGlobals::Get()->GetInstance(pp_instance);
- if (!instance)
- return PP_ERROR_FAILED;
-
- base::PlatformFileError result = instance->delegate()->RenameFile(
- ::ppapi::PepperFilePath::MakeModuleLocal(
- instance->module()->name(), path_from),
- ::ppapi::PepperFilePath::MakeModuleLocal(
- instance->module()->name(), path_to));
- return ::ppapi::PlatformFileErrorToPepperError(result);
-}
-
-int32_t PPB_Flash_Impl::DeleteFileOrDir(PP_Instance pp_instance,
- const char* path,
- PP_Bool recursive) {
- if (!path)
- return PP_ERROR_BADARGUMENT;
-
- PluginInstance* instance = HostGlobals::Get()->GetInstance(pp_instance);
- if (!instance)
- return PP_ERROR_FAILED;
-
- base::PlatformFileError result = instance->delegate()->DeleteFileOrDir(
- ::ppapi::PepperFilePath::MakeModuleLocal(
- instance->module()->name(), path),
- PPBoolToBool(recursive));
- return ::ppapi::PlatformFileErrorToPepperError(result);
-}
-
-int32_t PPB_Flash_Impl::CreateDir(PP_Instance pp_instance, const char* path) {
- if (!path)
- return PP_ERROR_BADARGUMENT;
-
- PluginInstance* instance = HostGlobals::Get()->GetInstance(pp_instance);
- if (!instance)
- return PP_ERROR_FAILED;
-
- base::PlatformFileError result = instance->delegate()->CreateDir(
- ::ppapi::PepperFilePath::MakeModuleLocal(
- instance->module()->name(), path));
- return ::ppapi::PlatformFileErrorToPepperError(result);
-}
-
-int32_t PPB_Flash_Impl::QueryFile(PP_Instance pp_instance,
- const char* path,
- PP_FileInfo* info) {
- if (!path || !info)
- return PP_ERROR_BADARGUMENT;
-
- PluginInstance* instance = HostGlobals::Get()->GetInstance(pp_instance);
- if (!instance)
- return PP_ERROR_FAILED;
-
- base::PlatformFileInfo file_info;
- base::PlatformFileError result = instance->delegate()->QueryFile(
- ::ppapi::PepperFilePath::MakeModuleLocal(
- instance->module()->name(), path),
- &file_info);
- if (result == base::PLATFORM_FILE_OK) {
- info->size = file_info.size;
- info->creation_time = TimeToPPTime(file_info.creation_time);
- info->last_access_time = TimeToPPTime(file_info.last_accessed);
- info->last_modified_time = TimeToPPTime(file_info.last_modified);
- info->system_type = PP_FILESYSTEMTYPE_EXTERNAL;
- if (file_info.is_directory)
- info->type = PP_FILETYPE_DIRECTORY;
- else
- info->type = PP_FILETYPE_REGULAR;
- }
- return ::ppapi::PlatformFileErrorToPepperError(result);
-}
-
-int32_t PPB_Flash_Impl::GetDirContents(PP_Instance pp_instance,
- const char* path,
- PP_DirContents_Dev** contents) {
- if (!path || !contents)
- return PP_ERROR_BADARGUMENT;
- PluginInstance* instance = HostGlobals::Get()->GetInstance(pp_instance);
- if (!instance)
- return PP_ERROR_FAILED;
-
- *contents = NULL;
- ::ppapi::DirContents pepper_contents;
- base::PlatformFileError result = instance->delegate()->GetDirContents(
- ::ppapi::PepperFilePath::MakeModuleLocal(
- instance->module()->name(), path),
- &pepper_contents);
-
- if (result != base::PLATFORM_FILE_OK)
- return ::ppapi::PlatformFileErrorToPepperError(result);
-
- *contents = new PP_DirContents_Dev;
- size_t count = pepper_contents.size();
- (*contents)->count = count;
- (*contents)->entries = new PP_DirEntry_Dev[count];
- for (size_t i = 0; i < count; ++i) {
- PP_DirEntry_Dev& entry = (*contents)->entries[i];
-#if defined(OS_WIN)
- const std::string& name = UTF16ToUTF8(pepper_contents[i].name.value());
-#else
- const std::string& name = pepper_contents[i].name.value();
-#endif
- size_t size = name.size() + 1;
- char* name_copy = new char[size];
- memcpy(name_copy, name.c_str(), size);
- entry.name = name_copy;
- entry.is_dir = BoolToPPBool(pepper_contents[i].is_dir);
- }
- return PP_OK;
-}
-
-int32_t PPB_Flash_Impl::CreateTemporaryFile(PP_Instance instance,
- PP_FileHandle* file) {
- if (!file)
- return PP_ERROR_BADARGUMENT;
-
- PluginInstance* plugin_instance = HostGlobals::Get()->GetInstance(instance);
- if (!plugin_instance) {
- *file = PP_kInvalidFileHandle;
- return PP_ERROR_FAILED;
- }
-
- base::PlatformFileError result =
- plugin_instance->delegate()->CreateTemporaryFile(file);
- return ::ppapi::PlatformFileErrorToPepperError(result);
-}
-
-int32_t PPB_Flash_Impl::OpenFileRef(PP_Instance pp_instance,
- PP_Resource file_ref_id,
- int32_t mode,
- PP_FileHandle* file) {
- int flags = 0;
- if (!::ppapi::PepperFileOpenFlagsToPlatformFileFlags(mode, &flags) || !file)
- return PP_ERROR_BADARGUMENT;
-
- EnterResourceNoLock<PPB_FileRef_API> enter(file_ref_id, true);
- if (enter.failed())
- return PP_ERROR_BADRESOURCE;
- PPB_FileRef_Impl* file_ref = static_cast<PPB_FileRef_Impl*>(enter.object());
-
- PluginInstance* instance = HostGlobals::Get()->GetInstance(pp_instance);
- if (!instance)
- return PP_ERROR_FAILED;
-
- base::PlatformFile base_file;
- base::PlatformFileError result = instance->delegate()->OpenFile(
- ::ppapi::PepperFilePath::MakeAbsolute(file_ref->GetSystemPath()),
- flags,
- &base_file);
- *file = base_file;
- return ::ppapi::PlatformFileErrorToPepperError(result);
-}
-
-int32_t PPB_Flash_Impl::QueryFileRef(PP_Instance pp_instance,
- PP_Resource file_ref_id,
- PP_FileInfo* info) {
- EnterResource<PPB_FileRef_API> enter(file_ref_id, true);
- if (enter.failed())
- return PP_ERROR_BADRESOURCE;
- PPB_FileRef_Impl* file_ref = static_cast<PPB_FileRef_Impl*>(enter.object());
-
- PluginInstance* instance = HostGlobals::Get()->GetInstance(pp_instance);
- if (!instance)
- return PP_ERROR_FAILED;
-
- base::PlatformFileInfo file_info;
- base::PlatformFileError result = instance->delegate()->QueryFile(
- ::ppapi::PepperFilePath::MakeAbsolute(file_ref->GetSystemPath()),
- &file_info);
- if (result == base::PLATFORM_FILE_OK) {
- info->size = file_info.size;
- info->creation_time = TimeToPPTime(file_info.creation_time);
- info->last_access_time = TimeToPPTime(file_info.last_accessed);
- info->last_modified_time = TimeToPPTime(file_info.last_modified);
- info->system_type = PP_FILESYSTEMTYPE_EXTERNAL;
- if (file_info.is_directory)
- info->type = PP_FILETYPE_DIRECTORY;
- else
- info->type = PP_FILETYPE_REGULAR;
- }
- return ::ppapi::PlatformFileErrorToPepperError(result);
-}
-
} // namespace ppapi
} // namespace webkit
diff --git a/webkit/plugins/ppapi/ppb_flash_impl.h b/webkit/plugins/ppapi/ppb_flash_impl.h
index f13130c..ad1871b 100644
--- a/webkit/plugins/ppapi/ppb_flash_impl.h
+++ b/webkit/plugins/ppapi/ppb_flash_impl.h
@@ -9,14 +9,14 @@
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
#include "build/build_config.h"
-#include "ppapi/shared_impl/ppb_flash_shared.h"
+#include "ppapi/thunk/ppb_flash_api.h"
namespace webkit {
namespace ppapi {
class PluginInstance;
-class PPB_Flash_Impl : public ::ppapi::PPB_Flash_Shared {
+class PPB_Flash_Impl : public ::ppapi::thunk::PPB_Flash_API {
public:
explicit PPB_Flash_Impl(PluginInstance* instance);
virtual ~PPB_Flash_Impl();
@@ -49,34 +49,6 @@ class PPB_Flash_Impl : public ::ppapi::PPB_Flash_Shared {
const PP_Rect* rect) OVERRIDE;
virtual PP_Var GetSetting(PP_Instance instance,
PP_FlashSetting setting) OVERRIDE;
- virtual bool CreateThreadAdapterForInstance(PP_Instance instance) OVERRIDE;
- virtual void ClearThreadAdapterForInstance(PP_Instance instance) OVERRIDE;
- virtual int32_t OpenFile(PP_Instance instance,
- const char* path,
- int32_t mode,
- PP_FileHandle* file) OVERRIDE;
- virtual int32_t RenameFile(PP_Instance instance,
- const char* path_from,
- const char* path_to) OVERRIDE;
- virtual int32_t DeleteFileOrDir(PP_Instance instance,
- const char* path,
- PP_Bool recursive) OVERRIDE;
- virtual int32_t CreateDir(PP_Instance instance, const char* path) OVERRIDE;
- virtual int32_t QueryFile(PP_Instance instance,
- const char* path,
- PP_FileInfo* info) OVERRIDE;
- virtual int32_t GetDirContents(PP_Instance instance,
- const char* path,
- PP_DirContents_Dev** contents) OVERRIDE;
- virtual int32_t CreateTemporaryFile(PP_Instance instance,
- PP_FileHandle* file) OVERRIDE;
- virtual int32_t OpenFileRef(PP_Instance instance,
- PP_Resource file_ref,
- int32_t mode,
- PP_FileHandle* file) OVERRIDE;
- virtual int32_t QueryFileRef(PP_Instance instance,
- PP_Resource file_ref,
- PP_FileInfo* info) OVERRIDE;
private:
PluginInstance* instance_;