| Index: chrome/browser/media/pepper_cdm_test_helper.cc
|
| diff --git a/chrome/browser/media/pepper_cdm_test_helper.cc b/chrome/browser/media/pepper_cdm_test_helper.cc
|
| index b4b85dfa0bcec48e8224c3138ab5910d4120679f..7ee3fa2a1749a0cc3930f6be7e36a848479a8000 100644
|
| --- a/chrome/browser/media/pepper_cdm_test_helper.cc
|
| +++ b/chrome/browser/media/pepper_cdm_test_helper.cc
|
| @@ -8,7 +8,9 @@
|
| #include "base/files/file_util.h"
|
| #include "base/path_service.h"
|
| #include "base/strings/utf_string_conversions.h"
|
| +#include "content/public/browser/plugin_service.h"
|
| #include "content/public/common/content_switches.h"
|
| +#include "content/public/common/webplugininfo.h"
|
| #include "media/cdm/cdm_paths.h"
|
|
|
| #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
|
| @@ -28,17 +30,24 @@ const char kClearKeyCdmDisplayName[] = "Clear Key CDM";
|
|
|
| const char kClearKeyCdmPepperMimeType[] = "application/x-ppapi-clearkey-cdm";
|
|
|
| +base::FilePath GetPepperCdmPath(const std::string& adapter_base_dir,
|
| + const std::string& adapter_file_name) {
|
| + base::FilePath adapter_path;
|
| + PathService::Get(base::DIR_MODULE, &adapter_path);
|
| + adapter_path = adapter_path.Append(
|
| + media::GetPlatformSpecificDirectory(adapter_base_dir));
|
| + adapter_path = adapter_path.AppendASCII(adapter_file_name);
|
| + return adapter_path;
|
| +}
|
| +
|
| base::FilePath::StringType BuildPepperCdmRegistration(
|
| const std::string& adapter_base_dir,
|
| const std::string& adapter_file_name,
|
| const std::string& display_name,
|
| const std::string& mime_type,
|
| bool expect_adapter_exists) {
|
| - base::FilePath adapter_path;
|
| - PathService::Get(base::DIR_MODULE, &adapter_path);
|
| - adapter_path = adapter_path.Append(
|
| - media::GetPlatformSpecificDirectory(adapter_base_dir));
|
| - adapter_path = adapter_path.AppendASCII(adapter_file_name);
|
| + base::FilePath adapter_path =
|
| + GetPepperCdmPath(adapter_base_dir, adapter_file_name);
|
| DCHECK_EQ(expect_adapter_exists, base::PathExists(adapter_path))
|
| << adapter_path.MaybeAsASCII();
|
|
|
| @@ -73,3 +82,15 @@ void RegisterPepperCdm(base::CommandLine* command_line,
|
| command_line->AppendSwitchNative(switches::kRegisterPepperPlugins,
|
| pepper_cdm_registration);
|
| }
|
| +
|
| +bool IsPepperCdmRegistered(const std::string& mime_type) {
|
| + std::vector<content::WebPluginInfo> plugins;
|
| + content::PluginService::GetInstance()->GetInternalPlugins(&plugins);
|
| + for (const auto& plugin : plugins) {
|
| + for (const auto& plugin_mime_type : plugin.mime_types) {
|
| + if (plugin_mime_type.mime_type == mime_type)
|
| + return true;
|
| + }
|
| + }
|
| + return false;
|
| +}
|
|
|