Chromium Code Reviews| Index: content/browser/plugin_service_impl.cc |
| diff --git a/content/browser/plugin_service_impl.cc b/content/browser/plugin_service_impl.cc |
| index 49b66389dd3703de6c9f4cd91d8e228cdc7d7db9..610ee3a7923cb5bef71c9d311a3881db61b1c8bc 100644 |
| --- a/content/browser/plugin_service_impl.cc |
| +++ b/content/browser/plugin_service_impl.cc |
| @@ -59,6 +59,16 @@ enum FlashUsage { |
| FLASH_USAGE_ENUM_COUNT |
| }; |
| +enum NPAPIPluginStatus { |
| + // Platform does not support NPAPI. |
| + NPAPI_STATUS_UNSUPPORTED, |
| + // Platform supports NPAPI and NPAPI is disabled. |
| + NPAPI_STATUS_DISABLED, |
| + // Platform supports NPAPI and NPAPI is enabled. |
| + NPAPI_STATUS_ENABLED, |
| + NPAPI_STATUS_ENUM_COUNT |
| +}; |
| + |
| bool LoadPluginListInProcess() { |
| #if defined(OS_WIN) |
| return true; |
| @@ -143,7 +153,7 @@ PluginServiceImpl* PluginServiceImpl::GetInstance() { |
| } |
| PluginServiceImpl::PluginServiceImpl() |
| - : filter_(NULL) { |
| + : npapi_plugins_enabled_(false), filter_(NULL) { |
| // Collect the total number of browser processes (which create |
| // PluginServiceImpl objects, to be precise). The number is used to normalize |
| // the number of processes which start at least one NPAPI/PPAPI Flash process. |
| @@ -180,6 +190,16 @@ 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); |
| + UMA_HISTOGRAM_ENUMERATION( |
| + "Plugin.NPAPIStatus", |
| + npapi_plugins_enabled_ ? NPAPI_STATUS_ENABLED : NPAPI_STATUS_DISABLED, |
| + NPAPI_STATUS_ENUM_COUNT); |
| +#else |
| + UMA_HISTOGRAM_ENUMERATION("Plugin.NPAPIStatus", NPAPI_STATUS_UNSUPPORTED, |
| + NPAPI_STATUS_ENUM_COUNT); |
|
Ilya Sherman
2015/01/20 20:45:18
nit: To reduce the risk of typos creeping in to on
Will Harris
2015/01/20 22:35:11
Done.
|
| +#endif |
| } |
| void PluginServiceImpl::StartWatchingPlugins() { |
| @@ -778,17 +798,17 @@ void PluginServiceImpl::GetInternalPlugins( |
| } |
| bool PluginServiceImpl::NPAPIPluginsSupported() { |
| -#if defined(OS_WIN) || defined(OS_MACOSX) |
| - return true; |
| -#else |
| - return false; |
| -#endif |
| + return npapi_plugins_enabled_; |
| } |
| void PluginServiceImpl::DisablePluginsDiscoveryForTesting() { |
| PluginList::Singleton()->DisablePluginsDiscovery(); |
| } |
| +void PluginServiceImpl::EnableNpapiPluginsForTesting() { |
| + npapi_plugins_enabled_ = true; |
| +} |
| + |
| #if defined(OS_MACOSX) |
| void PluginServiceImpl::AppActivated() { |
| BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |