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

Side by Side Diff: content/renderer/media/webcontentdecryptionmodule_impl.cc

Issue 193523002: Encrypted Media: Implement IPC based SetCdm(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Manage cdm_id_ in CdmSessionAdapter Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/media/webcontentdecryptionmodule_impl.h" 5 #include "content/renderer/media/webcontentdecryptionmodule_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 DCHECK(!key_system.empty()); 43 DCHECK(!key_system.empty());
44 44
45 // TODO(ddorwin): Guard against this in supported types check and remove this. 45 // TODO(ddorwin): Guard against this in supported types check and remove this.
46 // Chromium only supports ASCII key systems. 46 // Chromium only supports ASCII key systems.
47 if (!IsStringASCII(key_system)) { 47 if (!IsStringASCII(key_system)) {
48 NOTREACHED(); 48 NOTREACHED();
49 return NULL; 49 return NULL;
50 } 50 }
51 51
52 scoped_refptr<CdmSessionAdapter> adapter(new CdmSessionAdapter()); 52 scoped_refptr<CdmSessionAdapter> adapter(new CdmSessionAdapter());
53
53 if (!adapter->Initialize( 54 if (!adapter->Initialize(
54 #if defined(ENABLE_PEPPER_CDMS) 55 #if defined(ENABLE_PEPPER_CDMS)
55 base::Bind(&PepperCdmWrapperImpl::Create, frame), 56 base::Bind(&PepperCdmWrapperImpl::Create, frame),
56 #endif 57 #endif
57 base::UTF16ToASCII(key_system))) { 58 base::UTF16ToASCII(key_system))) {
58 return NULL; 59 return NULL;
59 } 60 }
60 61
61 return new WebContentDecryptionModuleImpl(adapter); 62 return new WebContentDecryptionModuleImpl(adapter);
62 } 63 }
63 64
64 WebContentDecryptionModuleImpl::WebContentDecryptionModuleImpl( 65 WebContentDecryptionModuleImpl::WebContentDecryptionModuleImpl(
65 scoped_refptr<CdmSessionAdapter> adapter) 66 scoped_refptr<CdmSessionAdapter> adapter)
66 : adapter_(adapter) { 67 : adapter_(adapter) {}
67 }
68 68
69 WebContentDecryptionModuleImpl::~WebContentDecryptionModuleImpl() { 69 WebContentDecryptionModuleImpl::~WebContentDecryptionModuleImpl() {
70 } 70 }
71 71
72 // The caller owns the created session. 72 // The caller owns the created session.
73 blink::WebContentDecryptionModuleSession* 73 blink::WebContentDecryptionModuleSession*
74 WebContentDecryptionModuleImpl::createSession( 74 WebContentDecryptionModuleImpl::createSession(
75 blink::WebContentDecryptionModuleSession::Client* client) { 75 blink::WebContentDecryptionModuleSession::Client* client) {
76 return adapter_->CreateSession(client); 76 return adapter_->CreateSession(client);
77 } 77 }
78 78
79 media::Decryptor* WebContentDecryptionModuleImpl::GetDecryptor() { 79 media::Decryptor* WebContentDecryptionModuleImpl::GetDecryptor() {
80 return adapter_->GetDecryptor(); 80 return adapter_->GetDecryptor();
81 } 81 }
82 82
83 #if defined(OS_ANDROID)
84 int WebContentDecryptionModuleImpl::GetCdmId() const {
85 return adapter_->GetCdmId();
86 }
87 #endif // defined(OS_ANDROID)
88
83 } // namespace content 89 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698