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

Unified Diff: chrome/browser/plugins/plugin_info_message_filter.cc

Issue 399063004: Check whether the plugin is disabled in OnIsInternalPluginRegisteredForMimeType(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments addressed Created 6 years, 5 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
« no previous file with comments | « chrome/browser/plugins/plugin_info_message_filter.h ('k') | chrome/common/render_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..b091d458bccb721810b35e3f3f799dab9aa15d99 100644
--- a/chrome/browser/plugins/plugin_info_message_filter.cc
+++ b/chrome/browser/plugins/plugin_info_message_filter.cc
@@ -62,6 +62,29 @@ bool ShouldUseJavaScriptSettingForPlugin(const WebPluginInfo& plugin) {
return false;
}
+#if defined(ENABLE_PEPPER_CDMS)
+
+enum PluginAvailabilityStatusForUMA {
+ PLUGIN_NOT_REGISTERED,
+ PLUGIN_AVAILABLE,
+ PLUGIN_DISABLED,
+ PLUGIN_AVAILABILITY_STATUS_MAX
+};
+
+static void SendPluginAvailabilityUMA(const std::string& mime_type,
+ PluginAvailabilityStatusForUMA status) {
+#if defined(WIDEVINE_CDM_AVAILABLE)
+ // Only report results for Widevine CDM.
+ if (mime_type != kWidevineCdmPluginMimeType)
+ return;
+
+ UMA_HISTOGRAM_ENUMERATION("Plugin.AvailabilityStatus.WidevineCdm",
+ status, PLUGIN_AVAILABILITY_STATUS_MAX);
+#endif // defined(WIDEVINE_CDM_AVAILABLE)
+}
+
+#endif // defined(ENABLE_PEPPER_CDMS)
+
} // namespace
PluginInfoMessageFilter::Context::Context(int render_process_id,
@@ -99,8 +122,8 @@ bool PluginInfoMessageFilter::OnMessageReceived(const IPC::Message& message) {
OnGetPluginInfo)
#if defined(ENABLE_PEPPER_CDMS)
IPC_MESSAGE_HANDLER(
- ChromeViewHostMsg_IsInternalPluginRegisteredForMimeType,
- OnIsInternalPluginRegisteredForMimeType)
+ ChromeViewHostMsg_IsInternalPluginAvailableForMimeType,
+ OnIsInternalPluginAvailableForMimeType)
#endif
IPC_MESSAGE_UNHANDLED(return false)
IPC_END_MESSAGE_MAP()
@@ -170,29 +193,42 @@ void PluginInfoMessageFilter::PluginsLoaded(
}
#if defined(ENABLE_PEPPER_CDMS)
-void PluginInfoMessageFilter::OnIsInternalPluginRegisteredForMimeType(
+
+void PluginInfoMessageFilter::OnIsInternalPluginAvailableForMimeType(
const std::string& mime_type,
- bool* is_registered,
+ bool* is_available,
std::vector<base::string16>* additional_param_names,
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) {
- *is_registered = true;
+ if (!context_.IsPluginEnabled(plugin)) {
+ is_plugin_disabled = true;
+ break;
+ }
+
+ *is_available = true;
*additional_param_names = mime_types[j].additional_param_names;
*additional_param_values = mime_types[j].additional_param_values;
+ SendPluginAvailabilityUMA(mime_type, PLUGIN_AVAILABLE);
return;
}
}
}
- *is_registered = false;
+ *is_available = false;
+ SendPluginAvailabilityUMA(
+ 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 +439,7 @@ void PluginInfoMessageFilter::Context::MaybeGrantAccess(
}
}
+bool PluginInfoMessageFilter::Context::IsPluginEnabled(
+ const content::WebPluginInfo& plugin) const {
+ return plugin_prefs_->IsPluginEnabled(plugin);
+}
« no previous file with comments | « chrome/browser/plugins/plugin_info_message_filter.h ('k') | chrome/common/render_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698