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..cad51f0d2bea0e3968adc1d4f026151f4fa7e356 100644 |
--- a/chrome/browser/plugins/plugin_info_message_filter.cc |
+++ b/chrome/browser/plugins/plugin_info_message_filter.cc |
@@ -170,6 +170,24 @@ 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, |
+ PluginRegistrationStatusForUMA status) { |
+ // Only report results for Widevine CDM. |
ddorwin
2014/07/18 23:50:18
#if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENA
xhwang
2014/07/19 00:07:14
Done.
|
+ if (mime_type != kWidevineCdmPluginMimeType) |
+ return; |
+ |
+ UMA_HISTOGRAM_ENUMERATION("Plugin.RegistrationStatus.WidevineCdm", |
+ status, PLUGIN_REGISTRATION_STATUS_MAX); |
+} |
+ |
void PluginInfoMessageFilter::OnIsInternalPluginRegisteredForMimeType( |
const std::string& mime_type, |
bool* is_registered, |
@@ -177,22 +195,33 @@ 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 std::vector<content::WebPluginMimeType>& mime_types = |
plugins[i].mime_types; |
for (size_t j = 0; j < mime_types.size(); ++j) { |
if (mime_types[j].mime_type == mime_type) { |
+ if (!context_.IsPluginEnabled(plugins[i])) { |
ddorwin
2014/07/18 23:50:18
nit: With all the nesting and complexity, maybe we
xhwang
2014/07/19 00:07:14
Done.
|
+ 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); |
ddorwin
2014/07/18 23:50:18
For the record, PLUGIN_DISABLED will not be sent i
xhwang
2014/07/19 00:07:13
Acknowledged.
|
} |
-#endif |
+ |
+#endif // defined(ENABLE_PEPPER_CDMS) |
void PluginInfoMessageFilter::Context::DecidePluginStatus( |
const GetPluginInfo_Params& params, |
@@ -403,3 +432,7 @@ void PluginInfoMessageFilter::Context::MaybeGrantAccess( |
} |
} |
+bool PluginInfoMessageFilter::Context::IsPluginEnabled( |
+ const content::WebPluginInfo& plugin) const { |
+ return plugin_prefs_->IsPluginEnabled(plugin); |
+} |