Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Unified Diff: chrome/browser/component_updater/pepper_flash_component_installer.cc

Issue 893823002: Register system Pepper Flash plugin if no packaged Pepper plugin is found. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: better mac support Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/webui/plugins_ui.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/component_updater/pepper_flash_component_installer.cc
diff --git a/chrome/browser/component_updater/pepper_flash_component_installer.cc b/chrome/browser/component_updater/pepper_flash_component_installer.cc
index fc9b092c2acc2f86a320713f0d1db4b8c40d98b9..74f51b0d088e85b8257ac912157e7e3c96852582 100644
--- a/chrome/browser/component_updater/pepper_flash_component_installer.cc
+++ b/chrome/browser/component_updater/pepper_flash_component_installer.cc
@@ -90,15 +90,6 @@ base::FilePath GetPepperFlashBaseDirectory() {
}
#if defined(GOOGLE_CHROME_BUILD) && !defined(OS_LINUX)
-// Install directory for pepper flash debugger dlls will be like
-// c:\windows\system32\macromed\flash\, or basically the Macromed\Flash
-// subdirectory of the Windows system directory.
-base::FilePath GetPepperFlashDebuggerDirectory() {
- base::FilePath result;
- PathService::Get(chrome::DIR_PEPPER_FLASH_DEBUGGER_PLUGIN, &result);
- return result;
-}
-
// Pepper Flash plugins have the version encoded in the path itself
// so we need to enumerate the directories to find the full path.
// On success, |latest_dir| returns something like:
@@ -134,67 +125,6 @@ bool GetPepperFlashDirectory(base::FilePath* latest_dir,
}
return found;
}
-
-#if defined(OS_WIN)
-const wchar_t kPepperFlashDebuggerDLLSearchString[] =
-#if defined(ARCH_CPU_X86)
- L"pepflashplayer32*.dll";
-#elif defined(ARCH_CPU_X86_64)
- L"pepflashplayer64*.dll";
-#else
-#error Unsupported Windows CPU architecture.
-#endif // defined(ARCH_CPU_X86)
-#endif // defined(OS_WIN)
-
-bool GetPepperFlashDebuggerPath(base::FilePath* dll_path,
- Version* dll_version) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
- base::FilePath debugger_dir = GetPepperFlashDebuggerDirectory();
- // If path doesn't exist they simply don't have the flash debugger installed.
- if (!base::PathExists(debugger_dir))
- return false;
-
- bool found = false;
-#if defined(OS_WIN)
- // Enumerate any DLLs that match the appropriate pattern for this DLL, and
- // pick the highest version number we find.
- base::FileEnumerator file_enumerator(debugger_dir,
- false,
- base::FileEnumerator::FILES,
- kPepperFlashDebuggerDLLSearchString);
- for (base::FilePath path = file_enumerator.Next(); !path.value().empty();
- path = file_enumerator.Next()) {
- // Version number is embedded in file name like basename_x_y_z.dll. Extract.
- std::string file_name(path.BaseName().RemoveExtension().MaybeAsASCII());
- // file_name should now be basename_x_y_z. Split along '_' for version.
- std::vector<std::string> components;
- base::SplitString(file_name, '_', &components);
- // Should have at least one version number.
- if (components.size() <= 1)
- continue;
- // Meld version components back into a string, now separated by periods, so
- // Version can parse it.
- std::string version_string(components[1]);
- for (size_t i = 2; i < components.size(); ++i) {
- version_string += "." + components[i];
- }
- Version version(version_string);
- if (!version.IsValid())
- continue;
- if (found) {
- if (version.CompareTo(*dll_version) > 0) {
- *dll_path = path;
- *dll_version = version;
- }
- } else {
- *dll_path = path;
- *dll_version = version;
- found = true;
- }
- }
-#endif
- return found;
-}
#endif // defined(GOOGLE_CHROME_BUILD) && !defined(OS_LINUX)
// Returns true if the Pepper |interface_name| is implemented by this browser.
@@ -212,7 +142,6 @@ bool SupportsPepperInterface(const char* interface_name) {
bool MakePepperFlashPluginInfo(const base::FilePath& flash_path,
const Version& flash_version,
bool out_of_process,
- bool is_debugger,
content::PepperPluginInfo* plugin_info) {
if (!flash_version.IsValid())
return false;
@@ -255,45 +184,35 @@ bool IsPepperFlash(const content::WebPluginInfo& plugin) {
}
void RegisterPepperFlashWithChrome(const base::FilePath& path,
- const Version& version,
- bool is_debugger) {
+ const Version& version) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
content::PepperPluginInfo plugin_info;
- if (!MakePepperFlashPluginInfo(
- path, version, true, is_debugger, &plugin_info))
+ if (!MakePepperFlashPluginInfo(path, version, true, &plugin_info))
return;
- // If this is the non-debugger version, we enumerate any installed versions of
- // pepper flash to make sure we only replace the installed version with a
- // newer version.
- if (!is_debugger) {
- std::vector<content::WebPluginInfo> plugins;
- PluginService::GetInstance()->GetInternalPlugins(&plugins);
- for (std::vector<content::WebPluginInfo>::const_iterator it =
- plugins.begin();
- it != plugins.end();
- ++it) {
- if (!IsPepperFlash(*it))
- continue;
-
- // Do it only if the version we're trying to register is newer.
- Version registered_version(base::UTF16ToUTF8(it->version));
- if (registered_version.IsValid() &&
- version.CompareTo(registered_version) <= 0) {
- return;
- }
+ std::vector<content::WebPluginInfo> plugins;
+ PluginService::GetInstance()->GetInternalPlugins(&plugins);
+ for (std::vector<content::WebPluginInfo>::const_iterator it =
+ plugins.begin();
+ it != plugins.end();
+ ++it) {
+ if (!IsPepperFlash(*it))
+ continue;
- // If the version is newer, remove the old one first.
- PluginService::GetInstance()->UnregisterInternalPlugin(it->path);
- break;
+ // Do it only if the version we're trying to register is newer.
+ Version registered_version(base::UTF16ToUTF8(it->version));
+ if (registered_version.IsValid() &&
+ version.CompareTo(registered_version) <= 0) {
+ return;
}
+
+ // If the version is newer, remove the old one first.
+ PluginService::GetInstance()->UnregisterInternalPlugin(it->path);
+ break;
}
- // We only ask for registration at the beginning for the non-debugger plugin,
- // that way the debugger plugin doesn't automatically clobber the built-in or
- // updated non-debugger version.
PluginService::GetInstance()->RegisterInternalPlugin(
- plugin_info.ToWebPluginInfo(), !is_debugger);
+ plugin_info.ToWebPluginInfo(), true);
PluginService::GetInstance()->RefreshPlugins();
}
@@ -384,7 +303,7 @@ bool PepperFlashComponentInstaller::Install(
BrowserThread::PostTask(
BrowserThread::UI,
FROM_HERE,
- base::Bind(&RegisterPepperFlashWithChrome, path, version, false));
+ base::Bind(&RegisterPepperFlashWithChrome, path, version));
return true;
}
@@ -467,7 +386,7 @@ void StartPepperFlashUpdateRegistration(ComponentUpdateService* cus) {
BrowserThread::PostTask(
BrowserThread::UI,
FROM_HERE,
- base::Bind(&RegisterPepperFlashWithChrome, path, version, false));
+ base::Bind(&RegisterPepperFlashWithChrome, path, version));
} else {
version = Version(kNullVersion);
}
@@ -484,18 +403,6 @@ void StartPepperFlashUpdateRegistration(ComponentUpdateService* cus) {
++iter) {
base::DeleteFile(*iter, true);
}
-
- // Check for Debugging version of Flash and register if present.
- base::FilePath debugger_path;
- Version debugger_version(kNullVersion);
- if (GetPepperFlashDebuggerPath(&debugger_path, &debugger_version)) {
- BrowserThread::PostTask(BrowserThread::UI,
- FROM_HERE,
- base::Bind(&RegisterPepperFlashWithChrome,
- debugger_path,
- debugger_version,
- true));
- }
}
#endif // defined(GOOGLE_CHROME_BUILD) && !defined(OS_LINUX)
« no previous file with comments | « no previous file | chrome/browser/ui/webui/plugins_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698