diff options
author | cpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-14 00:54:51 +0000 |
---|---|---|
committer | cpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-14 00:54:51 +0000 |
commit | 1fbfdc0a08590ccffef2baef9f36b71e70d08b7d (patch) | |
tree | 5a21cfe2dc3a6dc8677ccb174fc60b1337b6d2b8 /chrome/common/chrome_paths.cc | |
parent | 69eb0b25f75ef9bc07618a12a832c2130e716371 (diff) | |
download | chromium_src-1fbfdc0a08590ccffef2baef9f36b71e70d08b7d.zip chromium_src-1fbfdc0a08590ccffef2baef9f36b71e70d08b7d.tar.gz chromium_src-1fbfdc0a08590ccffef2baef9f36b71e70d08b7d.tar.bz2 |
Add the path fetching for flapper
BUG=89248
TEST=see bug
Review URL: http://codereview.chromium.org/7346029
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92458 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/chrome_paths.cc')
-rw-r--r-- | chrome/common/chrome_paths.cc | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/chrome/common/chrome_paths.cc b/chrome/common/chrome_paths.cc index 5eb3c2ba..478eda7 100644 --- a/chrome/common/chrome_paths.cc +++ b/chrome/common/chrome_paths.cc @@ -10,6 +10,7 @@ #include "base/path_service.h" #include "base/string_util.h" #include "base/sys_info.h" +#include "base/version.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_paths_internal.h" #include "chrome/common/chrome_switches.h" @@ -30,6 +31,20 @@ const FilePath::CharType kInternalFlashPluginFileName[] = FILE_PATH_LITERAL("libgcflashplayer.so"); #endif +// File name of the pepper Flash plugin on different platforms. +const FilePath::CharType kPepperFlashPluginFileName[] = +#if defined(OS_MACOSX) + FILE_PATH_LITERAL("PepperFlashPlayer.plugin"); +#elif defined(OS_WIN) + FILE_PATH_LITERAL("pepflashplayer.dll"); +#else // OS_LINUX, etc. + FILE_PATH_LITERAL("libpepflashplayer.so"); +#endif + +// The pepper flash plugins are in a directory with this name. +const FilePath::CharType kPepperFlashBaseDirectory[] = + FILE_PATH_LITERAL("PepperFlash"); + // File name of the internal PDF plugin on different platforms. const FilePath::CharType kInternalPDFPluginFileName[] = #if defined(OS_WIN) @@ -73,6 +88,30 @@ bool GetInternalPluginsDirectory(FilePath* result) { return PathService::Get(base::DIR_MODULE, result); } +// Pepper flash plugins have the version encoded in the path itself +// so we need to enumerate the directories to find the full path +bool GetPepperFlashDirectory(FilePath* result) { + if (!GetInternalPluginsDirectory(result)) + return false; + result->Append(kPepperFlashBaseDirectory); + Version latest("0.0"); + bool found = false; + file_util::FileEnumerator + file_enumerator(*result, false, file_util::FileEnumerator::DIRECTORIES); + for (FilePath path = file_enumerator.Next(); !path.value().empty(); + path = file_enumerator.Next()) { + Version version(path.BaseName().MaybeAsASCII()); + if (!version.IsValid()) + continue; + if (version.CompareTo(latest) > 0) { + latest = version; + *result = path; + found = true; + } + } + return found; +} + bool PathProvider(int key, FilePath* result) { // Some keys are just aliases... switch (key) { @@ -220,6 +259,13 @@ bool PathProvider(int key, FilePath* result) { if (!file_util::PathExists(cur)) return false; break; + case chrome::FILE_PEPPER_FLASH_PLUGIN: + if (!GetPepperFlashDirectory(&cur)) + return false; + cur = cur.Append(kPepperFlashPluginFileName); + if (!file_util::PathExists(cur)) + return false; + break; case chrome::FILE_PDF_PLUGIN: if (!GetInternalPluginsDirectory(&cur)) return false; |