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

Unified Diff: chrome/browser/media/pepper_cdm_test_helper.cc

Issue 2020573002: media: Check Widevine CDM registration and availability. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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/media/pepper_cdm_test_helper.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
+}
« no previous file with comments | « chrome/browser/media/pepper_cdm_test_helper.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698