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

Unified Diff: content/browser/media/cdm_service_impl.cc

Issue 1637083002: Add CdmService to keep track of CDMs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: changes Created 4 years, 9 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
Index: content/browser/media/cdm_service_impl.cc
diff --git a/content/browser/media/cdm_service_impl.cc b/content/browser/media/cdm_service_impl.cc
new file mode 100644
index 0000000000000000000000000000000000000000..279a1f18954372a1eca9a46fcaa03b7f817465c2
--- /dev/null
+++ b/content/browser/media/cdm_service_impl.cc
@@ -0,0 +1,46 @@
+// 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 "content/browser/media/cdm_service_impl.h"
+
+#include <stddef.h>
+
+#include "content/public/common/content_client.h"
+
+namespace content {
+
+static base::LazyInstance<CdmServiceImpl>::Leaky g_cdm_service =
+ LAZY_INSTANCE_INITIALIZER;
+
+// static
+CdmService* CdmService::GetInstance() {
+ return CdmServiceImpl::GetInstance();
+}
+
+// static
+CdmServiceImpl* CdmServiceImpl::GetInstance() {
+ return g_cdm_service.Pointer();
+}
+
+CdmServiceImpl::CdmServiceImpl() {
+}
+
+CdmServiceImpl::~CdmServiceImpl() {}
+
+void CdmServiceImpl::Init() {
+ // Let embedders register CDMs.
+ GetContentClient()->AddContentDecryptionModules(&cdms_);
+}
+
+void CdmServiceImpl::RegisterCdm(const CdmInfo& info) {
+ // Always register new CDMs at the beginning of the list, so that
+ // subsequent requests get the latest.
+ cdms_.insert(cdms_.begin(), info);
+}
+
+const std::vector<CdmInfo>& CdmServiceImpl::GetAllRegisteredCdms() {
+ return cdms_;
+}
+
+} // namespace media

Powered by Google App Engine
This is Rietveld 408576698