summaryrefslogtreecommitdiffstats
path: root/chrome/browser/plugins
diff options
context:
space:
mode:
authorddorwin@chromium.org <ddorwin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-17 22:32:51 +0000
committerddorwin@chromium.org <ddorwin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-17 22:32:51 +0000
commit3627aa3fa39aef7cbcc3dfd67b51e8fb9efa68c5 (patch)
tree603a8c2df1e3cb8da3c8db86d8670fa5e6f9fcad /chrome/browser/plugins
parent2a29c58de9e4a1ac9dfe41024b30bae28db22c45 (diff)
downloadchromium_src-3627aa3fa39aef7cbcc3dfd67b51e8fb9efa68c5.zip
chromium_src-3627aa3fa39aef7cbcc3dfd67b51e8fb9efa68c5.tar.gz
chromium_src-3627aa3fa39aef7cbcc3dfd67b51e8fb9efa68c5.tar.bz2
Check whether the Pepper CDM is available before adding the key system.
This adds a synchronous IPC from chrome_key_systems.cc to the browser process to check with the PluginService. BUG=224793 TEST=existing IsTypeSupported browser tests and new negative tests Review URL: https://chromiumcodereview.appspot.com/23828007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@223719 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/plugins')
-rw-r--r--chrome/browser/plugins/plugin_info_message_filter.cc22
-rw-r--r--chrome/browser/plugins/plugin_info_message_filter.h6
2 files changed, 28 insertions, 0 deletions
diff --git a/chrome/browser/plugins/plugin_info_message_filter.cc b/chrome/browser/plugins/plugin_info_message_filter.cc
index f2260e4..9a15415 100644
--- a/chrome/browser/plugins/plugin_info_message_filter.cc
+++ b/chrome/browser/plugins/plugin_info_message_filter.cc
@@ -97,6 +97,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_IsInternalPluginRegisteredForMimeType,
+ OnIsInternalPluginRegisteredForMimeType)
IPC_MESSAGE_UNHANDLED(return false)
IPC_END_MESSAGE_MAP()
return true;
@@ -164,6 +167,25 @@ void PluginInfoMessageFilter::PluginsLoaded(
Send(reply_msg);
}
+void PluginInfoMessageFilter::OnIsInternalPluginRegisteredForMimeType(
+ const std::string& mime_type,
+ bool* is_registered) {
+ std::vector<WebPluginInfo> plugins;
+ PluginService::GetInstance()->GetInternalPlugins(&plugins);
+ 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) {
+ *is_registered = true;
+ return;
+ }
+ }
+ }
+
+ *is_registered = false;
+}
+
void PluginInfoMessageFilter::Context::DecidePluginStatus(
const GetPluginInfo_Params& params,
const WebPluginInfo& plugin,
diff --git a/chrome/browser/plugins/plugin_info_message_filter.h b/chrome/browser/plugins/plugin_info_message_filter.h
index d57427e..21cd02c 100644
--- a/chrome/browser/plugins/plugin_info_message_filter.h
+++ b/chrome/browser/plugins/plugin_info_message_filter.h
@@ -98,6 +98,12 @@ class PluginInfoMessageFilter : public content::BrowserMessageFilter {
IPC::Message* reply_msg,
const std::vector<content::WebPluginInfo>& plugins);
+ // Returns whether any internal plugin supporting |mime_type| is registered.
+ // Does not determine whether the plugin can actually be instantiated
+ // (e.g. whether it is allowed or has all its dependencies).
+ void OnIsInternalPluginRegisteredForMimeType(const std::string& mime_type,
+ bool* is_registered);
+
Context context_;
base::WeakPtrFactory<PluginInfoMessageFilter> weak_ptr_factory_;