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

Unified Diff: chrome/common/chrome_content_client.cc

Issue 2370683003: Don't add fake flash when command-line flash exists. (Closed)
Patch Set: Ready for review Created 4 years, 3 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/chrome_content_client.cc
diff --git a/chrome/common/chrome_content_client.cc b/chrome/common/chrome_content_client.cc
index 75bd28d982d414eb9cedce97e57716b0248efff7..dc921e89bbea303943ac30f44909792e93f6f4fd 100644
--- a/chrome/common/chrome_content_client.cc
+++ b/chrome/common/chrome_content_client.cc
@@ -279,13 +279,12 @@ content::PepperPluginInfo CreatePepperFlashInfo(const base::FilePath& path,
return plugin;
}
-void AddPepperFlashFromCommandLine(
- std::vector<content::PepperPluginInfo>* plugins) {
+bool GetCommandLinePepperFlash(content::PepperPluginInfo* plugin) {
const base::CommandLine::StringType flash_path =
base::CommandLine::ForCurrentProcess()->GetSwitchValueNative(
switches::kPpapiFlashPath);
if (flash_path.empty())
- return;
+ return false;
// Also get the version from the command-line. Should be something like 11.2
// or 11.2.123.45.
@@ -293,9 +292,9 @@ void AddPepperFlashFromCommandLine(
base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
switches::kPpapiFlashVersion);
- plugins->push_back(
- CreatePepperFlashInfo(base::FilePath(flash_path),
- flash_version, false, true, false));
+ *plugin = CreatePepperFlashInfo(base::FilePath(flash_path),
+ flash_version, false, true, false);
+ return true;
}
#if defined(OS_LINUX)
@@ -486,19 +485,25 @@ void ChromeContentClient::AddPepperPlugins(
std::vector<content::PepperPluginInfo>* plugins) {
#if defined(ENABLE_PLUGINS)
ComputeBuiltInPlugins(plugins);
- AddPepperFlashFromCommandLine(plugins);
+ ScopedVector<content::PepperPluginInfo> flash_versions;
+
+ std::unique_ptr<content::PepperPluginInfo> command_line_flash(
+ new content::PepperPluginInfo);
+ bool has_cli_flash = GetCommandLinePepperFlash(command_line_flash.get());
#if defined(OS_LINUX)
- // Depending on the sandbox configurtion, the user data directory
+ // Depending on the sandbox configuration, the user data directory
// is not always available. If it is not available, do not try and load any
// flash plugin. The flash player, if any, preloaded before the sandbox
// initialization will continue to be used.
if (!IsUserDataDirAvailable()) {
+ if (has_cli_flash)
Greg K 2016/09/26 22:54:14 I'm confused by this: why do we want to push back
waffles 2016/09/26 23:02:32 I don't know what the purpose of this is, I just d
+ plugins->push_back(*command_line_flash);
return;
}
#endif // defined(OS_LINUX)
-
- ScopedVector<content::PepperPluginInfo> flash_versions;
+ if (has_cli_flash)
+ flash_versions.push_back(command_line_flash.release());
#if defined(OS_LINUX)
std::unique_ptr<content::PepperPluginInfo> component_flash(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698