OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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 #ifndef MEDIA_MOJO_SERVICES_MOJO_CDM_SERVICE_CONTEXT_H_ |
| 6 #define MEDIA_MOJO_SERVICES_MOJO_CDM_SERVICE_CONTEXT_H_ |
| 7 |
| 8 #include "base/containers/scoped_ptr_hash_map.h" |
| 9 #include "base/macros.h" |
| 10 #include "media/base/media_export.h" |
| 11 #include "media/mojo/services/mojo_cdm_service.h" |
| 12 |
| 13 namespace media { |
| 14 |
| 15 // A class that creates, owns and manages all MojoCdmService instances. |
| 16 class MEDIA_EXPORT MojoCdmServiceContext { |
| 17 public: |
| 18 MojoCdmServiceContext(); |
| 19 ~MojoCdmServiceContext(); |
| 20 |
| 21 // Creates and returns a MojoCdmService for |key_system|, |security_origin| |
| 22 // and |cdm_id|. The returned MojoCdmService is owned by |this|. Returns |
| 23 // nullptr if no MojoCdmService can be created. |
| 24 MojoCdmService* Create(const mojo::String& key_system, |
| 25 const mojo::String& security_origin, |
| 26 int32_t cdm_id); |
| 27 |
| 28 // Returns the CdmContext of the MojoCdmService associated with |cdm_id|. |
| 29 // Returns nullptr if no MojoCdmService is associated with |cdm_id|. |
| 30 CdmContext* GetCdmContext(int32_t cdm_id); |
| 31 |
| 32 // Called when there is a connection error with |service|. |
| 33 void ServiceHadConnectionError(MojoCdmService* service); |
| 34 |
| 35 private: |
| 36 // A map between CDM IDs and MojoCdnServices, which owns all |
| 37 // MojoCdmServices created. |
| 38 base::ScopedPtrHashMap<int32_t, MojoCdmService> services_; |
| 39 |
| 40 DISALLOW_COPY_AND_ASSIGN(MojoCdmServiceContext); |
| 41 }; |
| 42 |
| 43 } // namespace media |
| 44 |
| 45 #endif // MEDIA_MOJO_SERVICES_MOJO_CDM_SERVICE_CONTEXT_H_ |
OLD | NEW |