| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/browser/media/cdm_service_impl.h" | 5 #include "content/browser/media/cdm_registry_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "content/public/common/cdm_info.h" | 9 #include "content/public/common/cdm_info.h" |
| 10 #include "content/public/common/content_client.h" | 10 #include "content/public/common/content_client.h" |
| 11 | 11 |
| 12 namespace content { | 12 namespace content { |
| 13 | 13 |
| 14 static base::LazyInstance<CdmServiceImpl>::Leaky g_cdm_service = | 14 static base::LazyInstance<CdmRegistryImpl>::Leaky g_cdm_registry = |
| 15 LAZY_INSTANCE_INITIALIZER; | 15 LAZY_INSTANCE_INITIALIZER; |
| 16 | 16 |
| 17 // static | 17 // static |
| 18 CdmService* CdmService::GetInstance() { | 18 CdmRegistry* CdmRegistry::GetInstance() { |
| 19 return CdmServiceImpl::GetInstance(); | 19 return CdmRegistryImpl::GetInstance(); |
| 20 } | 20 } |
| 21 | 21 |
| 22 // static | 22 // static |
| 23 CdmServiceImpl* CdmServiceImpl::GetInstance() { | 23 CdmRegistryImpl* CdmRegistryImpl::GetInstance() { |
| 24 return g_cdm_service.Pointer(); | 24 return g_cdm_registry.Pointer(); |
| 25 } | 25 } |
| 26 | 26 |
| 27 CdmServiceImpl::CdmServiceImpl() {} | 27 CdmRegistryImpl::CdmRegistryImpl() {} |
| 28 | 28 |
| 29 CdmServiceImpl::~CdmServiceImpl() {} | 29 CdmRegistryImpl::~CdmRegistryImpl() {} |
| 30 | 30 |
| 31 void CdmServiceImpl::Init() { | 31 void CdmRegistryImpl::Init() { |
| 32 // Let embedders register CDMs. | 32 // Let embedders register CDMs. |
| 33 GetContentClient()->AddContentDecryptionModules(&cdms_); | 33 GetContentClient()->AddContentDecryptionModules(&cdms_); |
| 34 } | 34 } |
| 35 | 35 |
| 36 void CdmServiceImpl::RegisterCdm(const CdmInfo& info) { | 36 void CdmRegistryImpl::RegisterCdm(const CdmInfo& info) { |
| 37 // Always register new CDMs at the beginning of the list, so that | 37 // Always register new CDMs at the beginning of the list, so that |
| 38 // subsequent requests get the latest. | 38 // subsequent requests get the latest. |
| 39 cdms_.insert(cdms_.begin(), info); | 39 cdms_.insert(cdms_.begin(), info); |
| 40 } | 40 } |
| 41 | 41 |
| 42 const std::vector<CdmInfo>& CdmServiceImpl::GetAllRegisteredCdms() { | 42 const std::vector<CdmInfo>& CdmRegistryImpl::GetAllRegisteredCdms() { |
| 43 return cdms_; | 43 return cdms_; |
| 44 } | 44 } |
| 45 | 45 |
| 46 } // namespace media | 46 } // namespace media |
| OLD | NEW |