summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Mineer <amineer@google.com>2015-08-27 12:45:36 -0700
committerAlex Mineer <amineer@google.com>2015-08-27 19:46:33 +0000
commitb430b35ded0529a88b31b7099ef00c9ea0bbfc49 (patch)
tree939131add7459b58d2df999fb42622d940bda6ac
parentf35ee3c741eb8a18b24c8406e4fe213bfd1a6eb8 (diff)
downloadchromium_src-b430b35ded0529a88b31b7099ef00c9ea0bbfc49.zip
chromium_src-b430b35ded0529a88b31b7099ef00c9ea0bbfc49.tar.gz
chromium_src-b430b35ded0529a88b31b7099ef00c9ea0bbfc49.tar.bz2
Correctly migrate different architectures of installed NPAPI Flash.
BUG=510114 TEST=Manual, see bug. Review URL: https://codereview.chromium.org/1308313009 (cherry picked from commit 6a4ece1ac9ad20d02ebdd2da713a98e4b3b0df29) Cr-Original-Commit-Position: refs/heads/master@{#345946} Cr-Commit-Position: refs/branch-heads/2454@{#438} Cr-Branched-From: 12bfc3360892ec53cd00fc239a47e5298beb063b-refs/heads/master@{#338390}
-rw-r--r--chrome/browser/plugins/plugin_prefs.cc23
1 files changed, 19 insertions, 4 deletions
diff --git a/chrome/browser/plugins/plugin_prefs.cc b/chrome/browser/plugins/plugin_prefs.cc
index 0b9c387..a754c32 100644
--- a/chrome/browser/plugins/plugin_prefs.cc
+++ b/chrome/browser/plugins/plugin_prefs.cc
@@ -57,6 +57,24 @@ bool IsComponentUpdatedPepperFlash(const base::FilePath& plugin) {
return false;
}
+// Returns true if |path| looks like the path to an NPAPI Flash plugin.
+bool IsNpapiFlashPath(const base::FilePath& path) {
+ base::FilePath npapi_flash;
+ // Check NPAPI Flash is installed.
+ if (!PathService::Get(chrome::FILE_FLASH_SYSTEM_PLUGIN, &npapi_flash))
+ return false;
+ // Check for same architecture NPAPI Flash.
+ if (base::FilePath::CompareEqualIgnoreCase(path.value(), npapi_flash.value()))
+ return true;
+#if defined(OS_WIN)
+ // Fuzzy check for NPAPI Flash on Windows.
+ base::FilePath::StringType kSwfPrefix = FILE_PATH_LITERAL("NPSWF");
+ if (path.BaseName().value().compare(0, kSwfPrefix.size(), kSwfPrefix) == 0)
+ return true;
+#endif
+ return false;
+}
+
} // namespace
PluginPrefs::PluginState::PluginState() {
@@ -345,12 +363,10 @@ void PluginPrefs::SetPrefs(PrefService* prefs) {
if (saved_plugins_list && !saved_plugins_list->empty()) {
// The following four variables are only valid when
// |migrate_to_pepper_flash| is set to true.
- base::FilePath npapi_flash;
base::FilePath pepper_flash;
base::DictionaryValue* pepper_flash_node = NULL;
bool npapi_flash_enabled = false;
if (migrate_to_pepper_flash) {
- PathService::Get(chrome::FILE_FLASH_SYSTEM_PLUGIN, &npapi_flash);
PathService::Get(chrome::FILE_PEPPER_FLASH_PLUGIN, &pepper_flash);
}
@@ -415,8 +431,7 @@ void PluginPrefs::SetPrefs(PrefService* prefs) {
}
}
- if (migrate_to_pepper_flash && base::FilePath::CompareEqualIgnoreCase(
- path, npapi_flash.value())) {
+ if (migrate_to_pepper_flash && IsNpapiFlashPath(plugin_path)) {
npapi_flash_enabled = enabled;
} else if (migrate_to_pepper_flash &&
base::FilePath::CompareEqualIgnoreCase(