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 f2260e43fb3c3949d8472ee8f129d5d37e302e48..428f9ec1d997d548969124aac6cec80883723bac 100644 |
--- a/chrome/browser/plugins/plugin_info_message_filter.cc |
+++ b/chrome/browser/plugins/plugin_info_message_filter.cc |
@@ -57,6 +57,18 @@ bool ShouldUseJavaScriptSettingForPlugin(const WebPluginInfo& plugin) { |
return false; |
} |
+// Returns whether any plugin supporting |mime_type| is registered with Chrome. |
+// Does not determine whether the plugin could actually be instantiated |
+// (i.e. by checking Content Settings). |
+// Also does not check whether the plugin can be loaded |
+// (i.e. has all its dependencies). |
+bool IsSupportingPluginAvailable(const std::string& mime_type) { |
+ std::vector<WebPluginInfo> matching_plugins; |
+ PluginService::GetInstance()->GetPluginInfoArray( |
+ GURL(), mime_type, false, &matching_plugins, NULL); |
xhwang
2013/09/11 22:49:28
indent
ddorwin
2013/09/16 17:17:58
Done.
|
+ return !matching_plugins.empty(); |
+} |
+ |
} // namespace |
PluginInfoMessageFilter::Context::Context(int render_process_id, |
@@ -97,6 +109,9 @@ bool PluginInfoMessageFilter::OnMessageReceived(const IPC::Message& message, |
IPC_BEGIN_MESSAGE_MAP_EX(PluginInfoMessageFilter, message, *message_was_ok) |
IPC_MESSAGE_HANDLER_DELAY_REPLY(ChromeViewHostMsg_GetPluginInfo, |
OnGetPluginInfo) |
+ IPC_MESSAGE_HANDLER( |
+ ChromeViewHostMsg_IsSupportingPluginAvailable, |
+ OnIsSupportingPluginAvailable) |
IPC_MESSAGE_UNHANDLED(return false) |
IPC_END_MESSAGE_MAP() |
return true; |
@@ -164,6 +179,12 @@ void PluginInfoMessageFilter::PluginsLoaded( |
Send(reply_msg); |
} |
+void PluginInfoMessageFilter::OnIsSupportingPluginAvailable( |
+ const std::string& mime_type, |
+ bool* is_available) { |
+ *is_available = IsSupportingPluginAvailable(mime_type); |
+} |
+ |
void PluginInfoMessageFilter::Context::DecidePluginStatus( |
const GetPluginInfo_Params& params, |
const WebPluginInfo& plugin, |