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

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: rebase 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
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..c48f6469b6a9a4307345121d03513fd33c36a043 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,37 @@ void RegisterPepperFlashWithChrome(const base::FilePath& path,
if (!MakePepperFlashPluginInfo(path, version, true, &plugin_info))
return;
+ bool is_on_network = base::IsOnNetworkDrive(path);
+
+ base::FilePath bundled_flash_path;
+ PathService::Get(chrome::DIR_PEPPER_FLASH_PLUGIN, &bundled_flash_path);
Lei Zhang 2016/04/15 21:16:36 This can potentially fail. Do you care to check or
Will Harris 2016/04/15 21:43:28 checking below, although FilePath::IsParent always
+
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 (auto plugin : plugins) {
Lei Zhang 2016/04/15 21:16:36 const auto & ?
Will Harris 2016/04/15 21:43:28 Done.
+ 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.IsParent(plugin.path);
+ 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;
}

Powered by Google App Engine
This is Rietveld 408576698