Chromium Code Reviews| 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 30 matching lines...) Expand all Loading... | |
| 41 const std::string& key_system, | 41 const std::string& key_system, |
| 42 bool allow_distinctive_identifier, | 42 bool allow_distinctive_identifier, |
| 43 bool allow_persistent_state, | 43 bool allow_persistent_state, |
| 44 const GURL& security_origin, | 44 const GURL& security_origin, |
| 45 const media::SessionMessageCB& session_message_cb, | 45 const media::SessionMessageCB& session_message_cb, |
| 46 const media::SessionClosedCB& session_closed_cb, | 46 const media::SessionClosedCB& session_closed_cb, |
| 47 const media::LegacySessionErrorCB& legacy_session_error_cb, | 47 const media::LegacySessionErrorCB& legacy_session_error_cb, |
| 48 const media::SessionKeysChangeCB& session_keys_change_cb, | 48 const media::SessionKeysChangeCB& session_keys_change_cb, |
| 49 const media::SessionExpirationUpdateCB& session_expiration_update_cb) { | 49 const media::SessionExpirationUpdateCB& session_expiration_update_cb) { |
| 50 DCHECK(thread_checker_.CalledOnValidThread()); | 50 DCHECK(thread_checker_.CalledOnValidThread()); |
| 51 // TODO(jrummell): Pass |security_origin| to all constructors. | 51 |
| 52 // TODO(jrummell): Enable the following line once blink code updated to | 52 if (!security_origin.is_valid()) |
|
sandersd (OOO until July 31)
2015/04/07 19:37:44
What are we trying to check exactly?
| |
| 53 // check the security origin before calling. | 53 return nullptr; |
| 54 // DCHECK(security_origin.is_valid()); | |
| 55 | 54 |
| 56 if (media::CanUseAesDecryptor(key_system)) { | 55 if (media::CanUseAesDecryptor(key_system)) { |
| 57 // TODO(sandersd): Currently the prefixed API always allows distinctive | 56 // TODO(sandersd): Currently the prefixed API always allows distinctive |
| 58 // identifiers and persistent state. Once that changes we can sanity check | 57 // identifiers and persistent state. Once that changes we can sanity check |
| 59 // here that neither is allowed for AesDecryptor, since it does not support | 58 // here that neither is allowed for AesDecryptor, since it does not support |
| 60 // them and should never be configured that way. http://crbug.com/455271 | 59 // them and should never be configured that way. http://crbug.com/455271 |
| 61 return scoped_ptr<media::MediaKeys>(new media::AesDecryptor( | 60 return scoped_ptr<media::MediaKeys>( |
| 62 session_message_cb, session_closed_cb, session_keys_change_cb)); | 61 new media::AesDecryptor(security_origin, session_message_cb, |
| 62 session_closed_cb, session_keys_change_cb)); | |
| 63 } | 63 } |
| 64 | 64 |
| 65 #if defined(ENABLE_PEPPER_CDMS) | 65 #if defined(ENABLE_PEPPER_CDMS) |
| 66 return scoped_ptr<media::MediaKeys>(PpapiDecryptor::Create( | 66 return scoped_ptr<media::MediaKeys>(PpapiDecryptor::Create( |
| 67 key_system, allow_distinctive_identifier, allow_persistent_state, | 67 key_system, allow_distinctive_identifier, allow_persistent_state, |
| 68 security_origin, create_pepper_cdm_cb_, session_message_cb, | 68 security_origin, create_pepper_cdm_cb_, session_message_cb, |
| 69 session_closed_cb, legacy_session_error_cb, session_keys_change_cb, | 69 session_closed_cb, legacy_session_error_cb, session_keys_change_cb, |
| 70 session_expiration_update_cb)); | 70 session_expiration_update_cb)); |
| 71 #elif defined(ENABLE_BROWSER_CDMS) | 71 #elif defined(ENABLE_BROWSER_CDMS) |
| 72 DCHECK(allow_distinctive_identifier); | 72 DCHECK(allow_distinctive_identifier); |
| 73 DCHECK(allow_persistent_state); | 73 DCHECK(allow_persistent_state); |
| 74 return scoped_ptr<media::MediaKeys>(ProxyMediaKeys::Create( | 74 return scoped_ptr<media::MediaKeys>(ProxyMediaKeys::Create( |
| 75 key_system, security_origin, manager_, session_message_cb, | 75 key_system, security_origin, manager_, session_message_cb, |
| 76 session_closed_cb, legacy_session_error_cb, session_keys_change_cb, | 76 session_closed_cb, legacy_session_error_cb, session_keys_change_cb, |
| 77 session_expiration_update_cb)); | 77 session_expiration_update_cb)); |
| 78 #else | 78 #else |
| 79 return nullptr; | 79 return nullptr; |
| 80 #endif // defined(ENABLE_PEPPER_CDMS) | 80 #endif // defined(ENABLE_PEPPER_CDMS) |
| 81 } | 81 } |
| 82 | 82 |
| 83 } // namespace content | 83 } // namespace content |
| OLD | NEW |