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/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 base::ThreadTaskRunnerHandle::Get()->PostTask( | 58 base::ThreadTaskRunnerHandle::Get()->PostTask( |
59 FROM_HERE, base::Bind(cdm_created_cb, nullptr, "Invalid origin.")); | 59 FROM_HERE, base::Bind(cdm_created_cb, nullptr, "Invalid origin.")); |
60 return; | 60 return; |
61 } | 61 } |
62 | 62 |
63 if (media::CanUseAesDecryptor(key_system)) { | 63 if (media::CanUseAesDecryptor(key_system)) { |
64 // TODO(sandersd): Currently the prefixed API always allows distinctive | 64 // TODO(sandersd): Currently the prefixed API always allows distinctive |
65 // identifiers and persistent state. Once that changes we can sanity check | 65 // identifiers and persistent state. Once that changes we can sanity check |
66 // here that neither is allowed for AesDecryptor, since it does not support | 66 // here that neither is allowed for AesDecryptor, since it does not support |
67 // them and should never be configured that way. http://crbug.com/455271 | 67 // them and should never be configured that way. http://crbug.com/455271 |
68 scoped_ptr<media::MediaKeys> cdm( | 68 scoped_refptr<media::MediaKeys> cdm( |
69 new media::AesDecryptor(security_origin, session_message_cb, | 69 new media::AesDecryptor(security_origin, session_message_cb, |
70 session_closed_cb, session_keys_change_cb)); | 70 session_closed_cb, session_keys_change_cb)); |
71 base::ThreadTaskRunnerHandle::Get()->PostTask( | 71 base::ThreadTaskRunnerHandle::Get()->PostTask( |
72 FROM_HERE, base::Bind(cdm_created_cb, base::Passed(&cdm), "")); | 72 FROM_HERE, base::Bind(cdm_created_cb, cdm, "")); |
73 return; | 73 return; |
74 } | 74 } |
75 | 75 |
76 #if defined(ENABLE_PEPPER_CDMS) | 76 #if defined(ENABLE_PEPPER_CDMS) |
77 DCHECK(!cdm_config.use_hw_secure_codecs); | 77 DCHECK(!cdm_config.use_hw_secure_codecs); |
78 PpapiDecryptor::Create( | 78 PpapiDecryptor::Create( |
79 key_system, security_origin, cdm_config.allow_distinctive_identifier, | 79 key_system, security_origin, cdm_config.allow_distinctive_identifier, |
80 cdm_config.allow_persistent_state, create_pepper_cdm_cb_, | 80 cdm_config.allow_persistent_state, create_pepper_cdm_cb_, |
81 session_message_cb, session_closed_cb, legacy_session_error_cb, | 81 session_message_cb, session_closed_cb, legacy_session_error_cb, |
82 session_keys_change_cb, session_expiration_update_cb, cdm_created_cb); | 82 session_keys_change_cb, session_expiration_update_cb, cdm_created_cb); |
83 #elif defined(ENABLE_BROWSER_CDMS) | 83 #elif defined(ENABLE_BROWSER_CDMS) |
84 DCHECK(cdm_config.allow_distinctive_identifier); | 84 DCHECK(cdm_config.allow_distinctive_identifier); |
85 DCHECK(cdm_config.allow_persistent_state); | 85 DCHECK(cdm_config.allow_persistent_state); |
86 ProxyMediaKeys::Create( | 86 ProxyMediaKeys::Create( |
87 key_system, security_origin, cdm_config.use_hw_secure_codecs, manager_, | 87 key_system, security_origin, cdm_config.use_hw_secure_codecs, manager_, |
88 session_message_cb, session_closed_cb, legacy_session_error_cb, | 88 session_message_cb, session_closed_cb, legacy_session_error_cb, |
89 session_keys_change_cb, session_expiration_update_cb, cdm_created_cb); | 89 session_keys_change_cb, session_expiration_update_cb, cdm_created_cb); |
90 #else | 90 #else |
91 // No possible CDM to create, so fail the request. | 91 // No possible CDM to create, so fail the request. |
92 base::ThreadTaskRunnerHandle::Get()->PostTask( | 92 base::ThreadTaskRunnerHandle::Get()->PostTask( |
93 FROM_HERE, | 93 FROM_HERE, |
94 base::Bind(cdm_created_cb, nullptr, "Key system not supported.")); | 94 base::Bind(cdm_created_cb, nullptr, "Key system not supported.")); |
95 #endif // defined(ENABLE_PEPPER_CDMS) | 95 #endif // defined(ENABLE_PEPPER_CDMS) |
96 } | 96 } |
97 | 97 |
98 } // namespace content | 98 } // namespace content |
OLD | NEW |