| 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/cdm/render_cdm_factory.h" | 5 #include "content/renderer/media/cdm/render_cdm_factory.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
| 13 #include "base/threading/thread_task_runner_handle.h" | 13 #include "base/threading/thread_task_runner_handle.h" |
| 14 #include "media/base/cdm_config.h" | 14 #include "media/base/cdm_config.h" |
| 15 #include "media/base/cdm_promise.h" | 15 #include "media/base/cdm_promise.h" |
| 16 #include "media/base/content_decryption_module.h" |
| 16 #include "media/base/key_systems.h" | 17 #include "media/base/key_systems.h" |
| 17 #include "media/base/media_keys.h" | |
| 18 #include "media/cdm/aes_decryptor.h" | 18 #include "media/cdm/aes_decryptor.h" |
| 19 #include "ppapi/features/features.h" | 19 #include "ppapi/features/features.h" |
| 20 #include "url/gurl.h" | 20 #include "url/gurl.h" |
| 21 | 21 |
| 22 #if BUILDFLAG(ENABLE_PEPPER_CDMS) | 22 #if BUILDFLAG(ENABLE_PEPPER_CDMS) |
| 23 #include "content/renderer/media/cdm/ppapi_decryptor.h" | 23 #include "content/renderer/media/cdm/ppapi_decryptor.h" |
| 24 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS) | 24 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS) |
| 25 | 25 |
| 26 namespace content { | 26 namespace content { |
| 27 | 27 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 50 | 50 |
| 51 if (!security_origin.is_valid()) { | 51 if (!security_origin.is_valid()) { |
| 52 base::ThreadTaskRunnerHandle::Get()->PostTask( | 52 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 53 FROM_HERE, base::Bind(cdm_created_cb, nullptr, "Invalid origin.")); | 53 FROM_HERE, base::Bind(cdm_created_cb, nullptr, "Invalid origin.")); |
| 54 return; | 54 return; |
| 55 } | 55 } |
| 56 | 56 |
| 57 if (media::CanUseAesDecryptor(key_system)) { | 57 if (media::CanUseAesDecryptor(key_system)) { |
| 58 DCHECK(!cdm_config.allow_distinctive_identifier); | 58 DCHECK(!cdm_config.allow_distinctive_identifier); |
| 59 DCHECK(!cdm_config.allow_persistent_state); | 59 DCHECK(!cdm_config.allow_persistent_state); |
| 60 scoped_refptr<media::MediaKeys> cdm( | 60 scoped_refptr<media::ContentDecryptionModule> cdm( |
| 61 new media::AesDecryptor(security_origin, session_message_cb, | 61 new media::AesDecryptor(security_origin, session_message_cb, |
| 62 session_closed_cb, session_keys_change_cb)); | 62 session_closed_cb, session_keys_change_cb)); |
| 63 base::ThreadTaskRunnerHandle::Get()->PostTask( | 63 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 64 FROM_HERE, base::Bind(cdm_created_cb, cdm, "")); | 64 FROM_HERE, base::Bind(cdm_created_cb, cdm, "")); |
| 65 return; | 65 return; |
| 66 } | 66 } |
| 67 | 67 |
| 68 #if BUILDFLAG(ENABLE_PEPPER_CDMS) | 68 #if BUILDFLAG(ENABLE_PEPPER_CDMS) |
| 69 DCHECK(!cdm_config.use_hw_secure_codecs); | 69 DCHECK(!cdm_config.use_hw_secure_codecs); |
| 70 PpapiDecryptor::Create( | 70 PpapiDecryptor::Create( |
| 71 key_system, security_origin, cdm_config.allow_distinctive_identifier, | 71 key_system, security_origin, cdm_config.allow_distinctive_identifier, |
| 72 cdm_config.allow_persistent_state, create_pepper_cdm_cb_, | 72 cdm_config.allow_persistent_state, create_pepper_cdm_cb_, |
| 73 session_message_cb, session_closed_cb, session_keys_change_cb, | 73 session_message_cb, session_closed_cb, session_keys_change_cb, |
| 74 session_expiration_update_cb, cdm_created_cb); | 74 session_expiration_update_cb, cdm_created_cb); |
| 75 #else | 75 #else |
| 76 // No possible CDM to create, so fail the request. | 76 // No possible CDM to create, so fail the request. |
| 77 base::ThreadTaskRunnerHandle::Get()->PostTask( | 77 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 78 FROM_HERE, | 78 FROM_HERE, |
| 79 base::Bind(cdm_created_cb, nullptr, "Key system not supported.")); | 79 base::Bind(cdm_created_cb, nullptr, "Key system not supported.")); |
| 80 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS) | 80 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS) |
| 81 } | 81 } |
| 82 | 82 |
| 83 } // namespace content | 83 } // namespace content |
| OLD | NEW |