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

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

Issue 1983563002: media: Add helper function to register pepper CDMs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments 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') | chrome/chrome_tests.gypi » ('j') | 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
new file mode 100644
index 0000000000000000000000000000000000000000..0fd101cce006bb08f102973050d764953a3afbfe
--- /dev/null
+++ b/chrome/browser/media/pepper_cdm_test_helper.cc
@@ -0,0 +1,58 @@
+// Copyright 2016 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/media/pepper_cdm_test_helper.h"
+
+#include "base/command_line.h"
+#include "base/files/file_util.h"
+#include "base/path_service.h"
+#include "base/strings/utf_string_conversions.h"
+#include "content/public/common/content_switches.h"
+
+#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
+
+const char kClearKeyCdmAdapterFileName[] =
+#if defined(OS_MACOSX)
+ "clearkeycdmadapter.plugin";
+#elif defined(OS_WIN)
+ "clearkeycdmadapter.dll";
+#elif defined(OS_POSIX)
+ "libclearkeycdmadapter.so";
+#endif
+
+const char kClearKeyCdmPepperMimeType[] = "application/x-ppapi-clearkey-cdm";
+
+base::FilePath::StringType BuildPepperCdmRegistration(
+ const std::string& adapter_file_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.AppendASCII(adapter_file_name);
+ DCHECK_EQ(expect_adapter_exists, base::PathExists(adapter_path));
+
+ base::FilePath::StringType pepper_cdm_registration = adapter_path.value();
+ pepper_cdm_registration.append(FILE_PATH_LITERAL("#CDM#0.1.0.0;"));
+
+#if defined(OS_WIN)
+ pepper_cdm_registration.append(base::ASCIIToUTF16(mime_type));
+#else
+ pepper_cdm_registration.append(mime_type);
+#endif
+
+ return pepper_cdm_registration;
+}
+
+void RegisterPepperCdm(base::CommandLine* command_line,
+ const std::string& adapter_file_name,
+ const std::string& mime_type,
+ bool expect_adapter_exists) {
+ base::FilePath::StringType pepper_cdm_registration =
+ BuildPepperCdmRegistration(adapter_file_name, mime_type,
+ expect_adapter_exists);
+
+ // Append the switch to register the CDM Adapter.
+ command_line->AppendSwitchNative(switches::kRegisterPepperPlugins,
+ pepper_cdm_registration);
+}
« no previous file with comments | « chrome/browser/media/pepper_cdm_test_helper.h ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698