| OLD | NEW |
| 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/render_cdm_factory.h" | 5 #include "content/renderer/media/crypto/render_cdm_factory.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "media/base/key_systems.h" | 8 #include "media/base/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" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #else | 29 #else |
| 30 RenderCdmFactory::RenderCdmFactory() { | 30 RenderCdmFactory::RenderCdmFactory() { |
| 31 } | 31 } |
| 32 #endif // defined(ENABLE_PEPPER_CDMS) | 32 #endif // defined(ENABLE_PEPPER_CDMS) |
| 33 | 33 |
| 34 RenderCdmFactory::~RenderCdmFactory() { | 34 RenderCdmFactory::~RenderCdmFactory() { |
| 35 } | 35 } |
| 36 | 36 |
| 37 scoped_ptr<media::MediaKeys> RenderCdmFactory::Create( | 37 scoped_ptr<media::MediaKeys> RenderCdmFactory::Create( |
| 38 const std::string& key_system, | 38 const std::string& key_system, |
| 39 bool allow_distinctive_identifier, |
| 40 bool allow_persistent_state, |
| 39 const GURL& security_origin, | 41 const GURL& security_origin, |
| 40 const media::SessionMessageCB& session_message_cb, | 42 const media::SessionMessageCB& session_message_cb, |
| 41 const media::SessionClosedCB& session_closed_cb, | 43 const media::SessionClosedCB& session_closed_cb, |
| 42 const media::SessionErrorCB& session_error_cb, | 44 const media::SessionErrorCB& session_error_cb, |
| 43 const media::SessionKeysChangeCB& session_keys_change_cb, | 45 const media::SessionKeysChangeCB& session_keys_change_cb, |
| 44 const media::SessionExpirationUpdateCB& session_expiration_update_cb) { | 46 const media::SessionExpirationUpdateCB& session_expiration_update_cb) { |
| 45 // TODO(jrummell): Pass |security_origin| to all constructors. | 47 // TODO(jrummell): Pass |security_origin| to all constructors. |
| 46 // TODO(jrummell): Enable the following line once blink code updated to | 48 // TODO(jrummell): Enable the following line once blink code updated to |
| 47 // check the security origin before calling. | 49 // check the security origin before calling. |
| 48 // DCHECK(security_origin.is_valid()); | 50 // DCHECK(security_origin.is_valid()); |
| 49 | 51 |
| 50 if (media::CanUseAesDecryptor(key_system)) { | 52 if (media::CanUseAesDecryptor(key_system)) { |
| 53 // TODO(sandersd): Currently the prefixed API always allows distinctive |
| 54 // identifiers and persistent state. Once that changes we can sanity check |
| 55 // here that neither is allowed for AesDecryptor, since it does not support |
| 56 // them and should never be configured that way. http://crbug.com/455271 |
| 51 return scoped_ptr<media::MediaKeys>(new media::AesDecryptor( | 57 return scoped_ptr<media::MediaKeys>(new media::AesDecryptor( |
| 52 session_message_cb, session_closed_cb, session_keys_change_cb)); | 58 session_message_cb, session_closed_cb, session_keys_change_cb)); |
| 53 } | 59 } |
| 54 | 60 |
| 55 #if defined(ENABLE_PEPPER_CDMS) | 61 #if defined(ENABLE_PEPPER_CDMS) |
| 56 return scoped_ptr<media::MediaKeys>( | 62 return scoped_ptr<media::MediaKeys>( |
| 57 PpapiDecryptor::Create(key_system, | 63 PpapiDecryptor::Create(key_system, |
| 64 allow_distinctive_identifier, |
| 65 allow_persistent_state, |
| 58 security_origin, | 66 security_origin, |
| 59 create_pepper_cdm_cb_, | 67 create_pepper_cdm_cb_, |
| 60 session_message_cb, | 68 session_message_cb, |
| 61 session_closed_cb, | 69 session_closed_cb, |
| 62 session_error_cb, | 70 session_error_cb, |
| 63 session_keys_change_cb, | 71 session_keys_change_cb, |
| 64 session_expiration_update_cb)); | 72 session_expiration_update_cb)); |
| 65 #elif defined(ENABLE_BROWSER_CDMS) | 73 #elif defined(ENABLE_BROWSER_CDMS) |
| 74 DCHECK(allow_distinctive_identifier); |
| 75 DCHECK(allow_persistent_state); |
| 66 return scoped_ptr<media::MediaKeys>( | 76 return scoped_ptr<media::MediaKeys>( |
| 67 ProxyMediaKeys::Create(key_system, | 77 ProxyMediaKeys::Create(key_system, |
| 68 security_origin, | 78 security_origin, |
| 69 manager_, | 79 manager_, |
| 70 session_message_cb, | 80 session_message_cb, |
| 71 session_closed_cb, | 81 session_closed_cb, |
| 72 session_error_cb, | 82 session_error_cb, |
| 73 session_keys_change_cb, | 83 session_keys_change_cb, |
| 74 session_expiration_update_cb)); | 84 session_expiration_update_cb)); |
| 75 #else | 85 #else |
| 76 return nullptr; | 86 return nullptr; |
| 77 #endif // defined(ENABLE_PEPPER_CDMS) | 87 #endif // defined(ENABLE_PEPPER_CDMS) |
| 78 } | 88 } |
| 79 | 89 |
| 80 } // namespace content | 90 } // namespace content |
| OLD | NEW |