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

Side by Side 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: 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "media/base/android/cdm_factory.h"
6
7 #include "base/command_line.h"
8 #include "media/base/android/media_drm_bridge.h"
9 #include "media/base/media_switches.h"
10
11 namespace media {
12
13 scoped_ptr<MediaKeys> CreateCdm(const std::string& key_system,
14 const SessionCreatedCB& session_created_cb,
15 const SessionMessageCB& session_message_cb,
16 const SessionReadyCB& session_ready_cb,
17 const SessionClosedCB& session_closed_cb,
18 const SessionErrorCB& session_error_cb) {
19 if (!MediaDrmBridge::IsKeySystemSupported(key_system)) {
20 NOTREACHED() << "Unsupported key system: " << key_system;
21 return scoped_ptr<MediaKeys>();
22 }
23
24 scoped_ptr<MediaDrmBridge> cdm(MediaDrmBridge::Create(key_system,
25 session_created_cb,
26 session_message_cb,
27 session_ready_cb,
28 session_closed_cb,
29 session_error_cb));
30
31 // TODO(xhwang/ddorwin): Pass the security level from key system.
32 MediaDrmBridge::SecurityLevel security_level =
33 MediaDrmBridge::SECURITY_LEVEL_3;
34 if (CommandLine::ForCurrentProcess()
35 ->HasSwitch(switches::kMediaDrmEnableNonCompositing)) {
36 security_level = MediaDrmBridge::SECURITY_LEVEL_1;
37 }
38 if (!cdm->SetSecurityLevel(security_level)) {
39 DVLOG(1) << "failed to set security level " << security_level;
40 return scoped_ptr<MediaKeys>();
41 }
42
43 return cdm.PassAs<MediaKeys>();
44 }
45
46 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698