diff options
Diffstat (limited to 'webkit/plugins/npapi')
22 files changed, 131 insertions, 123 deletions
diff --git a/webkit/plugins/npapi/plugin_host.cc b/webkit/plugins/npapi/plugin_host.cc index a54c0ba..5cea951 100644 --- a/webkit/plugins/npapi/plugin_host.cc +++ b/webkit/plugins/npapi/plugin_host.cc @@ -467,14 +467,14 @@ static NPError PostURLNotify(NPP id, return NPERR_FILE_NOT_FOUND; std::string file_path_ascii(buf); - FilePath file_path; + base::FilePath file_path; static const char kFileUrlPrefix[] = "file:"; if (StartsWithASCII(file_path_ascii, kFileUrlPrefix, false)) { GURL file_url(file_path_ascii); DCHECK(file_url.SchemeIsFile()); net::FileURLToFilePath(file_url, &file_path); } else { - file_path = FilePath::FromWStringHack( + file_path = base::FilePath::FromWStringHack( base::SysNativeMBToWide(file_path_ascii)); } diff --git a/webkit/plugins/npapi/plugin_instance.cc b/webkit/plugins/npapi/plugin_instance.cc index f26cbec..4d49a05 100644 --- a/webkit/plugins/npapi/plugin_instance.cc +++ b/webkit/plugins/npapi/plugin_instance.cc @@ -315,7 +315,7 @@ void PluginInstance::NPP_StreamAsFile(NPStream *stream, const char *fname) { // Creating a temporary FilePath instance on the stack as the explicit // FilePath constructor with StringType as an argument causes a compiler // error when invoked via vector push back. - FilePath file_name = FilePath::FromWStringHack(UTF8ToWide(fname)); + base::FilePath file_name = base::FilePath::FromWStringHack(UTF8ToWide(fname)); files_created_.push_back(file_name); } diff --git a/webkit/plugins/npapi/plugin_lib.cc b/webkit/plugins/npapi/plugin_lib.cc index ed01426..7b927e0 100644 --- a/webkit/plugins/npapi/plugin_lib.cc +++ b/webkit/plugins/npapi/plugin_lib.cc @@ -23,7 +23,7 @@ const char kPluginInstancesActiveCounter[] = "PluginInstancesActive"; // A list of all the instantiated plugins. static std::vector<scoped_refptr<PluginLib> >* g_loaded_libs; -PluginLib* PluginLib::CreatePluginLib(const FilePath& filename) { +PluginLib* PluginLib::CreatePluginLib(const base::FilePath& filename) { // We can only have one PluginLib object per plugin as it controls the per // instance function calls (i.e. NP_Initialize and NP_Shutdown). So we keep // a map of PluginLib objects. @@ -271,7 +271,7 @@ bool PluginLib::Load() { // This is a helper to help perform a delayed NP_Shutdown and FreeLibrary on the // plugin dll. -void FreePluginLibraryHelper(const FilePath& path, +void FreePluginLibraryHelper(const base::FilePath& path, base::NativeLibrary library, NP_ShutdownFunc shutdown_func) { if (shutdown_func) { diff --git a/webkit/plugins/npapi/plugin_lib.h b/webkit/plugins/npapi/plugin_lib.h index 9051e2d..36e9a41 100644 --- a/webkit/plugins/npapi/plugin_lib.h +++ b/webkit/plugins/npapi/plugin_lib.h @@ -16,7 +16,9 @@ #include "webkit/plugins/npapi/webplugin.h" #include "webkit/plugins/webkit_plugins_export.h" +namespace base { class FilePath; +} namespace webkit { namespace npapi { @@ -27,12 +29,12 @@ class PluginInstance; // manager for new PluginInstances. class WEBKIT_PLUGINS_EXPORT PluginLib : public base::RefCounted<PluginLib> { public: - static PluginLib* CreatePluginLib(const FilePath& filename); + static PluginLib* CreatePluginLib(const base::FilePath& filename); // Creates a WebPluginInfo structure given a plugin's path. On success // returns true, with the information being put into "info". // Returns false if the library couldn't be found, or if it's not a plugin. - static bool ReadWebPluginInfo(const FilePath& filename, + static bool ReadWebPluginInfo(const base::FilePath& filename, webkit::WebPluginInfo* info); #if defined(OS_POSIX) && !defined(OS_MACOSX) diff --git a/webkit/plugins/npapi/plugin_lib_mac.mm b/webkit/plugins/npapi/plugin_lib_mac.mm index d283100..32e40df9 100644 --- a/webkit/plugins/npapi/plugin_lib_mac.mm +++ b/webkit/plugins/npapi/plugin_lib_mac.mm @@ -76,7 +76,7 @@ NSDictionary* GetMIMETypes(CFBundleRef bundle) { } } -bool ReadPlistPluginInfo(const FilePath& filename, CFBundleRef bundle, +bool ReadPlistPluginInfo(const base::FilePath& filename, CFBundleRef bundle, WebPluginInfo* info) { NSDictionary* mime_types = GetMIMETypes(bundle); if (!mime_types) @@ -137,7 +137,7 @@ bool ReadPlistPluginInfo(const FilePath& filename, CFBundleRef bundle, } // anonymous namespace -bool PluginLib::ReadWebPluginInfo(const FilePath &filename, +bool PluginLib::ReadWebPluginInfo(const base::FilePath &filename, WebPluginInfo* info) { // There are three ways to get information about plugin capabilities: // 1) a set of Info.plist keys, documented at diff --git a/webkit/plugins/npapi/plugin_lib_posix.cc b/webkit/plugins/npapi/plugin_lib_posix.cc index cc3ed52..144b133 100644 --- a/webkit/plugins/npapi/plugin_lib_posix.cc +++ b/webkit/plugins/npapi/plugin_lib_posix.cc @@ -42,7 +42,7 @@ enum nsPluginVariable { // Read the ELF header and return true if it is usable on // the current architecture (e.g. 32-bit ELF on 32-bit build). // Returns false on other errors as well. -bool ELFMatchesCurrentArchitecture(const FilePath& filename) { +bool ELFMatchesCurrentArchitecture(const base::FilePath& filename) { // First make sure we can open the file and it is in fact, a regular file. struct stat stat_buf; // Open with O_NONBLOCK so we don't block on pipes. @@ -91,7 +91,7 @@ struct __attribute__((packed)) NSPluginWrapperInfo { // if so attempt to unwrap it. Pass in an opened plugin handle; on // success, |dl| and |unwrapped_path| will be filled in with the newly // opened plugin. On failure, params are left unmodified. -void UnwrapNSPluginWrapper(void **dl, FilePath* unwrapped_path) { +void UnwrapNSPluginWrapper(void **dl, base::FilePath* unwrapped_path) { NSPluginWrapperInfo* info = reinterpret_cast<NSPluginWrapperInfo*>(dlsym(*dl, "NPW_Plugin")); if (!info) @@ -107,7 +107,8 @@ void UnwrapNSPluginWrapper(void **dl, FilePath* unwrapped_path) { sizeof(info->path))); if (!path_end) path_end = info->path + sizeof(info->path); - FilePath path = FilePath(std::string(info->path, path_end - info->path)); + base::FilePath path = base::FilePath( + std::string(info->path, path_end - info->path)); if (!ELFMatchesCurrentArchitecture(path)) { LOG(WARNING) << path.value() << " is nspluginwrapper wrapping a " @@ -139,7 +140,7 @@ void UnwrapNSPluginWrapper(void **dl, FilePath* unwrapped_path) { } // namespace -bool PluginLib::ReadWebPluginInfo(const FilePath& filename, +bool PluginLib::ReadWebPluginInfo(const base::FilePath& filename, WebPluginInfo* info) { // The file to reference is: // http://mxr.mozilla.org/firefox/source/modules/plugin/base/src/nsPluginsDirUnix.cpp diff --git a/webkit/plugins/npapi/plugin_lib_win.cc b/webkit/plugins/npapi/plugin_lib_win.cc index 224e1c3..8a0f6cc 100644 --- a/webkit/plugins/npapi/plugin_lib_win.cc +++ b/webkit/plugins/npapi/plugin_lib_win.cc @@ -15,7 +15,7 @@ namespace webkit { namespace npapi { -bool PluginLib::ReadWebPluginInfo(const FilePath &filename, +bool PluginLib::ReadWebPluginInfo(const base::FilePath &filename, WebPluginInfo* info) { // On windows, the way we get the mime types for the library is // to check the version information in the DLL itself. This diff --git a/webkit/plugins/npapi/plugin_list.cc b/webkit/plugins/npapi/plugin_list.cc index 5bcc960..7047a7f 100644 --- a/webkit/plugins/npapi/plugin_list.cc +++ b/webkit/plugins/npapi/plugin_list.cc @@ -86,7 +86,7 @@ void PluginList::RefreshPlugins() { loading_state_ = LOADING_STATE_NEEDS_REFRESH; } -void PluginList::AddExtraPluginPath(const FilePath& plugin_path) { +void PluginList::AddExtraPluginPath(const base::FilePath& plugin_path) { if (!NPAPIPluginsSupported()) { // TODO(jam): remove and just have CHECK once we're sure this doesn't get // triggered. @@ -101,16 +101,16 @@ void PluginList::AddExtraPluginPath(const FilePath& plugin_path) { #endif } -void PluginList::RemoveExtraPluginPath(const FilePath& plugin_path) { +void PluginList::RemoveExtraPluginPath(const base::FilePath& plugin_path) { base::AutoLock lock(lock_); - std::vector<FilePath>::iterator it = + std::vector<base::FilePath>::iterator it = std::find(extra_plugin_paths_.begin(), extra_plugin_paths_.end(), plugin_path); if (it != extra_plugin_paths_.end()) extra_plugin_paths_.erase(it); } -void PluginList::AddExtraPluginDir(const FilePath& plugin_dir) { +void PluginList::AddExtraPluginDir(const base::FilePath& plugin_dir) { // Chrome OS only loads plugins from /opt/google/chrome/plugins. #if !defined(OS_CHROMEOS) base::AutoLock lock(lock_); @@ -148,7 +148,7 @@ void PluginList::RegisterInternalPluginWithEntryPoints( } } -void PluginList::UnregisterInternalPlugin(const FilePath& path) { +void PluginList::UnregisterInternalPlugin(const base::FilePath& path) { base::AutoLock lock(lock_); for (size_t i = 0; i < internal_plugins_.size(); i++) { if (internal_plugins_[i].info.path == path) { @@ -170,7 +170,7 @@ void PluginList::GetInternalPlugins( } } -bool PluginList::ReadPluginInfo(const FilePath& filename, +bool PluginList::ReadPluginInfo(const base::FilePath& filename, webkit::WebPluginInfo* info, const PluginEntryPoints** entry_points) { { @@ -252,10 +252,10 @@ void PluginList::LoadPluginsIntoPluginListInternal( if (!will_load_callback.is_null()) will_load_callback.Run(); - std::vector<FilePath> plugin_paths; + std::vector<base::FilePath> plugin_paths; GetPluginPathsToLoad(&plugin_paths); - for (std::vector<FilePath>::const_iterator it = plugin_paths.begin(); + for (std::vector<base::FilePath>::const_iterator it = plugin_paths.begin(); it != plugin_paths.end(); ++it) { WebPluginInfo plugin_info; @@ -286,7 +286,7 @@ void PluginList::LoadPlugins() { } bool PluginList::LoadPluginIntoPluginList( - const FilePath& path, + const base::FilePath& path, std::vector<webkit::WebPluginInfo>* plugins, WebPluginInfo* plugin_info) { LOG_IF(ERROR, PluginList::DebugPluginLoading()) @@ -316,11 +316,11 @@ bool PluginList::LoadPluginIntoPluginList( return true; } -void PluginList::GetPluginPathsToLoad(std::vector<FilePath>* plugin_paths) { +void PluginList::GetPluginPathsToLoad(std::vector<base::FilePath>* plugin_paths) { // Don't want to hold the lock while loading new plugins, so we don't block // other methods if they're called on other threads. - std::vector<FilePath> extra_plugin_paths; - std::vector<FilePath> extra_plugin_dirs; + std::vector<base::FilePath> extra_plugin_paths; + std::vector<base::FilePath> extra_plugin_dirs; { base::AutoLock lock(lock_); extra_plugin_paths = extra_plugin_paths_; @@ -328,7 +328,7 @@ void PluginList::GetPluginPathsToLoad(std::vector<FilePath>* plugin_paths) { } for (size_t i = 0; i < extra_plugin_paths.size(); ++i) { - const FilePath& path = extra_plugin_paths[i]; + const base::FilePath& path = extra_plugin_paths[i]; if (std::find(plugin_paths->begin(), plugin_paths->end(), path) != plugin_paths->end()) { continue; @@ -342,7 +342,7 @@ void PluginList::GetPluginPathsToLoad(std::vector<FilePath>* plugin_paths) { for (size_t i = 0; i < extra_plugin_dirs.size(); ++i) GetPluginsInDir(extra_plugin_dirs[i], plugin_paths); - std::vector<FilePath> directories_to_scan; + std::vector<base::FilePath> directories_to_scan; GetPluginDirectories(&directories_to_scan); for (size_t i = 0; i < directories_to_scan.size(); ++i) GetPluginsInDir(directories_to_scan[i], plugin_paths); @@ -401,12 +401,12 @@ void PluginList::GetPluginInfoArray( if (actual_mime_types) actual_mime_types->clear(); - std::set<FilePath> visited_plugins; + std::set<base::FilePath> visited_plugins; // Add in plugins by mime type. for (size_t i = 0; i < plugins_list_.size(); ++i) { if (SupportsType(plugins_list_[i], mime_type, allow_wildcard)) { - FilePath path = plugins_list_[i].path; + base::FilePath path = plugins_list_[i].path; if (visited_plugins.insert(path).second) { info->push_back(plugins_list_[i]); if (actual_mime_types) @@ -423,7 +423,7 @@ void PluginList::GetPluginInfoArray( std::string actual_mime_type; for (size_t i = 0; i < plugins_list_.size(); ++i) { if (SupportsExtension(plugins_list_[i], extension, &actual_mime_type)) { - FilePath path = plugins_list_[i].path; + base::FilePath path = plugins_list_[i].path; if (visited_plugins.insert(path).second && AllowMimeTypeMismatch(mime_type, actual_mime_type)) { info->push_back(plugins_list_[i]); diff --git a/webkit/plugins/npapi/plugin_list.h b/webkit/plugins/npapi/plugin_list.h index f34a18a..1cd82ed 100644 --- a/webkit/plugins/npapi/plugin_list.h +++ b/webkit/plugins/npapi/plugin_list.h @@ -71,14 +71,14 @@ class WEBKIT_PLUGINS_EXPORT PluginList { // Add/Remove an extra plugin to load when we actually do the loading. Must // be called before the plugins have been loaded. - void AddExtraPluginPath(const FilePath& plugin_path); - void RemoveExtraPluginPath(const FilePath& plugin_path); + void AddExtraPluginPath(const base::FilePath& plugin_path); + void RemoveExtraPluginPath(const base::FilePath& plugin_path); // Same as above, but specifies a directory in which to search for plugins. - void AddExtraPluginDir(const FilePath& plugin_dir); + void AddExtraPluginDir(const base::FilePath& plugin_dir); // Get the ordered list of directories from which to load plugins - void GetPluginDirectories(std::vector<FilePath>* plugin_dirs); + void GetPluginDirectories(std::vector<base::FilePath>* plugin_dirs); // Register an internal plugin with the specified plugin information. // An internal plugin must be registered before it can @@ -100,7 +100,7 @@ class WEBKIT_PLUGINS_EXPORT PluginList { // on the path from the version info previously registered. // // This is generally only necessary for tests. - void UnregisterInternalPlugin(const FilePath& path); + void UnregisterInternalPlugin(const base::FilePath& path); // Gets a list of all the registered internal plugins. void GetInternalPlugins(std::vector<webkit::WebPluginInfo>* plugins); @@ -110,7 +110,7 @@ class WEBKIT_PLUGINS_EXPORT PluginList { // internal plugin, "entry_points" is filled in as well with a // internally-owned PluginEntryPoints pointer. // Returns false if the library couldn't be found, or if it's not a plugin. - bool ReadPluginInfo(const FilePath& filename, + bool ReadPluginInfo(const base::FilePath& filename, webkit::WebPluginInfo* info, const PluginEntryPoints** entry_points); @@ -153,7 +153,7 @@ class WEBKIT_PLUGINS_EXPORT PluginList { // Load a specific plugin with full path. Return true iff loading the plug-in // was successful. - bool LoadPluginIntoPluginList(const FilePath& filename, + bool LoadPluginIntoPluginList(const base::FilePath& filename, std::vector<webkit::WebPluginInfo>* plugins, webkit::WebPluginInfo* plugin_info); @@ -161,7 +161,7 @@ class WEBKIT_PLUGINS_EXPORT PluginList { // using a different instance of this class. // Computes a list of all plugins to potentially load from all sources. - void GetPluginPathsToLoad(std::vector<FilePath>* plugin_paths); + void GetPluginPathsToLoad(std::vector<base::FilePath>* plugin_paths); // Clears the internal list of Plugins and copies them from the vector. void SetPlugins(const std::vector<webkit::WebPluginInfo>& plugins); @@ -200,7 +200,8 @@ class WEBKIT_PLUGINS_EXPORT PluginList { // Walks a directory and produces a list of all the plugins to potentially // load in that directory. - void GetPluginsInDir(const FilePath& path, std::vector<FilePath>* plugins); + void GetPluginsInDir(const base::FilePath& path, + std::vector<base::FilePath>* plugins); // Returns true if we should load the given plugin, or false otherwise. // |plugins| is the list of plugins we have crawled in the current plugin @@ -234,7 +235,7 @@ class WEBKIT_PLUGINS_EXPORT PluginList { // Gets plugin paths registered under HKCU\Software\MozillaPlugins and // HKLM\Software\MozillaPlugins. - void GetPluginPathsFromRegistry(std::vector<FilePath>* plugins); + void GetPluginPathsFromRegistry(std::vector<base::FilePath>* plugins); #endif // @@ -247,10 +248,10 @@ class WEBKIT_PLUGINS_EXPORT PluginList { LoadingState loading_state_; // Extra plugin paths that we want to search when loading. - std::vector<FilePath> extra_plugin_paths_; + std::vector<base::FilePath> extra_plugin_paths_; // Extra plugin directories that we want to search when loading. - std::vector<FilePath> extra_plugin_dirs_; + std::vector<base::FilePath> extra_plugin_dirs_; // Holds information about internal plugins. std::vector<InternalPlugin> internal_plugins_; diff --git a/webkit/plugins/npapi/plugin_list_mac.mm b/webkit/plugins/npapi/plugin_list_mac.mm index 719301d..b818f89 100644 --- a/webkit/plugins/npapi/plugin_list_mac.mm +++ b/webkit/plugins/npapi/plugin_list_mac.mm @@ -19,7 +19,7 @@ namespace npapi { namespace { -void GetPluginCommonDirectory(std::vector<FilePath>* plugin_dirs, +void GetPluginCommonDirectory(std::vector<base::FilePath>* plugin_dirs, bool user) { // Note that there are no NSSearchPathDirectory constants for these // directories so we can't use Cocoa's NSSearchPathForDirectoriesInDomains(). @@ -32,7 +32,7 @@ void GetPluginCommonDirectory(std::vector<FilePath>* plugin_dirs, if (err) return; - plugin_dirs->push_back(FilePath(base::mac::PathFromFSRef(ref))); + plugin_dirs->push_back(base::FilePath(base::mac::PathFromFSRef(ref))); } // Returns true if the plugin should be prevented from loading. @@ -68,7 +68,7 @@ bool IsBlacklistedPlugin(const WebPluginInfo& info) { void PluginList::PlatformInit() { } -void PluginList::GetPluginDirectories(std::vector<FilePath>* plugin_dirs) { +void PluginList::GetPluginDirectories(std::vector<base::FilePath>* plugin_dirs) { // Load from the user's area GetPluginCommonDirectory(plugin_dirs, true); @@ -77,11 +77,11 @@ void PluginList::GetPluginDirectories(std::vector<FilePath>* plugin_dirs) { } void PluginList::GetPluginsInDir( - const FilePath& path, std::vector<FilePath>* plugins) { + const base::FilePath& path, std::vector<base::FilePath>* plugins) { file_util::FileEnumerator enumerator(path, false, // not recursive file_util::FileEnumerator::DIRECTORIES); - for (FilePath path = enumerator.Next(); !path.value().empty(); + for (base::FilePath path = enumerator.Next(); !path.value().empty(); path = enumerator.Next()) { plugins->push_back(path); } diff --git a/webkit/plugins/npapi/plugin_list_posix.cc b/webkit/plugins/npapi/plugin_list_posix.cc index 94974a5..62c4990 100644 --- a/webkit/plugins/npapi/plugin_list_posix.cc +++ b/webkit/plugins/npapi/plugin_list_posix.cc @@ -21,7 +21,7 @@ namespace npapi { namespace { // We build up a list of files and mtimes so we can sort them. -typedef std::pair<FilePath, base::Time> FileAndTime; +typedef std::pair<base::FilePath, base::Time> FileAndTime; typedef std::vector<FileAndTime> FileTimeList; enum PluginQuirk { @@ -63,7 +63,7 @@ bool CheckQuirks(PluginQuirk quirks) { // Also check against any PluginQuirks the bad plugin may have. // The use of the file size is an optimization so we don't have to read in // the entire file unless we have to. -bool IsBlacklistedBySha1sumAndQuirks(const FilePath& path) { +bool IsBlacklistedBySha1sumAndQuirks(const base::FilePath& path) { const struct BadEntry { int64 size; std::string sha1; @@ -123,7 +123,7 @@ bool IsUndesirablePlugin(const WebPluginInfo& info) { // This is an ugly hack to blacklist Adobe Acrobat due to not supporting // its Xt-based mainloop. // http://code.google.com/p/chromium/issues/detail?id=38229 -bool IsBlacklistedPlugin(const FilePath& path) { +bool IsBlacklistedPlugin(const base::FilePath& path) { const char* kBlackListedPlugins[] = { "nppdf.so", // Adobe PDF }; @@ -141,7 +141,7 @@ bool IsBlacklistedPlugin(const FilePath& path) { void PluginList::PlatformInit() { } -void PluginList::GetPluginDirectories(std::vector<FilePath>* plugin_dirs) { +void PluginList::GetPluginDirectories(std::vector<base::FilePath>* plugin_dirs) { // See http://groups.google.com/group/chromium-dev/browse_thread/thread/7a70e5fcbac786a9 // for discussion. // We first consult Chrome-specific dirs, then fall back on the logic @@ -152,7 +152,7 @@ void PluginList::GetPluginDirectories(std::vector<FilePath>* plugin_dirs) { // related to extra_plugin_dirs in plugin_list.cc. // The Chrome binary dir + "plugins/". - FilePath dir; + base::FilePath dir; PathService::Get(base::DIR_EXE, &dir); plugin_dirs->push_back(dir.Append("plugins")); @@ -169,36 +169,36 @@ void PluginList::GetPluginDirectories(std::vector<FilePath>* plugin_dirs) { std::vector<std::string> paths; base::SplitString(moz_plugin_path, ':', &paths); for (size_t i = 0; i < paths.size(); ++i) - plugin_dirs->push_back(FilePath(paths[i])); + plugin_dirs->push_back(base::FilePath(paths[i])); } // 2) NS_USER_PLUGINS_DIR: ~/.mozilla/plugins. // This is a de-facto standard, so even though we're not Mozilla, let's // look in there too. - FilePath home = file_util::GetHomeDir(); + base::FilePath home = file_util::GetHomeDir(); if (!home.empty()) plugin_dirs->push_back(home.Append(".mozilla/plugins")); // 3) NS_SYSTEM_PLUGINS_DIR: // This varies across different browsers and versions, so check 'em all. - plugin_dirs->push_back(FilePath("/usr/lib/browser-plugins")); - plugin_dirs->push_back(FilePath("/usr/lib/mozilla/plugins")); - plugin_dirs->push_back(FilePath("/usr/lib/firefox/plugins")); - plugin_dirs->push_back(FilePath("/usr/lib/xulrunner-addons/plugins")); + plugin_dirs->push_back(base::FilePath("/usr/lib/browser-plugins")); + plugin_dirs->push_back(base::FilePath("/usr/lib/mozilla/plugins")); + plugin_dirs->push_back(base::FilePath("/usr/lib/firefox/plugins")); + plugin_dirs->push_back(base::FilePath("/usr/lib/xulrunner-addons/plugins")); #if defined(ARCH_CPU_64_BITS) // On my Ubuntu system, /usr/lib64 is a symlink to /usr/lib. // But a user reported on their Fedora system they are separate. - plugin_dirs->push_back(FilePath("/usr/lib64/browser-plugins")); - plugin_dirs->push_back(FilePath("/usr/lib64/mozilla/plugins")); - plugin_dirs->push_back(FilePath("/usr/lib64/firefox/plugins")); - plugin_dirs->push_back(FilePath("/usr/lib64/xulrunner-addons/plugins")); + plugin_dirs->push_back(base::FilePath("/usr/lib64/browser-plugins")); + plugin_dirs->push_back(base::FilePath("/usr/lib64/mozilla/plugins")); + plugin_dirs->push_back(base::FilePath("/usr/lib64/firefox/plugins")); + plugin_dirs->push_back(base::FilePath("/usr/lib64/xulrunner-addons/plugins")); #endif // defined(ARCH_CPU_64_BITS) #endif // !defined(OS_CHROMEOS) } void PluginList::GetPluginsInDir( - const FilePath& dir_path, std::vector<FilePath>* plugins) { + const base::FilePath& dir_path, std::vector<base::FilePath>* plugins) { // See ScanPluginsDirectory near // http://mxr.mozilla.org/firefox/source/modules/plugin/base/src/nsPluginHostImpl.cpp#5052 @@ -208,7 +208,7 @@ void PluginList::GetPluginsInDir( file_util::FileEnumerator enumerator(dir_path, false, // not recursive file_util::FileEnumerator::FILES); - for (FilePath path = enumerator.Next(); !path.value().empty(); + for (base::FilePath path = enumerator.Next(); !path.value().empty(); path = enumerator.Next()) { // Skip over Mozilla .xpt files. if (path.MatchesExtension(FILE_PATH_LITERAL(".xpt"))) @@ -218,7 +218,7 @@ void PluginList::GetPluginsInDir( // its path to find dependent data files. // file_util::AbsolutePath calls through to realpath(), which resolves // symlinks. - FilePath orig_path = path; + base::FilePath orig_path = path; file_util::AbsolutePath(&path); LOG_IF(ERROR, PluginList::DebugPluginLoading()) << "Resolved " << orig_path.value() << " -> " << path.value(); diff --git a/webkit/plugins/npapi/plugin_list_unittest.cc b/webkit/plugins/npapi/plugin_list_unittest.cc index 5d198d1..0fc55bf 100644 --- a/webkit/plugins/npapi/plugin_list_unittest.cc +++ b/webkit/plugins/npapi/plugin_list_unittest.cc @@ -31,8 +31,8 @@ bool Contains(const std::vector<WebPluginInfo>& list, return false; } -FilePath::CharType kFooPath[] = FILE_PATH_LITERAL("/plugins/foo.plugin"); -FilePath::CharType kBarPath[] = FILE_PATH_LITERAL("/plugins/bar.plugin"); +base::FilePath::CharType kFooPath[] = FILE_PATH_LITERAL("/plugins/foo.plugin"); +base::FilePath::CharType kBarPath[] = FILE_PATH_LITERAL("/plugins/bar.plugin"); const char* kFooName = "Foo Plugin"; } // namespace @@ -41,11 +41,11 @@ class PluginListTest : public testing::Test { public: PluginListTest() : foo_plugin_(ASCIIToUTF16(kFooName), - FilePath(kFooPath), + base::FilePath(kFooPath), ASCIIToUTF16("1.2.3"), ASCIIToUTF16("foo")), bar_plugin_(ASCIIToUTF16("Bar Plugin"), - FilePath(kBarPath), + base::FilePath(kBarPath), ASCIIToUTF16("2.3.4"), ASCIIToUTF16("bar")) { } @@ -71,7 +71,7 @@ TEST_F(PluginListTest, GetPlugins) { TEST_F(PluginListTest, BadPluginDescription) { WebPluginInfo plugin_3043( - string16(), FilePath(FILE_PATH_LITERAL("/myplugin.3.0.43")), + string16(), base::FilePath(FILE_PATH_LITERAL("/myplugin.3.0.43")), string16(), string16()); // Simulate loading of the plugins. plugin_list_.ClearPluginsToLoad(); diff --git a/webkit/plugins/npapi/plugin_list_win.cc b/webkit/plugins/npapi/plugin_list_win.cc index 22dce63..0f19d08 100644 --- a/webkit/plugins/npapi/plugin_list_win.cc +++ b/webkit/plugins/npapi/plugin_list_win.cc @@ -43,7 +43,7 @@ const char16 kRegistryJavaHome[] = L"JavaHome"; const char16 kJavaDeploy1[] = L"npdeploytk.dll"; const char16 kJavaDeploy2[] = L"npdeployjava1.dll"; -FilePath AppendPluginsDir(const FilePath& path) { +base::FilePath AppendPluginsDir(const base::FilePath& path) { return path.AppendASCII("plugins"); } @@ -51,8 +51,8 @@ FilePath AppendPluginsDir(const FilePath& path) { // may be a versioned subdirectory, or it may be the same directory as the // GetExeDirectory(), depending on the embedder's implementation. // Path is an output parameter to receive the path. -void GetAppDirectory(std::set<FilePath>* plugin_dirs) { - FilePath app_path; +void GetAppDirectory(std::set<base::FilePath>* plugin_dirs) { + base::FilePath app_path; if (!PathService::Get(base::DIR_MODULE, &app_path)) return; plugin_dirs->insert(AppendPluginsDir(app_path)); @@ -60,15 +60,15 @@ void GetAppDirectory(std::set<FilePath>* plugin_dirs) { // Gets the directory where the launching executable resides on disk. // Path is an output parameter to receive the path. -void GetExeDirectory(std::set<FilePath>* plugin_dirs) { - FilePath exe_path; +void GetExeDirectory(std::set<base::FilePath>* plugin_dirs) { + base::FilePath exe_path; if (!PathService::Get(base::DIR_EXE, &exe_path)) return; plugin_dirs->insert(AppendPluginsDir(exe_path)); } // Gets the installed path for a registered app. -bool GetInstalledPath(const char16* app, FilePath* out) { +bool GetInstalledPath(const char16* app, base::FilePath* out) { string16 reg_path(kRegistryApps); reg_path.append(L"\\"); reg_path.append(app); @@ -78,12 +78,12 @@ bool GetInstalledPath(const char16* app, FilePath* out) { // As of Win7 AppPaths can also be registered in HKCU: http://goo.gl/UgFOf. if (base::win::GetVersion() >= base::win::VERSION_WIN7 && hkcu_key.ReadValue(kRegistryPath, &path) == ERROR_SUCCESS) { - *out = FilePath(path); + *out = base::FilePath(path); return true; } else { base::win::RegKey hklm_key(HKEY_LOCAL_MACHINE, reg_path.c_str(), KEY_READ); if (hklm_key.ReadValue(kRegistryPath, &path) == ERROR_SUCCESS) { - *out = FilePath(path); + *out = base::FilePath(path); return true; } } @@ -95,7 +95,7 @@ bool GetInstalledPath(const char16* app, FilePath* out) { void GetPluginsInRegistryDirectory( HKEY root_key, const string16& registry_folder, - std::set<FilePath>* plugin_dirs) { + std::set<base::FilePath>* plugin_dirs) { for (base::win::RegistryKeyIterator iter(root_key, registry_folder.c_str()); iter.Valid(); ++iter) { // Use the registry to gather plugin across the file system. @@ -106,13 +106,13 @@ void GetPluginsInRegistryDirectory( string16 path; if (key.ReadValue(kRegistryPath, &path) == ERROR_SUCCESS) - plugin_dirs->insert(FilePath(path)); + plugin_dirs->insert(base::FilePath(path)); } } // Enumerate through the registry key to find all installed FireFox paths. // FireFox 3 beta and version 2 can coexist. See bug: 1025003 -void GetFirefoxInstalledPaths(std::vector<FilePath>* out) { +void GetFirefoxInstalledPaths(std::vector<base::FilePath>* out) { base::win::RegistryKeyIterator it(HKEY_LOCAL_MACHINE, kRegistryFirefoxInstalled); for (; it.Valid(); ++it) { @@ -122,7 +122,7 @@ void GetFirefoxInstalledPaths(std::vector<FilePath>* out) { string16 install_dir; if (key.ReadValue(L"Install Directory", &install_dir) != ERROR_SUCCESS) continue; - out->push_back(FilePath(install_dir)); + out->push_back(base::FilePath(install_dir)); } } @@ -130,14 +130,14 @@ void GetFirefoxInstalledPaths(std::vector<FilePath>* out) { // of a kludge, but it helps us locate the flash player for users that // already have it for firefox. Not having to download yet-another-plugin // is a good thing. -void GetFirefoxDirectory(std::set<FilePath>* plugin_dirs) { - std::vector<FilePath> paths; +void GetFirefoxDirectory(std::set<base::FilePath>* plugin_dirs) { + std::vector<base::FilePath> paths; GetFirefoxInstalledPaths(&paths); for (unsigned int i = 0; i < paths.size(); ++i) { plugin_dirs->insert(AppendPluginsDir(paths[i])); } - FilePath firefox_app_data_plugin_path; + base::FilePath firefox_app_data_plugin_path; if (PathService::Get(base::DIR_APP_DATA, &firefox_app_data_plugin_path)) { firefox_app_data_plugin_path = firefox_app_data_plugin_path.AppendASCII("Mozilla"); @@ -146,8 +146,8 @@ void GetFirefoxDirectory(std::set<FilePath>* plugin_dirs) { } // Hardcoded logic to detect Acrobat plugins locations. -void GetAcrobatDirectory(std::set<FilePath>* plugin_dirs) { - FilePath path; +void GetAcrobatDirectory(std::set<base::FilePath>* plugin_dirs) { + base::FilePath path; if (!GetInstalledPath(kRegistryAcrobatReader, &path) && !GetInstalledPath(kRegistryAcrobat, &path)) { return; @@ -157,21 +157,21 @@ void GetAcrobatDirectory(std::set<FilePath>* plugin_dirs) { } // Hardcoded logic to detect QuickTime plugin location. -void GetQuicktimeDirectory(std::set<FilePath>* plugin_dirs) { - FilePath path; +void GetQuicktimeDirectory(std::set<base::FilePath>* plugin_dirs) { + base::FilePath path; if (GetInstalledPath(kRegistryQuickTime, &path)) plugin_dirs->insert(AppendPluginsDir(path)); } // Hardcoded logic to detect Windows Media Player plugin location. -void GetWindowsMediaDirectory(std::set<FilePath>* plugin_dirs) { - FilePath path; +void GetWindowsMediaDirectory(std::set<base::FilePath>* plugin_dirs) { + base::FilePath path; if (GetInstalledPath(kRegistryWindowsMedia, &path)) plugin_dirs->insert(path); } // Hardcoded logic to detect Java plugin location. -void GetJavaDirectory(std::set<FilePath>* plugin_dirs) { +void GetJavaDirectory(std::set<base::FilePath>* plugin_dirs) { // Load the new NPAPI Java plugin // 1. Open the main JRE key under HKLM base::win::RegKey java_key(HKEY_LOCAL_MACHINE, kRegistryJava, @@ -199,12 +199,12 @@ void GetJavaDirectory(std::set<FilePath>* plugin_dirs) { // 5. We don't know the exact name of the DLL but it's in the form // NP*.dll so just invoke LoadPlugins on this path. - plugin_dirs->insert(FilePath(java_plugin_directory)); + plugin_dirs->insert(base::FilePath(java_plugin_directory)); } } } -bool IsValid32BitImage(const FilePath& path) { +bool IsValid32BitImage(const base::FilePath& path) { file_util::MemoryMappedFile plugin_image; if (!plugin_image.InitializeAsImageSection(path)) @@ -266,9 +266,9 @@ void PluginList::PlatformInit() { dont_load_new_wmp_ = command_line.HasSwitch(switches::kUseOldWMPPlugin); } -void PluginList::GetPluginDirectories(std::vector<FilePath>* plugin_dirs) { +void PluginList::GetPluginDirectories(std::vector<base::FilePath>* plugin_dirs) { // We use a set for uniqueness, which we require, over order, which we do not. - std::set<FilePath> dirs; + std::set<base::FilePath> dirs; // Load from the application-specific area GetAppDirectory(&dirs); @@ -289,12 +289,12 @@ void PluginList::GetPluginDirectories(std::vector<FilePath>* plugin_dirs) { GetQuicktimeDirectory(&dirs); GetWindowsMediaDirectory(&dirs); - for (std::set<FilePath>::iterator i = dirs.begin(); i != dirs.end(); ++i) + for (std::set<base::FilePath>::iterator i = dirs.begin(); i != dirs.end(); ++i) plugin_dirs->push_back(*i); } void PluginList::GetPluginsInDir( - const FilePath& path, std::vector<FilePath>* plugins) { + const base::FilePath& path, std::vector<base::FilePath>* plugins) { WIN32_FIND_DATA find_file_data; HANDLE find_handle; @@ -308,7 +308,7 @@ void PluginList::GetPluginsInDir( do { if (!(find_file_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { - FilePath filename = path.Append(find_file_data.cFileName); + base::FilePath filename = path.Append(find_file_data.cFileName); plugins->push_back(filename); } } while (FindNextFile(find_handle, &find_file_data) != 0); @@ -317,15 +317,15 @@ void PluginList::GetPluginsInDir( FindClose(find_handle); } -void PluginList::GetPluginPathsFromRegistry(std::vector<FilePath>* plugins) { - std::set<FilePath> plugin_dirs; +void PluginList::GetPluginPathsFromRegistry(std::vector<base::FilePath>* plugins) { + std::set<base::FilePath> plugin_dirs; GetPluginsInRegistryDirectory( HKEY_CURRENT_USER, kRegistryMozillaPlugins, &plugin_dirs); GetPluginsInRegistryDirectory( HKEY_LOCAL_MACHINE, kRegistryMozillaPlugins, &plugin_dirs); - for (std::set<FilePath>::iterator i = plugin_dirs.begin(); + for (std::set<base::FilePath>::iterator i = plugin_dirs.begin(); i != plugin_dirs.end(); ++i) { plugins->push_back(*i); } @@ -336,9 +336,9 @@ bool PluginList::ShouldLoadPluginUsingPluginList( std::vector<webkit::WebPluginInfo>* plugins) { // Version check for (size_t j = 0; j < plugins->size(); ++j) { - FilePath::StringType plugin1 = + base::FilePath::StringType plugin1 = StringToLowerASCII((*plugins)[j].path.BaseName().value()); - FilePath::StringType plugin2 = + base::FilePath::StringType plugin2 = StringToLowerASCII(info.path.BaseName().value()); if ((plugin1 == plugin2 && HaveSharedMimeType((*plugins)[j], info)) || (plugin1 == kJavaDeploy1 && plugin2 == kJavaDeploy2) || @@ -361,7 +361,7 @@ bool PluginList::ShouldLoadPluginUsingPluginList( } // Troublemakers. - FilePath::StringType filename = + base::FilePath::StringType filename = StringToLowerASCII(info.path.BaseName().value()); // Depends on XPCOM. if (filename == kMozillaActiveXPlugin) @@ -383,7 +383,7 @@ bool PluginList::ShouldLoadPluginUsingPluginList( // We only work with newer versions of the Java plugin which use NPAPI only // and don't depend on XPCOM. if (filename == kJavaPlugin1 || filename == kJavaPlugin2) { - std::vector<FilePath::StringType> ver; + std::vector<base::FilePath::StringType> ver; base::SplitString(info.version, '.', &ver); int major, minor, update; if (ver.size() == 4 && @@ -417,7 +417,7 @@ bool PluginList::ShouldLoadPluginUsingPluginList( #if !defined(ARCH_CPU_X86_64) // The plugin in question could be a 64 bit plugin which we cannot load. - FilePath plugin_path(info.path); + base::FilePath plugin_path(info.path); file_util::AbsolutePath(&plugin_path); if (!IsValid32BitImage(plugin_path)) return false; diff --git a/webkit/plugins/npapi/plugin_stream.cc b/webkit/plugins/npapi/plugin_stream.cc index 8946030..543ab3e 100644 --- a/webkit/plugins/npapi/plugin_stream.cc +++ b/webkit/plugins/npapi/plugin_stream.cc @@ -84,9 +84,9 @@ bool PluginStream::Open(const std::string& mime_type, GURL gurl(stream_.url); #if defined(OS_WIN) - FilePath path(UTF8ToWide(gurl.path())); + base::FilePath path(UTF8ToWide(gurl.path())); #elif defined(OS_POSIX) - FilePath path(gurl.path()); + base::FilePath path(gurl.path()); #endif if (net::GetMimeTypeFromFile(path, &temp_mime_type)) char_mime_type = temp_mime_type.c_str(); diff --git a/webkit/plugins/npapi/plugin_stream.h b/webkit/plugins/npapi/plugin_stream.h index 2bc691a..10993f0 100644 --- a/webkit/plugins/npapi/plugin_stream.h +++ b/webkit/plugins/npapi/plugin_stream.h @@ -146,7 +146,7 @@ class PluginStream : public base::RefCounted<PluginStream> { HANDLE temp_file_handle_; #elif defined(OS_POSIX) FILE* temp_file_; - FilePath temp_file_path_; + base::FilePath temp_file_path_; #endif std::vector<char> delivery_data_; int data_offset_; diff --git a/webkit/plugins/npapi/plugin_stream_posix.cc b/webkit/plugins/npapi/plugin_stream_posix.cc index 3422d99..ab4b0d4 100644 --- a/webkit/plugins/npapi/plugin_stream_posix.cc +++ b/webkit/plugins/npapi/plugin_stream_posix.cc @@ -19,7 +19,7 @@ void PluginStream::ResetTempFileHandle() { } void PluginStream::ResetTempFileName() { - temp_file_path_ = FilePath(); + temp_file_path_ = base::FilePath(); } void PluginStream::WriteAsFile() { diff --git a/webkit/plugins/npapi/test/plugin_geturl_test.cc b/webkit/plugins/npapi/test/plugin_geturl_test.cc index f03c5c31..b1ab554 100644 --- a/webkit/plugins/npapi/test/plugin_geturl_test.cc +++ b/webkit/plugins/npapi/test/plugin_geturl_test.cc @@ -187,10 +187,10 @@ NPError PluginGetURLTest::NewStream(NPMIMEType type, NPStream* stream, #if defined(OS_WIN) filename = filename.substr(8); // remove "file:///" // Assume an ASCII path on Windows. - FilePath path = FilePath(ASCIIToWide(filename)); + base::FilePath path = base::FilePath(ASCIIToWide(filename)); #else filename = filename.substr(7); // remove "file://" - FilePath path = FilePath(filename); + base::FilePath path = base::FilePath(filename); #endif test_file_ = file_util::OpenFile(path, "r"); diff --git a/webkit/plugins/npapi/webplugin_delegate_impl.cc b/webkit/plugins/npapi/webplugin_delegate_impl.cc index e3f5785..3ff6116 100644 --- a/webkit/plugins/npapi/webplugin_delegate_impl.cc +++ b/webkit/plugins/npapi/webplugin_delegate_impl.cc @@ -24,7 +24,7 @@ namespace webkit { namespace npapi { WebPluginDelegateImpl* WebPluginDelegateImpl::Create( - const FilePath& filename, + const base::FilePath& filename, const std::string& mime_type) { scoped_refptr<PluginLib> plugin_lib(PluginLib::CreatePluginLib(filename)); if (plugin_lib.get() == NULL) @@ -239,7 +239,7 @@ void WebPluginDelegateImpl::DidManualLoadFail() { instance()->DidManualLoadFail(); } -FilePath WebPluginDelegateImpl::GetPluginPath() { +base::FilePath WebPluginDelegateImpl::GetPluginPath() { return instance()->plugin_lib()->plugin_info().path; } diff --git a/webkit/plugins/npapi/webplugin_delegate_impl.h b/webkit/plugins/npapi/webplugin_delegate_impl.h index 38f18cd..d0a624b 100644 --- a/webkit/plugins/npapi/webplugin_delegate_impl.h +++ b/webkit/plugins/npapi/webplugin_delegate_impl.h @@ -27,7 +27,9 @@ typedef struct _GdkDrawable GdkPixmap; #endif +namespace base { class FilePath; +} #if defined(OS_MACOSX) #ifdef __OBJC__ @@ -77,7 +79,7 @@ class WEBKIT_PLUGINS_EXPORT WebPluginDelegateImpl : public WebPluginDelegate { PLUGIN_QUIRK_EMULATE_IME = 131072, // Windows. }; - static WebPluginDelegateImpl* Create(const FilePath& filename, + static WebPluginDelegateImpl* Create(const base::FilePath& filename, const std::string& mime_type); #if defined(OS_WIN) @@ -138,7 +140,7 @@ class WEBKIT_PLUGINS_EXPORT WebPluginDelegateImpl : public WebPluginDelegate { gfx::Rect GetClipRect() const { return clip_rect_; } // Returns the path for the library implementing this plugin. - FilePath GetPluginPath(); + base::FilePath GetPluginPath(); // Returns a combination of PluginQuirks. int GetQuirks() const { return quirks_; } diff --git a/webkit/plugins/npapi/webplugin_impl.cc b/webkit/plugins/npapi/webplugin_impl.cc index 64a36e2..357bb01 100644 --- a/webkit/plugins/npapi/webplugin_impl.cc +++ b/webkit/plugins/npapi/webplugin_impl.cc @@ -464,7 +464,7 @@ bool WebPluginImpl::isPlaceholder() { WebPluginImpl::WebPluginImpl( WebFrame* webframe, const WebPluginParams& params, - const FilePath& file_path, + const base::FilePath& file_path, const base::WeakPtr<WebPluginPageDelegate>& page_delegate) : windowless_(false), window_(gfx::kNullPluginWindow), diff --git a/webkit/plugins/npapi/webplugin_impl.h b/webkit/plugins/npapi/webplugin_impl.h index 844ddd4..90ac280 100644 --- a/webkit/plugins/npapi/webplugin_impl.h +++ b/webkit/plugins/npapi/webplugin_impl.h @@ -58,7 +58,7 @@ class WEBKIT_PLUGINS_EXPORT WebPluginImpl : WebPluginImpl( WebKit::WebFrame* frame, const WebKit::WebPluginParams& params, - const FilePath& file_path, + const base::FilePath& file_path, const base::WeakPtr<WebPluginPageDelegate>& page_delegate); virtual ~WebPluginImpl(); @@ -315,7 +315,7 @@ class WEBKIT_PLUGINS_EXPORT WebPluginImpl : WebPluginGeometry geometry_; // The location of the plugin on disk. - FilePath file_path_; + base::FilePath file_path_; // The mime type of the plugin. std::string mime_type_; diff --git a/webkit/plugins/npapi/webplugin_page_delegate.h b/webkit/plugins/npapi/webplugin_page_delegate.h index ec4b34a..e632014 100644 --- a/webkit/plugins/npapi/webplugin_page_delegate.h +++ b/webkit/plugins/npapi/webplugin_page_delegate.h @@ -9,7 +9,9 @@ #include "ui/gfx/native_widget_types.h" +namespace base { class FilePath; +} namespace WebKit { class WebCookieJar; @@ -29,12 +31,12 @@ class WebPluginPageDelegate { // new plugin is instanced. See CreateWebPluginDelegateHelper // for a default WebPluginDelegate implementation. virtual WebPluginDelegate* CreatePluginDelegate( - const FilePath& file_path, + const base::FilePath& file_path, const std::string& mime_type) = 0; // Caled to create a replacement plug-in when loading a plug-in failed. virtual WebKit::WebPlugin* CreatePluginReplacement( - const FilePath& file_path) = 0; + const base::FilePath& file_path) = 0; // Called when a windowed plugin is created. // Lets the view delegate create anything it is using to wrap the plugin. |