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/key_systems.h" | 16 #include "media/base/key_systems.h" |
17 #include "media/base/media_keys.h" | 17 #include "media/base/media_keys.h" |
18 #include "media/cdm/aes_decryptor.h" | 18 #include "media/cdm/aes_decryptor.h" |
19 #include "url/gurl.h" | 19 #include "url/gurl.h" |
20 #if defined(ENABLE_PEPPER_CDMS) | 20 #if defined(ENABLE_PEPPER_CDMS) |
21 #include "content/renderer/media/cdm/ppapi_decryptor.h" | 21 #include "content/renderer/media/cdm/ppapi_decryptor.h" |
22 #elif defined(ENABLE_BROWSER_CDMS) | |
23 #include "content/renderer/media/cdm/proxy_media_keys.h" | |
24 #endif // defined(ENABLE_PEPPER_CDMS) | 22 #endif // defined(ENABLE_PEPPER_CDMS) |
25 | 23 |
26 namespace content { | 24 namespace content { |
27 | 25 |
28 #if defined(ENABLE_PEPPER_CDMS) | 26 #if defined(ENABLE_PEPPER_CDMS) |
29 RenderCdmFactory::RenderCdmFactory( | 27 RenderCdmFactory::RenderCdmFactory( |
30 const CreatePepperCdmCB& create_pepper_cdm_cb) | 28 const CreatePepperCdmCB& create_pepper_cdm_cb) |
31 : create_pepper_cdm_cb_(create_pepper_cdm_cb) {} | 29 : create_pepper_cdm_cb_(create_pepper_cdm_cb) {} |
32 #elif defined(ENABLE_BROWSER_CDMS) | |
33 RenderCdmFactory::RenderCdmFactory(RendererCdmManager* manager) | |
34 : manager_(manager) {} | |
35 #else | 30 #else |
36 RenderCdmFactory::RenderCdmFactory() {} | 31 RenderCdmFactory::RenderCdmFactory() {} |
37 #endif // defined(ENABLE_PEPPER_CDMS) | 32 #endif // defined(ENABLE_PEPPER_CDMS) |
38 | 33 |
39 RenderCdmFactory::~RenderCdmFactory() { | 34 RenderCdmFactory::~RenderCdmFactory() { |
40 DCHECK(thread_checker_.CalledOnValidThread()); | 35 DCHECK(thread_checker_.CalledOnValidThread()); |
41 } | 36 } |
42 | 37 |
43 void RenderCdmFactory::Create( | 38 void RenderCdmFactory::Create( |
44 const std::string& key_system, | 39 const std::string& key_system, |
(...skipping 23 matching lines...) Expand all Loading... |
68 return; | 63 return; |
69 } | 64 } |
70 | 65 |
71 #if defined(ENABLE_PEPPER_CDMS) | 66 #if defined(ENABLE_PEPPER_CDMS) |
72 DCHECK(!cdm_config.use_hw_secure_codecs); | 67 DCHECK(!cdm_config.use_hw_secure_codecs); |
73 PpapiDecryptor::Create( | 68 PpapiDecryptor::Create( |
74 key_system, security_origin, cdm_config.allow_distinctive_identifier, | 69 key_system, security_origin, cdm_config.allow_distinctive_identifier, |
75 cdm_config.allow_persistent_state, create_pepper_cdm_cb_, | 70 cdm_config.allow_persistent_state, create_pepper_cdm_cb_, |
76 session_message_cb, session_closed_cb, session_keys_change_cb, | 71 session_message_cb, session_closed_cb, session_keys_change_cb, |
77 session_expiration_update_cb, cdm_created_cb); | 72 session_expiration_update_cb, cdm_created_cb); |
78 #elif defined(ENABLE_BROWSER_CDMS) | |
79 DCHECK(cdm_config.allow_distinctive_identifier); | |
80 DCHECK(cdm_config.allow_persistent_state); | |
81 ProxyMediaKeys::Create( | |
82 key_system, security_origin, cdm_config.use_hw_secure_codecs, manager_, | |
83 session_message_cb, session_closed_cb, session_keys_change_cb, | |
84 session_expiration_update_cb, cdm_created_cb); | |
85 #else | 73 #else |
86 // No possible CDM to create, so fail the request. | 74 // No possible CDM to create, so fail the request. |
87 base::ThreadTaskRunnerHandle::Get()->PostTask( | 75 base::ThreadTaskRunnerHandle::Get()->PostTask( |
88 FROM_HERE, | 76 FROM_HERE, |
89 base::Bind(cdm_created_cb, nullptr, "Key system not supported.")); | 77 base::Bind(cdm_created_cb, nullptr, "Key system not supported.")); |
90 #endif // defined(ENABLE_PEPPER_CDMS) | 78 #endif // defined(ENABLE_PEPPER_CDMS) |
91 } | 79 } |
92 | 80 |
93 } // namespace content | 81 } // namespace content |
OLD | NEW |