Chromium Code Reviews| Index: chrome/browser/plugins/plugin_info_message_filter.cc |
| diff --git a/chrome/browser/plugins/plugin_info_message_filter.cc b/chrome/browser/plugins/plugin_info_message_filter.cc |
| index 634e4bc6dfde697fc60249ae0e4e95af09e57b26..1a87ab0f0d1efa0a79639dcdb780f5285867bcbd 100644 |
| --- a/chrome/browser/plugins/plugin_info_message_filter.cc |
| +++ b/chrome/browser/plugins/plugin_info_message_filter.cc |
| @@ -170,6 +170,26 @@ void PluginInfoMessageFilter::PluginsLoaded( |
| } |
| #if defined(ENABLE_PEPPER_CDMS) |
| + |
| +enum PluginRegistrationStatusForUMA { |
| + PLUGIN_REGISTERED, |
| + PLUGIN_NOT_REGISTERED, |
| + PLUGIN_DISABLED, |
| + PLUGIN_REGISTRATION_STATUS_MAX |
| +}; |
| + |
| +static void SendPluginRegistrationUMA(const std::string& mime_type, |
|
Bernhard Bauer
2014/07/21 08:29:58
Nit: Move this into an anonymous namespace.
xhwang
2014/07/21 17:45:17
Done.
|
| + PluginRegistrationStatusForUMA status) { |
| +#if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) |
|
Bernhard Bauer
2014/07/21 08:29:58
The second #defined test is unnecessary if this is
xhwang
2014/07/21 17:45:17
Done.
|
| + // Only report results for Widevine CDM. |
| + if (mime_type != kWidevineCdmPluginMimeType) |
| + return; |
| + |
| + UMA_HISTOGRAM_ENUMERATION("Plugin.RegistrationStatus.WidevineCdm", |
| + status, PLUGIN_REGISTRATION_STATUS_MAX); |
| +#endif |
| +} |
| + |
| void PluginInfoMessageFilter::OnIsInternalPluginRegisteredForMimeType( |
|
Bernhard Bauer
2014/07/21 08:29:58
Do we want to rename this method now that it check
xhwang
2014/07/21 17:45:17
Renamed "Registered" to "Available". "Available" m
|
| const std::string& mime_type, |
| bool* is_registered, |
| @@ -177,22 +197,34 @@ void PluginInfoMessageFilter::OnIsInternalPluginRegisteredForMimeType( |
| std::vector<base::string16>* additional_param_values) { |
| std::vector<WebPluginInfo> plugins; |
| PluginService::GetInstance()->GetInternalPlugins(&plugins); |
| + |
| + bool is_plugin_disabled = false; |
| for (size_t i = 0; i < plugins.size(); ++i) { |
| + const WebPluginInfo& plugin = plugins[i]; |
| const std::vector<content::WebPluginMimeType>& mime_types = |
| - plugins[i].mime_types; |
| + plugin.mime_types; |
| for (size_t j = 0; j < mime_types.size(); ++j) { |
| if (mime_types[j].mime_type == mime_type) { |
| + if (!context_.IsPluginEnabled(plugin)) { |
| + is_plugin_disabled = true; |
| + break; |
| + } |
| + |
| *is_registered = true; |
| *additional_param_names = mime_types[j].additional_param_names; |
| *additional_param_values = mime_types[j].additional_param_values; |
| + SendPluginRegistrationUMA(mime_type, PLUGIN_REGISTERED); |
| return; |
| } |
| } |
| } |
| *is_registered = false; |
| + SendPluginRegistrationUMA( |
| + mime_type, is_plugin_disabled ? PLUGIN_DISABLED : PLUGIN_NOT_REGISTERED); |
| } |
| -#endif |
| + |
| +#endif // defined(ENABLE_PEPPER_CDMS) |
| void PluginInfoMessageFilter::Context::DecidePluginStatus( |
| const GetPluginInfo_Params& params, |
| @@ -403,3 +435,7 @@ void PluginInfoMessageFilter::Context::MaybeGrantAccess( |
| } |
| } |
| +bool PluginInfoMessageFilter::Context::IsPluginEnabled( |
| + const content::WebPluginInfo& plugin) const { |
| + return plugin_prefs_->IsPluginEnabled(plugin); |
| +} |