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

Unified Diff: chrome/common/chrome_content_client.cc

Issue 10281007: Fix the issue that Pepper Flash cannot load on Linux. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: i. Created 8 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 | « chrome/common/chrome_content_client.h ('k') | chrome/common/pepper_flash.h » ('j') | 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 4de13d85c6fb18d544afdac9b0363de7d28d6b12..d979a6e9cfb400bd8cb7b12b76bb6bda66d824dd 100644
--- a/chrome/common/chrome_content_client.cc
+++ b/chrome/common/chrome_content_client.cc
@@ -252,6 +252,38 @@ void AddPepperFlashFromCommandLine(
CreatePepperFlashInfo(FilePath(flash_path), flash_version));
}
+bool GetBundledPepperFlash(content::PepperPluginInfo* plugin,
+ bool* override_npapi_flash) {
+#if defined(FLAPPER_AVAILABLE)
+ // Ignore bundled Pepper Flash if there is Pepper Flash specified from the
+ // command-line.
+ if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kPpapiFlashPath))
+ return false;
+
+ bool force_disable = CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableBundledPpapiFlash);
+ if (force_disable)
+ return false;
+
+ FilePath flash_path;
+ if (!PathService::Get(chrome::FILE_PEPPER_FLASH_PLUGIN, &flash_path))
+ return false;
+ // It is an error to have FLAPPER_AVAILABLE defined but then not having the
+ // plugin file in place, but this happens in Chrome OS builds.
+ // Use --disable-bundled-ppapi-flash to skip this.
+ DCHECK(file_util::PathExists(flash_path));
+
+ bool force_enable = CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableBundledPpapiFlash);
+
+ *plugin = CreatePepperFlashInfo(flash_path, FLAPPER_VERSION_STRING);
+ *override_npapi_flash = force_enable || IsPepperFlashEnabledByDefault();
+ return true;
+#else
+ return false;
+#endif // FLAPPER_AVAILABLE
+}
+
#if defined(OS_WIN)
// Launches the privileged flash broker, used when flash is sandboxed.
// The broker is the same flash dll, except that it uses a different
@@ -327,6 +359,15 @@ void ChromeContentClient::AddPepperPlugins(
std::vector<content::PepperPluginInfo>* plugins) {
ComputeBuiltInPlugins(plugins);
AddPepperFlashFromCommandLine(plugins);
+
+ // Don't try to register Pepper Flash if there exists a Pepper Flash field
+ // trial. It will be registered separately.
+ if (!ConductingPepperFlashFieldTrial() && IsPepperFlashEnabledByDefault()) {
+ content::PepperPluginInfo plugin;
+ bool add_at_beginning = false;
+ if (GetBundledPepperFlash(&plugin, &add_at_beginning))
+ plugins->push_back(plugin);
+ }
}
void ChromeContentClient::AddNPAPIPlugins(
@@ -456,37 +497,12 @@ bool ChromeContentClient::GetSandboxProfileForSandboxType(
}
#endif
-bool ChromeContentClient::GetBundledPepperFlash(
+bool ChromeContentClient::GetBundledFieldTrialPepperFlash(
content::PepperPluginInfo* plugin,
bool* override_npapi_flash) {
-#if defined(FLAPPER_AVAILABLE)
- // Ignore bundled Pepper Flash if there is Pepper Flash specified from the
- // command-line.
- if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kPpapiFlashPath))
- return false;
-
- bool force_disable = CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kDisableBundledPpapiFlash);
- if (force_disable)
- return false;
-
- FilePath flash_path;
- if (!PathService::Get(chrome::FILE_PEPPER_FLASH_PLUGIN, &flash_path))
+ if (!ConductingPepperFlashFieldTrial())
return false;
- // It is an error to have FLAPPER_AVAILABLE defined but then not having the
- // plugin file in place, but this happens in Chrome OS builds.
- // Use --disable-bundled-ppapi-flash to skip this.
- DCHECK(file_util::PathExists(flash_path));
-
- bool force_enable = CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableBundledPpapiFlash);
-
- *plugin = CreatePepperFlashInfo(flash_path, FLAPPER_VERSION_STRING);
- *override_npapi_flash = force_enable || IsPepperFlashEnabledByDefault();
- return true;
-#else
- return false;
-#endif // FLAPPER_AVAILABLE
+ return GetBundledPepperFlash(plugin, override_npapi_flash);
}
} // namespace chrome
« no previous file with comments | « chrome/common/chrome_content_client.h ('k') | chrome/common/pepper_flash.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698