diff options
author | tsepez@chromium.org <tsepez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-01 20:37:35 +0000 |
---|---|---|
committer | tsepez@chromium.org <tsepez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-01 20:37:35 +0000 |
commit | 7e1dc3d25fb9211ae4baf7577ef72afcad78f2e1 (patch) | |
tree | 4ecc5db6beecb9b4c6812ed06a206ac887c4d2f6 /webkit/plugins | |
parent | 893dfd9a63c58061e961e0dbd777b8ffb46c50ed (diff) | |
download | chromium_src-7e1dc3d25fb9211ae4baf7577ef72afcad78f2e1.zip chromium_src-7e1dc3d25fb9211ae4baf7577ef72afcad78f2e1.tar.gz chromium_src-7e1dc3d25fb9211ae4baf7577ef72afcad78f2e1.tar.bz2 |
Open pepper files directly in browser.
This CL merges in the changes for the per-profile plugin process from the
previously retired CL.
Review URL: https://chromiumcodereview.appspot.com/10387195
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@140093 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/plugins')
-rw-r--r-- | webkit/plugins/ppapi/dir_contents.h | 25 | ||||
-rw-r--r-- | webkit/plugins/ppapi/file_path.cc | 55 | ||||
-rw-r--r-- | webkit/plugins/ppapi/file_path.h | 51 | ||||
-rw-r--r-- | webkit/plugins/ppapi/mock_plugin_delegate.cc | 16 | ||||
-rw-r--r-- | webkit/plugins/ppapi/mock_plugin_delegate.h | 30 | ||||
-rw-r--r-- | webkit/plugins/ppapi/plugin_delegate.h | 34 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppb_flash_impl.cc | 29 |
7 files changed, 64 insertions, 176 deletions
diff --git a/webkit/plugins/ppapi/dir_contents.h b/webkit/plugins/ppapi/dir_contents.h deleted file mode 100644 index f9a6c45..0000000 --- a/webkit/plugins/ppapi/dir_contents.h +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) 2010 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 WEBKIT_PLUGINS_PPAPI_DIR_CONTENTS_H_ -#define WEBKIT_PLUGINS_PPAPI_DIR_CONTENTS_H_ - -#include <vector> - -#include "base/file_path.h" - -namespace webkit { -namespace ppapi { - -struct DirEntry { - FilePath name; - bool is_dir; -}; - -typedef std::vector<DirEntry> DirContents; - -} // namespace ppapi -} // namespace webkit - -#endif // WEBKIT_PLUGINS_PPAPI_DIR_CONTENTS_H_ diff --git a/webkit/plugins/ppapi/file_path.cc b/webkit/plugins/ppapi/file_path.cc deleted file mode 100644 index 14d8970..0000000 --- a/webkit/plugins/ppapi/file_path.cc +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) 2011 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 "webkit/plugins/ppapi/file_path.h" - -#include <string> - -#include "webkit/plugins/ppapi/plugin_module.h" - -#if defined(OS_WIN) -#include "base/utf_string_conversions.h" -#endif - -namespace webkit { -namespace ppapi { - -namespace { - -FilePath GetFilePathFromUTF8(const std::string& utf8_path) { -#if defined(OS_WIN) - return FilePath(UTF8ToUTF16(utf8_path)); -#else - return FilePath(utf8_path); -#endif -} - -} // namespace - -PepperFilePath::PepperFilePath() - : domain_(DOMAIN_INVALID), - path_() { -} - -PepperFilePath::PepperFilePath(Domain domain, const FilePath& path) - : domain_(domain), - path_(path) { - // TODO(viettrungluu): Should we DCHECK() some things here? -} - -// static -PepperFilePath PepperFilePath::MakeAbsolute(const FilePath& path) { - return PepperFilePath(DOMAIN_ABSOLUTE, path); -} - -// static -PepperFilePath PepperFilePath::MakeModuleLocal(PluginModule* module, - const char* utf8_path) { - FilePath full_path = GetFilePathFromUTF8(module->name()).Append( - GetFilePathFromUTF8(utf8_path)); - return PepperFilePath(DOMAIN_MODULE_LOCAL, full_path); -} - -} // namespace ppapi -} // namespace webkit diff --git a/webkit/plugins/ppapi/file_path.h b/webkit/plugins/ppapi/file_path.h deleted file mode 100644 index ce8fe53..0000000 --- a/webkit/plugins/ppapi/file_path.h +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) 2011 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 WEBKIT_PLUGINS_PPAPI_FILE_PATH_H_ -#define WEBKIT_PLUGINS_PPAPI_FILE_PATH_H_ - -#include <string> - -#include "base/file_path.h" -#include "webkit/plugins/webkit_plugins_export.h" - -namespace webkit { -namespace ppapi { - -class PluginModule; - -// TODO(vtl): Once we put |::FilePath| into the |base| namespace, get rid of the -// |Pepper| (or |PEPPER_|) prefixes. Right now, it's just too -// confusing/dangerous! - -class PepperFilePath { - public: - enum Domain { - DOMAIN_INVALID = 0, - DOMAIN_ABSOLUTE, - DOMAIN_MODULE_LOCAL, - - // Used for validity-checking. - DOMAIN_MAX_VALID = DOMAIN_MODULE_LOCAL - }; - - WEBKIT_PLUGINS_EXPORT PepperFilePath(); - WEBKIT_PLUGINS_EXPORT PepperFilePath(Domain d, const FilePath& p); - - static PepperFilePath MakeAbsolute(const FilePath& path); - static PepperFilePath MakeModuleLocal(PluginModule* module, - const char* utf8_path); - - Domain domain() const { return domain_; } - const FilePath& path() const { return path_; } - - private: - Domain domain_; - FilePath path_; -}; - -} // namespace ppapi -} // namespace webkit - -#endif // WEBKIT_PLUGINS_PPAPI_FILE_PATH_H_ diff --git a/webkit/plugins/ppapi/mock_plugin_delegate.cc b/webkit/plugins/ppapi/mock_plugin_delegate.cc index 7c7329f..f82fe93 100644 --- a/webkit/plugins/ppapi/mock_plugin_delegate.cc +++ b/webkit/plugins/ppapi/mock_plugin_delegate.cc @@ -202,38 +202,38 @@ void MockPluginDelegate::DidUpdateFile(const GURL& file_path, int64_t delta) { } base::PlatformFileError MockPluginDelegate::OpenFile( - const PepperFilePath& path, + const ::ppapi::PepperFilePath& path, int flags, base::PlatformFile* file) { return base::PLATFORM_FILE_ERROR_FAILED; } base::PlatformFileError MockPluginDelegate::RenameFile( - const PepperFilePath& from_path, - const PepperFilePath& to_path) { + const ::ppapi::PepperFilePath& from_path, + const ::ppapi::PepperFilePath& to_path) { return base::PLATFORM_FILE_ERROR_FAILED; } base::PlatformFileError MockPluginDelegate::DeleteFileOrDir( - const PepperFilePath& path, + const ::ppapi::PepperFilePath& path, bool recursive) { return base::PLATFORM_FILE_ERROR_FAILED; } base::PlatformFileError MockPluginDelegate::CreateDir( - const PepperFilePath& path) { + const ::ppapi::PepperFilePath& path) { return base::PLATFORM_FILE_ERROR_FAILED; } base::PlatformFileError MockPluginDelegate::QueryFile( - const PepperFilePath& path, + const ::ppapi::PepperFilePath& path, base::PlatformFileInfo* info) { return base::PLATFORM_FILE_ERROR_FAILED; } base::PlatformFileError MockPluginDelegate::GetDirContents( - const PepperFilePath& path, - DirContents* contents) { + const ::ppapi::PepperFilePath& path, + ::ppapi::DirContents* contents) { return base::PLATFORM_FILE_ERROR_FAILED; } diff --git a/webkit/plugins/ppapi/mock_plugin_delegate.h b/webkit/plugins/ppapi/mock_plugin_delegate.h index 3136847..276342f 100644 --- a/webkit/plugins/ppapi/mock_plugin_delegate.h +++ b/webkit/plugins/ppapi/mock_plugin_delegate.h @@ -96,18 +96,24 @@ 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 PepperFilePath& path, - int flags, - base::PlatformFile* file); - virtual base::PlatformFileError RenameFile(const PepperFilePath& from_path, - const PepperFilePath& to_path); - virtual base::PlatformFileError DeleteFileOrDir(const PepperFilePath& path, - bool recursive); - virtual base::PlatformFileError CreateDir(const PepperFilePath& path); - virtual base::PlatformFileError QueryFile(const PepperFilePath& path, - base::PlatformFileInfo* info); - virtual base::PlatformFileError GetDirContents(const PepperFilePath& path, - DirContents* contents); + 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 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 c9bf986..0db111d 100644 --- a/webkit/plugins/ppapi/plugin_delegate.h +++ b/webkit/plugins/ppapi/plugin_delegate.h @@ -25,10 +25,10 @@ #include "ppapi/c/pp_instance.h" #include "ppapi/c/pp_resource.h" #include "ppapi/c/pp_stdint.h" +#include "ppapi/shared_impl/dir_contents.h" #include "ui/gfx/size.h" #include "webkit/fileapi/file_system_types.h" #include "webkit/glue/clipboard_client.h" -#include "webkit/plugins/ppapi/dir_contents.h" #include "webkit/quota/quota_types.h" class GURL; @@ -55,6 +55,7 @@ class CommandBuffer; } namespace ppapi { +class PepperFilePath; class PPB_HostResolver_Shared; class PPB_X509Certificate_Fields; struct DeviceRefData; @@ -86,7 +87,6 @@ namespace ppapi { class FileIO; class FullscreenContainer; -class PepperFilePath; class PluginInstance; class PluginModule; class PPB_Broker_Impl; @@ -452,18 +452,24 @@ 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 PepperFilePath& path, - int flags, - base::PlatformFile* file) = 0; - virtual base::PlatformFileError RenameFile(const PepperFilePath& from_path, - const PepperFilePath& to_path) = 0; - virtual base::PlatformFileError DeleteFileOrDir(const PepperFilePath& path, - bool recursive) = 0; - virtual base::PlatformFileError CreateDir(const PepperFilePath& path) = 0; - virtual base::PlatformFileError QueryFile(const PepperFilePath& path, - base::PlatformFileInfo* info) = 0; - virtual base::PlatformFileError GetDirContents(const PepperFilePath& path, - DirContents* contents) = 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; // Synchronously returns the platform file path for a filesystem URL. virtual void SyncGetFileSystemPlatformPath(const GURL& url, diff --git a/webkit/plugins/ppapi/ppb_flash_impl.cc b/webkit/plugins/ppapi/ppb_flash_impl.cc index 668a8c1..059bd39 100644 --- a/webkit/plugins/ppapi/ppb_flash_impl.cc +++ b/webkit/plugins/ppapi/ppb_flash_impl.cc @@ -13,6 +13,7 @@ #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" @@ -30,7 +31,6 @@ #include "webkit/glue/clipboard_client.h" #include "webkit/glue/scoped_clipboard_writer_glue.h" #include "webkit/plugins/ppapi/common.h" -#include "webkit/plugins/ppapi/file_path.h" #include "webkit/plugins/ppapi/host_globals.h" #include "webkit/plugins/ppapi/plugin_delegate.h" #include "webkit/plugins/ppapi/plugin_module.h" @@ -397,7 +397,8 @@ int32_t PPB_Flash_Impl::OpenFile(PP_Instance pp_instance, base::PlatformFile base_file; base::PlatformFileError result = instance->delegate()->OpenFile( - PepperFilePath::MakeModuleLocal(instance->module(), path), + ::ppapi::PepperFilePath::MakeModuleLocal( + instance->module()->name(), path), flags, &base_file); *file = base_file; @@ -415,8 +416,10 @@ int32_t PPB_Flash_Impl::RenameFile(PP_Instance pp_instance, return PP_ERROR_FAILED; base::PlatformFileError result = instance->delegate()->RenameFile( - PepperFilePath::MakeModuleLocal(instance->module(), path_from), - PepperFilePath::MakeModuleLocal(instance->module(), path_to)); + ::ppapi::PepperFilePath::MakeModuleLocal( + instance->module()->name(), path_from), + ::ppapi::PepperFilePath::MakeModuleLocal( + instance->module()->name(), path_to)); return ::ppapi::PlatformFileErrorToPepperError(result); } @@ -431,7 +434,8 @@ int32_t PPB_Flash_Impl::DeleteFileOrDir(PP_Instance pp_instance, return PP_ERROR_FAILED; base::PlatformFileError result = instance->delegate()->DeleteFileOrDir( - PepperFilePath::MakeModuleLocal(instance->module(), path), + ::ppapi::PepperFilePath::MakeModuleLocal( + instance->module()->name(), path), PPBoolToBool(recursive)); return ::ppapi::PlatformFileErrorToPepperError(result); } @@ -445,7 +449,8 @@ int32_t PPB_Flash_Impl::CreateDir(PP_Instance pp_instance, const char* path) { return PP_ERROR_FAILED; base::PlatformFileError result = instance->delegate()->CreateDir( - PepperFilePath::MakeModuleLocal(instance->module(), path)); + ::ppapi::PepperFilePath::MakeModuleLocal( + instance->module()->name(), path)); return ::ppapi::PlatformFileErrorToPepperError(result); } @@ -461,7 +466,8 @@ int32_t PPB_Flash_Impl::QueryFile(PP_Instance pp_instance, base::PlatformFileInfo file_info; base::PlatformFileError result = instance->delegate()->QueryFile( - PepperFilePath::MakeModuleLocal(instance->module(), path), + ::ppapi::PepperFilePath::MakeModuleLocal( + instance->module()->name(), path), &file_info); if (result == base::PLATFORM_FILE_OK) { info->size = file_info.size; @@ -487,9 +493,10 @@ int32_t PPB_Flash_Impl::GetDirContents(PP_Instance pp_instance, return PP_ERROR_FAILED; *contents = NULL; - DirContents pepper_contents; + ::ppapi::DirContents pepper_contents; base::PlatformFileError result = instance->delegate()->GetDirContents( - PepperFilePath::MakeModuleLocal(instance->module(), path), + ::ppapi::PepperFilePath::MakeModuleLocal( + instance->module()->name(), path), &pepper_contents); if (result != base::PLATFORM_FILE_OK) @@ -534,7 +541,7 @@ int32_t PPB_Flash_Impl::OpenFileRef(PP_Instance pp_instance, base::PlatformFile base_file; base::PlatformFileError result = instance->delegate()->OpenFile( - PepperFilePath::MakeAbsolute(file_ref->GetSystemPath()), + ::ppapi::PepperFilePath::MakeAbsolute(file_ref->GetSystemPath()), flags, &base_file); *file = base_file; @@ -555,7 +562,7 @@ int32_t PPB_Flash_Impl::QueryFileRef(PP_Instance pp_instance, base::PlatformFileInfo file_info; base::PlatformFileError result = instance->delegate()->QueryFile( - PepperFilePath::MakeAbsolute(file_ref->GetSystemPath()), + ::ppapi::PepperFilePath::MakeAbsolute(file_ref->GetSystemPath()), &file_info); if (result == base::PLATFORM_FILE_OK) { info->size = file_info.size; |