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