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

Side by Side Diff: content/renderer/media/crypto/content_decryption_module_factory.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/crypto/content_decryption_module_factory.h" 5 #include "content/renderer/media/crypto/content_decryption_module_factory.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/renderer/media/crypto/key_systems.h" 8 #include "content/renderer/media/crypto/key_systems.h"
9 #include "media/cdm/aes_decryptor.h" 9 #include "media/cdm/aes_decryptor.h"
10 #include "url/gurl.h" 10 #include "url/gurl.h"
11 11
12 #if defined(ENABLE_PEPPER_CDMS) 12 #if defined(ENABLE_PEPPER_CDMS)
13 #include "content/renderer/media/crypto/ppapi_decryptor.h" 13 #include "content/renderer/media/crypto/ppapi_decryptor.h"
14 #elif defined(OS_ANDROID) 14 #elif defined(ENABLE_BROWSER_CDMS)
15 #include "content/renderer/media/crypto/proxy_media_keys.h" 15 #include "content/renderer/media/crypto/proxy_media_keys.h"
16 #include "content/renderer/media/crypto/renderer_cdm_manager.h" 16 #include "content/renderer/media/crypto/renderer_cdm_manager.h"
17 #endif // defined(ENABLE_PEPPER_CDMS) 17 #endif // defined(ENABLE_PEPPER_CDMS)
18 18
19 namespace content { 19 namespace content {
20 20
21 scoped_ptr<media::MediaKeys> ContentDecryptionModuleFactory::Create( 21 scoped_ptr<media::MediaKeys> ContentDecryptionModuleFactory::Create(
22 const std::string& key_system, 22 const std::string& key_system,
23 const GURL& security_origin, 23 const GURL& security_origin,
24 #if defined(ENABLE_PEPPER_CDMS) 24 #if defined(ENABLE_PEPPER_CDMS)
25 const CreatePepperCdmCB& create_pepper_cdm_cb, 25 const CreatePepperCdmCB& create_pepper_cdm_cb,
26 #elif defined(OS_ANDROID) 26 #elif defined(ENABLE_BROWSER_CDMS)
27 RendererCdmManager* manager, 27 RendererCdmManager* manager,
28 int* cdm_id, 28 int* cdm_id,
29 #endif // defined(ENABLE_PEPPER_CDMS) 29 #endif // defined(ENABLE_PEPPER_CDMS)
30 const media::SessionMessageCB& session_message_cb, 30 const media::SessionMessageCB& session_message_cb,
31 const media::SessionReadyCB& session_ready_cb, 31 const media::SessionReadyCB& session_ready_cb,
32 const media::SessionClosedCB& session_closed_cb, 32 const media::SessionClosedCB& session_closed_cb,
33 const media::SessionErrorCB& session_error_cb) { 33 const media::SessionErrorCB& session_error_cb) {
34 // TODO(jrummell): Pass |security_origin| to all constructors. 34 // TODO(jrummell): Pass |security_origin| to all constructors.
35 // TODO(jrummell): Enable the following line once blink code updated to 35 // TODO(jrummell): Enable the following line once blink code updated to
36 // check the security origin before calling. 36 // check the security origin before calling.
37 // DCHECK(security_origin.is_valid()); 37 // DCHECK(security_origin.is_valid());
38 38
39 #if defined(OS_ANDROID) 39 #if defined(ENABLE_BROWSER_CDMS)
40 *cdm_id = RendererCdmManager::kInvalidCdmId; 40 *cdm_id = RendererCdmManager::kInvalidCdmId;
41 #endif 41 #endif
42 42
43 if (CanUseAesDecryptor(key_system)) { 43 if (CanUseAesDecryptor(key_system)) {
44 return scoped_ptr<media::MediaKeys>( 44 return scoped_ptr<media::MediaKeys>(
45 new media::AesDecryptor(session_message_cb)); 45 new media::AesDecryptor(session_message_cb));
46 } 46 }
47 #if defined(ENABLE_PEPPER_CDMS) 47 #if defined(ENABLE_PEPPER_CDMS)
48 return scoped_ptr<media::MediaKeys>( 48 return scoped_ptr<media::MediaKeys>(
49 PpapiDecryptor::Create(key_system, 49 PpapiDecryptor::Create(key_system,
50 security_origin, 50 security_origin,
51 create_pepper_cdm_cb, 51 create_pepper_cdm_cb,
52 session_message_cb, 52 session_message_cb,
53 session_ready_cb, 53 session_ready_cb,
54 session_closed_cb, 54 session_closed_cb,
55 session_error_cb)); 55 session_error_cb));
56 #elif defined(OS_ANDROID) 56 #elif defined(ENABLE_BROWSER_CDMS)
57 scoped_ptr<ProxyMediaKeys> proxy_media_keys = 57 scoped_ptr<ProxyMediaKeys> proxy_media_keys =
58 ProxyMediaKeys::Create(key_system, 58 ProxyMediaKeys::Create(key_system,
59 security_origin, 59 security_origin,
60 manager, 60 manager,
61 session_message_cb, 61 session_message_cb,
62 session_ready_cb, 62 session_ready_cb,
63 session_closed_cb, 63 session_closed_cb,
64 session_error_cb); 64 session_error_cb);
65 if (proxy_media_keys) 65 if (proxy_media_keys)
66 *cdm_id = proxy_media_keys->GetCdmId(); 66 *cdm_id = proxy_media_keys->GetCdmId();
67 return proxy_media_keys.PassAs<media::MediaKeys>(); 67 return proxy_media_keys.PassAs<media::MediaKeys>();
68 #else 68 #else
69 return scoped_ptr<media::MediaKeys>(); 69 return scoped_ptr<media::MediaKeys>();
70 #endif // defined(ENABLE_PEPPER_CDMS) 70 #endif // defined(ENABLE_PEPPER_CDMS)
71 } 71 }
72 72
73 } // namespace content 73 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/crypto/content_decryption_module_factory.h ('k') | content/renderer/media/crypto/proxy_decryptor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698