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

Unified Diff: content/browser/plugin_service_impl.cc

Issue 930243008: Enable NPAPI plugins if any plugin policies are set. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DownloadContentTest.DownloadOctetStream should use a fake PEPPER plugin. This test was never doing anything previously. Created 5 years, 10 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: content/browser/plugin_service_impl.cc
diff --git a/content/browser/plugin_service_impl.cc b/content/browser/plugin_service_impl.cc
index 42ac63be05ae224bfce0351bfc77bbe9bc26ddc0..6b517f1c20672126de0d6e320f884873a4cda7ae 100644
--- a/content/browser/plugin_service_impl.cc
+++ b/content/browser/plugin_service_impl.cc
@@ -190,15 +190,6 @@ void PluginServiceImpl::Init() {
if (command_line->HasSwitch(switches::kDisablePluginsDiscovery))
PluginList::Singleton()->DisablePluginsDiscovery();
-#if defined(OS_WIN) || defined(OS_MACOSX)
- npapi_plugins_enabled_ = command_line->HasSwitch(switches::kEnableNpapi);
- NPAPIPluginStatus status =
- npapi_plugins_enabled_ ? NPAPI_STATUS_ENABLED : NPAPI_STATUS_DISABLED;
-#else
- NPAPIPluginStatus status = NPAPI_STATUS_UNSUPPORTED;
-#endif
- UMA_HISTOGRAM_ENUMERATION("Plugin.NPAPIStatus", status,
- NPAPI_STATUS_ENUM_COUNT);
}
void PluginServiceImpl::StartWatchingPlugins() {
@@ -779,8 +770,9 @@ void PluginServiceImpl::AddExtraPluginDir(const base::FilePath& path) {
void PluginServiceImpl::RegisterInternalPlugin(
const WebPluginInfo& info,
bool add_at_beginning) {
- if (!NPAPIPluginsSupported() &&
- info.type == WebPluginInfo::PLUGIN_TYPE_NPAPI) {
+ // Internal plugins should never be NPAPI.
+ DCHECK_NE(info.type, WebPluginInfo::PLUGIN_TYPE_NPAPI);
jam 2015/02/19 23:46:48 nit: i'd make that a CHECK_NE
Will Harris 2015/02/20 03:55:50 Done.
+ if (info.type == WebPluginInfo::PLUGIN_TYPE_NPAPI) {
DVLOG(0) << "Don't register NPAPI plugins when they're not supported";
return;
}
@@ -797,6 +789,22 @@ void PluginServiceImpl::GetInternalPlugins(
}
bool PluginServiceImpl::NPAPIPluginsSupported() {
+ static bool command_line_checked = false;
+
+ if (!command_line_checked) {
+#if defined(OS_WIN) || defined(OS_MACOSX)
+ const base::CommandLine* command_line =
+ base::CommandLine::ForCurrentProcess();
+ npapi_plugins_enabled_ = command_line->HasSwitch(switches::kEnableNpapi);
+ NPAPIPluginStatus status =
+ npapi_plugins_enabled_ ? NPAPI_STATUS_ENABLED : NPAPI_STATUS_DISABLED;
+#else
+ NPAPIPluginStatus status = NPAPI_STATUS_UNSUPPORTED;
+#endif
+ UMA_HISTOGRAM_ENUMERATION("Plugin.NPAPIStatus", status,
+ NPAPI_STATUS_ENUM_COUNT);
+ }
+
return npapi_plugins_enabled_;
}

Powered by Google App Engine
This is Rietveld 408576698