summaryrefslogtreecommitdiffstats
path: root/content/browser/plugin_service_impl.cc
diff options
context:
space:
mode:
authorwfh <wfh@chromium.org>2015-02-20 08:13:13 -0800
committerCommit bot <commit-bot@chromium.org>2015-02-20 16:13:49 +0000
commita79d102fed6a32ad05901ff9eb2fa8b9241639fd (patch)
treeacc5deea9de11abd32b58667c2a91e15e6c947df /content/browser/plugin_service_impl.cc
parentd2eea9397df6594f3e92aaa81328c8dd976adfea (diff)
downloadchromium_src-a79d102fed6a32ad05901ff9eb2fa8b9241639fd.zip
chromium_src-a79d102fed6a32ad05901ff9eb2fa8b9241639fd.tar.gz
chromium_src-a79d102fed6a32ad05901ff9eb2fa8b9241639fd.tar.bz2
Enable NPAPI plugins if any plugin policies are set.
Once NPAPI is pushed behind a flag in M42, enterprise polices that are set need to re-enable NPAPI plugins correctly. This CL covers all the policy cases and is intended to be a wide net to catch any/all policies. We don't particularly mind if this has a few false positives, because NPAPI will be totally gone soon. BUG=295137 TEST=Set e.g. EnabledPlugins policy. Check that NPAPI plugins are listed in chrome://plugins Review URL: https://codereview.chromium.org/930243008 Cr-Commit-Position: refs/heads/master@{#317329}
Diffstat (limited to 'content/browser/plugin_service_impl.cc')
-rw-r--r--content/browser/plugin_service_impl.cc30
1 files changed, 19 insertions, 11 deletions
diff --git a/content/browser/plugin_service_impl.cc b/content/browser/plugin_service_impl.cc
index 42ac63b..e431095 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.
+ CHECK_NE(info.type, WebPluginInfo::PLUGIN_TYPE_NPAPI);
+ 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_;
}