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

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

Issue 318753010: Introduce the ENABLE_BROWSER_CDMS macro. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: MEDIA_EXPORT Created 6 years, 6 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 11 matching lines...) Expand all
22 22
23 #if defined(ENABLE_PEPPER_CDMS) 23 #if defined(ENABLE_PEPPER_CDMS)
24 #include "content/renderer/media/crypto/pepper_cdm_wrapper_impl.h" 24 #include "content/renderer/media/crypto/pepper_cdm_wrapper_impl.h"
25 #endif 25 #endif
26 26
27 namespace content { 27 namespace content {
28 28
29 WebContentDecryptionModuleImpl* WebContentDecryptionModuleImpl::Create( 29 WebContentDecryptionModuleImpl* WebContentDecryptionModuleImpl::Create(
30 #if defined(ENABLE_PEPPER_CDMS) 30 #if defined(ENABLE_PEPPER_CDMS)
31 blink::WebLocalFrame* frame, 31 blink::WebLocalFrame* frame,
32 #elif defined(OS_ANDROID) 32 #elif defined(ENABLE_BROWSER_CDMS)
33 RendererCdmManager* manager, 33 RendererCdmManager* manager,
34 #endif 34 #endif
35 const blink::WebSecurityOrigin& security_origin, 35 const blink::WebSecurityOrigin& security_origin,
36 const base::string16& key_system) { 36 const base::string16& key_system) {
37 #if defined(ENABLE_PEPPER_CDMS) 37 #if defined(ENABLE_PEPPER_CDMS)
38 DCHECK(frame); 38 DCHECK(frame);
39 #elif defined(OS_ANDROID) 39 #elif defined(ENABLE_BROWSER_CDMS)
40 DCHECK(manager); 40 DCHECK(manager);
41 #endif 41 #endif
42 DCHECK(!security_origin.isNull()); 42 DCHECK(!security_origin.isNull());
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 (!base::IsStringASCII(key_system)) { 47 if (!base::IsStringASCII(key_system)) {
48 NOTREACHED(); 48 NOTREACHED();
49 return NULL; 49 return NULL;
50 } 50 }
51 51
52 std::string key_system_ascii = base::UTF16ToASCII(key_system); 52 std::string key_system_ascii = base::UTF16ToASCII(key_system);
53 if (!IsConcreteSupportedKeySystem(key_system_ascii)) 53 if (!IsConcreteSupportedKeySystem(key_system_ascii))
54 return NULL; 54 return NULL;
55 55
56 // If unique security origin, don't try to create the CDM. 56 // If unique security origin, don't try to create the CDM.
57 if (security_origin.isUnique() || security_origin.toString() == "null") { 57 if (security_origin.isUnique() || security_origin.toString() == "null") {
58 DLOG(ERROR) << "CDM use not allowed for unique security origin."; 58 DLOG(ERROR) << "CDM use not allowed for unique security origin.";
59 return NULL; 59 return NULL;
60 } 60 }
61 61
62 scoped_refptr<CdmSessionAdapter> adapter(new CdmSessionAdapter()); 62 scoped_refptr<CdmSessionAdapter> adapter(new CdmSessionAdapter());
63 GURL security_origin_as_gurl(security_origin.toString()); 63 GURL security_origin_as_gurl(security_origin.toString());
64 64
65 if (!adapter->Initialize( 65 if (!adapter->Initialize(
66 #if defined(ENABLE_PEPPER_CDMS) 66 #if defined(ENABLE_PEPPER_CDMS)
67 base::Bind(&PepperCdmWrapperImpl::Create, frame), 67 base::Bind(&PepperCdmWrapperImpl::Create, frame),
68 #elif defined(OS_ANDROID) 68 #elif defined(ENABLE_BROWSER_CDMS)
69 manager, 69 manager,
70 #endif 70 #endif
71 key_system_ascii, 71 key_system_ascii,
72 security_origin_as_gurl)) { 72 security_origin_as_gurl)) {
73 return NULL; 73 return NULL;
74 } 74 }
75 75
76 return new WebContentDecryptionModuleImpl(adapter); 76 return new WebContentDecryptionModuleImpl(adapter);
77 } 77 }
78 78
79 WebContentDecryptionModuleImpl::WebContentDecryptionModuleImpl( 79 WebContentDecryptionModuleImpl::WebContentDecryptionModuleImpl(
80 scoped_refptr<CdmSessionAdapter> adapter) 80 scoped_refptr<CdmSessionAdapter> adapter)
81 : adapter_(adapter) {} 81 : adapter_(adapter) {}
82 82
83 WebContentDecryptionModuleImpl::~WebContentDecryptionModuleImpl() { 83 WebContentDecryptionModuleImpl::~WebContentDecryptionModuleImpl() {
84 } 84 }
85 85
86 // The caller owns the created session. 86 // The caller owns the created session.
87 blink::WebContentDecryptionModuleSession* 87 blink::WebContentDecryptionModuleSession*
88 WebContentDecryptionModuleImpl::createSession( 88 WebContentDecryptionModuleImpl::createSession(
89 blink::WebContentDecryptionModuleSession::Client* client) { 89 blink::WebContentDecryptionModuleSession::Client* client) {
90 return adapter_->CreateSession(client); 90 return adapter_->CreateSession(client);
91 } 91 }
92 92
93 media::Decryptor* WebContentDecryptionModuleImpl::GetDecryptor() { 93 media::Decryptor* WebContentDecryptionModuleImpl::GetDecryptor() {
94 return adapter_->GetDecryptor(); 94 return adapter_->GetDecryptor();
95 } 95 }
96 96
97 #if defined(OS_ANDROID) 97 #if defined(ENABLE_BROWSER_CDMS)
98 int WebContentDecryptionModuleImpl::GetCdmId() const { 98 int WebContentDecryptionModuleImpl::GetCdmId() const {
99 return adapter_->GetCdmId(); 99 return adapter_->GetCdmId();
100 } 100 }
101 #endif // defined(OS_ANDROID) 101 #endif // defined(ENABLE_BROWSER_CDMS)
102 102
103 } // namespace content 103 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/webcontentdecryptionmodule_impl.h ('k') | content/renderer/media/webmediaplayer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698