| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chromecast/browser/media/cast_browser_cdm_factory.h" | 5 #include "chromecast/browser/media/cast_browser_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/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "chromecast/media/cdm/cast_cdm.h" | 10 #include "chromecast/media/cdm/cast_cdm.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 | 46 |
| 47 DCHECK(!cdm_config.use_hw_secure_codecs) | 47 DCHECK(!cdm_config.use_hw_secure_codecs) |
| 48 << "Chromecast does not use |use_hw_secure_codecs|"; | 48 << "Chromecast does not use |use_hw_secure_codecs|"; |
| 49 | 49 |
| 50 CastKeySystem cast_key_system(GetKeySystemByName(key_system)); | 50 CastKeySystem cast_key_system(GetKeySystemByName(key_system)); |
| 51 | 51 |
| 52 scoped_refptr<chromecast::media::CastCdm> cast_cdm; | 52 scoped_refptr<chromecast::media::CastCdm> cast_cdm; |
| 53 if (cast_key_system == chromecast::media::KEY_SYSTEM_CLEAR_KEY) { | 53 if (cast_key_system == chromecast::media::KEY_SYSTEM_CLEAR_KEY) { |
| 54 // TODO(gunsch): handle ClearKey decryption. See crbug.com/441957 | 54 // TODO(gunsch): handle ClearKey decryption. See crbug.com/441957 |
| 55 } else { | 55 } else { |
| 56 cast_cdm = CreatePlatformBrowserCdm(cast_key_system); | 56 cast_cdm = CreatePlatformBrowserCdm(cast_key_system, security_origin); |
| 57 } | 57 } |
| 58 | 58 |
| 59 if (!cast_cdm) { | 59 if (!cast_cdm) { |
| 60 LOG(INFO) << "No matching key system found: " << cast_key_system; | 60 LOG(INFO) << "No matching key system found: " << cast_key_system; |
| 61 bound_cdm_created_cb.Run(nullptr, "No matching key system found."); | 61 bound_cdm_created_cb.Run(nullptr, "No matching key system found."); |
| 62 return; | 62 return; |
| 63 } | 63 } |
| 64 | 64 |
| 65 task_runner_->PostTask( | 65 task_runner_->PostTask( |
| 66 FROM_HERE, | 66 FROM_HERE, |
| 67 base::Bind(&CastCdm::Initialize, base::Unretained(cast_cdm.get()), | 67 base::Bind(&CastCdm::Initialize, base::Unretained(cast_cdm.get()), |
| 68 ::media::BindToCurrentLoop(session_message_cb), | 68 ::media::BindToCurrentLoop(session_message_cb), |
| 69 ::media::BindToCurrentLoop(session_closed_cb), | 69 ::media::BindToCurrentLoop(session_closed_cb), |
| 70 ::media::BindToCurrentLoop(legacy_session_error_cb), | 70 ::media::BindToCurrentLoop(legacy_session_error_cb), |
| 71 ::media::BindToCurrentLoop(session_keys_change_cb), | 71 ::media::BindToCurrentLoop(session_keys_change_cb), |
| 72 ::media::BindToCurrentLoop(session_expiration_update_cb))); | 72 ::media::BindToCurrentLoop(session_expiration_update_cb))); |
| 73 | 73 |
| 74 // When using Mojo media, we do not need to proxy calls to the CMA thread. All | 74 // When using Mojo media, we do not need to proxy calls to the CMA thread. All |
| 75 // calls are made on that thread already. | 75 // calls are made on that thread already. |
| 76 #if defined(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS) | 76 #if defined(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS) |
| 77 bound_cdm_created_cb.Run(cast_cdm, ""); | 77 bound_cdm_created_cb.Run(cast_cdm, ""); |
| 78 #else | 78 #else |
| 79 bound_cdm_created_cb.Run(new CastCdmProxy(cast_cdm, task_runner_), ""); | 79 bound_cdm_created_cb.Run(new CastCdmProxy(cast_cdm, task_runner_), ""); |
| 80 #endif // defined(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS) | 80 #endif // defined(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS) |
| 81 } | 81 } |
| 82 | 82 |
| 83 scoped_refptr<CastCdm> CastBrowserCdmFactory::CreatePlatformBrowserCdm( | 83 scoped_refptr<CastCdm> CastBrowserCdmFactory::CreatePlatformBrowserCdm( |
| 84 const CastKeySystem& cast_key_system) { | 84 const CastKeySystem& cast_key_system, |
| 85 const GURL& security_origin) { |
| 85 return nullptr; | 86 return nullptr; |
| 86 } | 87 } |
| 87 | 88 |
| 88 } // namespace media | 89 } // namespace media |
| 89 } // namespace chromecast | 90 } // namespace chromecast |
| OLD | NEW |