| 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 #ifndef CONTENT_PUBLIC_COMMON_CONTENT_DECRYPTION_MODULE_SERVICE_H_ |
| 6 #define CONTENT_PUBLIC_COMMON_CONTENT_DECRYPTION_MODULE_SERVICE_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/files/file_path.h" |
| 12 #include "base/lazy_instance.h" |
| 13 #include "base/macros.h" |
| 14 #include "base/strings/string16.h" |
| 15 #include "base/version.h" |
| 16 #include "content/common/content_export.h" |
| 17 #include "content/public/common/content_decryption_module_registration.h" |
| 18 |
| 19 namespace content { |
| 20 |
| 21 class CONTENT_EXPORT ContentDecryptionModuleService { |
| 22 public: |
| 23 // Returns the ContentDecryptionModuleService singleton. |
| 24 static ContentDecryptionModuleService* GetInstance(); |
| 25 |
| 26 // Registers |key_system|, replacing any entry that may exist for it (with |
| 27 // same |version|). |module_library_path| is the path to the actual CDM |
| 28 // (may be empty if the CDM is already included as part of the system), |
| 29 // and |supported_codecs| is the list of codecs supported by this CDM |
| 30 // (which may be none). |
| 31 void Register(const std::string& key_system, |
| 32 const std::string& version, |
| 33 const base::FilePath& module_library_path, |
| 34 const std::vector<base::string16>& supported_codecs, |
| 35 const std::vector<base::string16>& supported_init_data_types); |
| 36 |
| 37 // Determines if the CDM library path is set for |key_system| with specified |
| 38 // |version|. If |version| is empty, then the latest registered version of |
| 39 // |key_system| is used (if there is one). If found, true is returned and |
| 40 // |module_library_path| is updated. Otherwise false is returned and |
| 41 // |module_library_path| is unchanged. |
| 42 bool GetCdmLibraryPath(const std::string& key_system, |
| 43 const std::string& version, |
| 44 base::FilePath* module_library_path); |
| 45 |
| 46 // Determines the codecs set for |key_system| with specified |version|. |
| 47 // If |version| is empty, then the latest registered version of |key_system| |
| 48 // is used (if there is one). If found, true is returned and |
| 49 // |supported_codecs| is updated with the list of codecs registered for |
| 50 // |key_system| (which may be none). Otherwise false is returned and |
| 51 // |supported_codecs| is unchanged. |
| 52 bool GetSupportedCodecs(const std::string& key_system, |
| 53 const std::string& version, |
| 54 std::vector<base::string16>* supported_codecs); |
| 55 |
| 56 // Determines the InitDataType set for |key_system| with specified |version|. |
| 57 // If |version| is empty, then the latest registered version of |key_system| |
| 58 // is used (if there is one). If found, true is returned and |
| 59 // |supported_init_data_types| is updated with the list of InitDataTypes |
| 60 // registered for |key_system| (which may be none). Otherwise false is |
| 61 // returned and |supported_init_data_types| is unchanged. |
| 62 bool GetSupportedInitDataTypes( |
| 63 const std::string& key_system, |
| 64 const std::string& version, |
| 65 std::vector<base::string16>* supported_init_data_types); |
| 66 |
| 67 // Returns the list of all registered key systems and the matching path to |
| 68 // the library. Note that multiple key systems may use the same library, |
| 69 // so some of the paths in |key_systems| may be duplicated. Paths in |
| 70 // |key_systems| may also be empty if the CDM is already included as |
| 71 // part of the system. |
| 72 void GetAllRegisteredModules( |
| 73 std::vector<std::pair<std::string, base::FilePath>>* modules); |
| 74 |
| 75 private: |
| 76 friend struct base::DefaultLazyInstanceTraits<ContentDecryptionModuleService>; |
| 77 |
| 78 ContentDecryptionModuleService(); |
| 79 ~ContentDecryptionModuleService(); |
| 80 |
| 81 // Finds the entry in |registered_modules_| that matches |key_system| and |
| 82 // |version|. Returns NULL if not found. |
| 83 ContentDecryptionModuleRegistration* FindEntry(const std::string& key_system, |
| 84 const std::string& version); |
| 85 |
| 86 std::vector<ContentDecryptionModuleRegistration> registered_modules_; |
| 87 |
| 88 DISALLOW_COPY_AND_ASSIGN(ContentDecryptionModuleService); |
| 89 }; |
| 90 |
| 91 } // namespace content |
| 92 |
| 93 #endif // CONTENT_PUBLIC_COMMON_CONTENT_DECRYPTION_MODULE_SERVICE_H_ |
| OLD | NEW |