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

Unified Diff: media/base/android/cdm_factory_android.cc

Issue 276973005: BrowserMediaPlayerManager manages MediaKeys objects. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments addressed Created 6 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
Index: media/base/android/cdm_factory_android.cc
diff --git a/media/base/android/cdm_factory_android.cc b/media/base/android/cdm_factory_android.cc
new file mode 100644
index 0000000000000000000000000000000000000000..c9b24e2d550d67de06543533f35a54ffc381f7e9
--- /dev/null
+++ b/media/base/android/cdm_factory_android.cc
@@ -0,0 +1,53 @@
+// 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/cdm_factory.h"
+
+#include "base/command_line.h"
+#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
+#include "media/base/android/media_drm_bridge.h"
+#include "media/base/media_switches.h"
+
+namespace media {
+
+scoped_ptr<MediaKeys> CreateBrowserCdm(
+ const std::string& key_system,
+ const SessionCreatedCB& session_created_cb,
+ const SessionMessageCB& session_message_cb,
+ const SessionReadyCB& session_ready_cb,
+ const SessionClosedCB& session_closed_cb,
+ const SessionErrorCB& session_error_cb) {
+ if (!MediaDrmBridge::IsKeySystemSupported(key_system)) {
+ NOTREACHED() << "Unsupported key system: " << key_system;
+ return scoped_ptr<MediaKeys>();
+ }
+
+ scoped_ptr<MediaDrmBridge> cdm(MediaDrmBridge::Create(key_system,
+ session_created_cb,
+ session_message_cb,
+ session_ready_cb,
+ session_closed_cb,
+ session_error_cb));
+ if (!cdm) {
+ NOTREACHED() << "MediaDrmBridge cannot be created for " << key_system;
+ return scoped_ptr<MediaKeys>();
+ }
+
+ // TODO(xhwang/ddorwin): Pass the security level from key system.
+ MediaDrmBridge::SecurityLevel security_level =
+ MediaDrmBridge::SECURITY_LEVEL_3;
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kMediaDrmEnableNonCompositing)) {
+ security_level = MediaDrmBridge::SECURITY_LEVEL_1;
+ }
+ if (!cdm->SetSecurityLevel(security_level)) {
+ DVLOG(1) << "failed to set security level " << security_level;
+ return scoped_ptr<MediaKeys>();
+ }
+
+ return cdm.PassAs<MediaKeys>();
+}
+
+} // namespace media
« no previous file with comments | « content/browser/media/android/media_drm_credential_manager.cc ('k') | media/base/android/media_drm_bridge.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698