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

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

Issue 1867833003: Prefer System Flash over non-local component updated Flash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: code review comments Created 4 years, 8 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/common/chrome_content_client.cc » ('j') | chrome/common/chrome_content_client.cc » ('J')
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 4072febc70a5fb991b643a73d89e9db3ea523998..f270a952033938e9f61c8b2b01628f23bf00c816 100644
--- a/chrome/browser/component_updater/pepper_flash_component_installer.cc
+++ b/chrome/browser/component_updater/pepper_flash_component_installer.cc
@@ -144,6 +144,7 @@ bool IsPepperFlash(const content::WebPluginInfo& plugin) {
// We try to recognize Pepper Flash by the following criteria:
// * It is a Pepper plugin.
// * It has the special Flash permissions.
+
return plugin.is_pepper_plugin() &&
(plugin.pepper_permissions & ppapi::PERMISSION_FLASH);
}
@@ -155,24 +156,38 @@ void RegisterPepperFlashWithChrome(const base::FilePath& path,
if (!MakePepperFlashPluginInfo(path, version, true, &plugin_info))
return;
+ bool is_on_network = base::IsOnNetworkDrive(path);
waffles 2016/04/20 20:49:03 nit: I would move this (and :171-172) down to just
Will Harris 2016/04/20 23:50:21 Done.
+
+ base::FilePath bundled_flash_path;
+ PathService::Get(chrome::DIR_PEPPER_FLASH_PLUGIN, &bundled_flash_path);
+
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))
+ for (const auto& plugin : plugins) {
+ if (!IsPepperFlash(plugin))
continue;
// Do it only if the version we're trying to register is newer.
- Version registered_version(base::UTF16ToUTF8(it->version));
+ bool registered_is_bundled =
+ !bundled_flash_path.empty() && bundled_flash_path.IsParent(plugin.path);
cpu_(ooo_6.6-7.5) 2016/04/20 19:23:14 171-172 could go after 179, also 170 is duplicated
Will Harris 2016/04/20 23:50:21 Done.
+ Version registered_version(base::UTF16ToUTF8(plugin.version));
+
+ // If lower version, never register.
+ if (registered_version.IsValid() &&
+ version.CompareTo(registered_version) < 0) {
+ return;
+ }
+
+ // If equal version, register iff component is not on a network drive,
+ // and the version of flash is not bundled.
if (registered_version.IsValid() &&
- version.CompareTo(registered_version) <= 0) {
+ version.CompareTo(registered_version) == 0 &&
+ (is_on_network || registered_is_bundled)) {
return;
}
// If the version is newer, remove the old one first.
- PluginService::GetInstance()->UnregisterInternalPlugin(it->path);
+ PluginService::GetInstance()->UnregisterInternalPlugin(plugin.path);
break;
}
« no previous file with comments | « no previous file | chrome/common/chrome_content_client.cc » ('j') | chrome/common/chrome_content_client.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698