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

Unified Diff: media/base/browser_cdm_factory.cc

Issue 774423002: Provides method for setting a BrowserCdmFactory for IPC-based CDM. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: include base/logging.h Created 6 years 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 | « media/base/browser_cdm_factory.h ('k') | media/media.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/browser_cdm_factory.cc
diff --git a/media/base/browser_cdm_factory.cc b/media/base/browser_cdm_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..5eda1554935a08a1ced660467c94e6bee40994a8
--- /dev/null
+++ b/media/base/browser_cdm_factory.cc
@@ -0,0 +1,48 @@
+// Copyright 2014 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 "media/base/browser_cdm_factory.h"
+
+#include "base/logging.h"
+
+#if defined(OS_ANDROID)
+#include "media/base/android/browser_cdm_factory_android.h"
+#endif
+
+namespace media {
+
+namespace {
+BrowserCdmFactory* g_cdm_factory = NULL;
+}
+
+void SetBrowserCdmFactory(BrowserCdmFactory* factory) {
+ DCHECK(!g_cdm_factory);
+ g_cdm_factory = factory;
+}
+
+scoped_ptr<BrowserCdm> CreateBrowserCdm(
+ const std::string& key_system,
+ const BrowserCdm::SessionCreatedCB& session_created_cb,
+ const BrowserCdm::SessionMessageCB& session_message_cb,
+ const BrowserCdm::SessionReadyCB& session_ready_cb,
+ const BrowserCdm::SessionClosedCB& session_closed_cb,
+ const BrowserCdm::SessionErrorCB& session_error_cb) {
+ if (!g_cdm_factory) {
+#if defined(OS_ANDROID)
+ SetBrowserCdmFactory(new BrowserCdmFactoryAndroid);
+#else
+ LOG(ERROR) << "Cannot create BrowserCdm: no BrowserCdmFactory available!";
+ return scoped_ptr<BrowserCdm>();
+#endif
+ }
+
+ return g_cdm_factory->CreateBrowserCdm(key_system,
+ session_created_cb,
+ session_message_cb,
+ session_ready_cb,
+ session_closed_cb,
+ session_error_cb);
+}
+
+} // namespace media
« no previous file with comments | « media/base/browser_cdm_factory.h ('k') | media/media.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698