Check for key system support using new mojo service KeySystemSupport
https://chromium-review.googlesource.com/c/chromium/src/+/834764
This commit is contained in:
parent
e1f25253db
commit
77f427acc8
10 changed files with 68 additions and 233 deletions
|
@ -1,67 +0,0 @@
|
|||
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "chrome/browser/renderer_host/pepper/widevine_cdm_message_filter.h"
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "content/public/browser/browser_context.h"
|
||||
#include "content/public/browser/plugin_service.h"
|
||||
#include "content/public/browser/render_process_host.h"
|
||||
#include "content/public/common/webplugininfo.h"
|
||||
#include "media/media_features.h"
|
||||
|
||||
using content::BrowserThread;
|
||||
using content::PluginService;
|
||||
using content::WebPluginInfo;
|
||||
|
||||
WidevineCdmMessageFilter::WidevineCdmMessageFilter(
|
||||
int render_process_id,
|
||||
content::BrowserContext* browser_context)
|
||||
: BrowserMessageFilter(ChromeMsgStart),
|
||||
render_process_id_(render_process_id),
|
||||
browser_context_(browser_context) {}
|
||||
|
||||
bool WidevineCdmMessageFilter::OnMessageReceived(const IPC::Message& message) {
|
||||
IPC_BEGIN_MESSAGE_MAP(WidevineCdmMessageFilter, message)
|
||||
#if BUILDFLAG(ENABLE_LIBRARY_CDMS)
|
||||
IPC_MESSAGE_HANDLER(ChromeViewHostMsg_IsInternalPluginAvailableForMimeType,
|
||||
OnIsInternalPluginAvailableForMimeType)
|
||||
#endif // BUILDFLAG(ENABLE_LIBRARY_CDMS)
|
||||
IPC_MESSAGE_UNHANDLED(return false)
|
||||
IPC_END_MESSAGE_MAP()
|
||||
return true;
|
||||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_LIBRARY_CDMS)
|
||||
void WidevineCdmMessageFilter::OnIsInternalPluginAvailableForMimeType(
|
||||
const std::string& mime_type,
|
||||
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);
|
||||
|
||||
for (size_t i = 0; i < plugins.size(); ++i) {
|
||||
const WebPluginInfo& plugin = plugins[i];
|
||||
const std::vector<content::WebPluginMimeType>& mime_types =
|
||||
plugin.mime_types;
|
||||
for (size_t j = 0; j < mime_types.size(); ++j) {
|
||||
if (mime_types[j].mime_type == mime_type) {
|
||||
*is_available = true;
|
||||
*additional_param_names = mime_types[j].additional_param_names;
|
||||
*additional_param_values = mime_types[j].additional_param_values;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*is_available = false;
|
||||
}
|
||||
#endif // BUILDFLAG(ENABLE_LIBRARY_CDMS)
|
||||
|
||||
void WidevineCdmMessageFilter::OnDestruct() const {
|
||||
BrowserThread::DeleteOnUIThread::Destruct(this);
|
||||
}
|
||||
|
||||
WidevineCdmMessageFilter::~WidevineCdmMessageFilter() {}
|
|
@ -1,50 +0,0 @@
|
|||
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef CHROME_BROWSER_RENDERER_HOST_PEPPER_WIDEVINE_CDM_MESSAGE_FILTER_H_
|
||||
#define CHROME_BROWSER_RENDERER_HOST_PEPPER_WIDEVINE_CDM_MESSAGE_FILTER_H_
|
||||
|
||||
#include "chrome/common/widevine_cdm_messages.h"
|
||||
#include "content/public/browser/browser_message_filter.h"
|
||||
#include "media/media_features.h"
|
||||
|
||||
namespace content {
|
||||
class BrowserContext;
|
||||
}
|
||||
|
||||
class WidevineCdmMessageFilter : public content::BrowserMessageFilter {
|
||||
public:
|
||||
explicit WidevineCdmMessageFilter(int render_process_id,
|
||||
content::BrowserContext* browser_context);
|
||||
bool OnMessageReceived(const IPC::Message& message) override;
|
||||
void OnDestruct() const override;
|
||||
|
||||
private:
|
||||
friend class content::BrowserThread;
|
||||
friend class base::DeleteHelper<WidevineCdmMessageFilter>;
|
||||
|
||||
~WidevineCdmMessageFilter() override;
|
||||
|
||||
#if BUILDFLAG(ENABLE_LIBRARY_CDMS)
|
||||
// Returns whether any internal plugin supporting |mime_type| is registered
|
||||
// and enabled. Does not determine whether the plugin can actually be
|
||||
// instantiated (e.g. whether it has all its dependencies).
|
||||
// When the returned *|is_available| is true, |additional_param_names| and
|
||||
// |additional_param_values| contain the name-value pairs, if any, specified
|
||||
// for the *first* non-disabled plugin found that is registered for
|
||||
// |mime_type|.
|
||||
void OnIsInternalPluginAvailableForMimeType(
|
||||
const std::string& mime_type,
|
||||
bool* is_available,
|
||||
std::vector<base::string16>* additional_param_names,
|
||||
std::vector<base::string16>* additional_param_values);
|
||||
#endif // BUILDFLAG(ENABLE_LIBRARY_CDMS)
|
||||
|
||||
int render_process_id_;
|
||||
content::BrowserContext* browser_context_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(WidevineCdmMessageFilter);
|
||||
};
|
||||
|
||||
#endif // CHROME_BROWSER_RENDERER_HOST_PEPPER_WIDEVINE_CDM_MESSAGE_FILTER_H_
|
Loading…
Add table
Add a link
Reference in a new issue