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 #ifndef CONTENT_COMMON_MEDIA_CDM_HOST_FILES_H_ | 5 #ifndef CONTENT_COMMON_MEDIA_CDM_HOST_FILES_H_ |
6 #define CONTENT_COMMON_MEDIA_CDM_HOST_FILES_H_ | 6 #define CONTENT_COMMON_MEDIA_CDM_HOST_FILES_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <vector> | 10 #include <vector> |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 // be nullptr if CreateGlobalInstance() failed. | 52 // be nullptr if CreateGlobalInstance() failed. |
53 static std::unique_ptr<CdmHostFiles> TakeGlobalInstance(); | 53 static std::unique_ptr<CdmHostFiles> TakeGlobalInstance(); |
54 #endif | 54 #endif |
55 | 55 |
56 // Opens CDM host files for the CDM adapter at |cdm_adapter_path| and returns | 56 // Opens CDM host files for the CDM adapter at |cdm_adapter_path| and returns |
57 // the created CdmHostFiles instance. Returns nullptr if any of the files | 57 // the created CdmHostFiles instance. Returns nullptr if any of the files |
58 // cannot be opened, in which case no file will be left open. | 58 // cannot be opened, in which case no file will be left open. |
59 static std::unique_ptr<CdmHostFiles> Create( | 59 static std::unique_ptr<CdmHostFiles> Create( |
60 const base::FilePath& cdm_adapter_path); | 60 const base::FilePath& cdm_adapter_path); |
61 | 61 |
62 // Verifies |cdm_adapter_path| CDM files by calling the function exported | 62 // Initializes the verification of CDM files by calling the function exported |
63 // by the CDM. If unexpected error happens, all files will be closed. | 63 // by the CDM. If unexpected error happens, all files will be closed. |
64 // Otherwise, the PlatformFiles are passed to the CDM which will close the | 64 // Otherwise, the PlatformFiles are passed to the CDM which will close the |
65 // files later. | 65 // files later. |
66 // Only returns false if the CDM returns false (when there's an immediate | 66 // Only returns false if the CDM returns false (when there's an immediate |
67 // failure). Otherwise always returns true for backward compatibility, e.g. | 67 // failure). Otherwise always returns true for backward compatibility, e.g. |
68 // when using an old CDM which doesn't implement the verification API. | 68 // when using an old CDM which doesn't implement the verification API. |
69 bool VerifyFiles(base::NativeLibrary cdm_adapter_library, | 69 bool InitVerification(base::NativeLibrary cdm_adapter_library, |
70 const base::FilePath& cdm_adapter_path); | 70 const base::FilePath& cdm_adapter_path); |
71 | 71 |
72 private: | 72 private: |
73 #if defined(POSIX_WITH_ZYGOTE) | 73 #if defined(POSIX_WITH_ZYGOTE) |
74 // Opens all common files and CDM specific files for all registered CDMs. | 74 // Opens all common files and CDM specific files for all registered CDMs. |
75 void OpenFilesForAllRegisteredCdms(); | 75 void OpenFilesForAllRegisteredCdms(); |
76 #endif | 76 #endif |
77 | 77 |
78 // Opens all common files and CDM specific files for the CDM adapter | 78 // Opens all common files and CDM specific files for the CDM adapter |
79 // registered at |cdm_adapter_path|. | 79 // registered at |cdm_adapter_path|. |
80 void OpenFiles(const base::FilePath& cdm_adapter_path); | 80 void OpenFiles(const base::FilePath& cdm_adapter_path); |
(...skipping 16 matching lines...) Expand all Loading... |
97 ScopedFileVector common_files_; | 97 ScopedFileVector common_files_; |
98 std::map<base::FilePath, ScopedFileVector> cdm_specific_files_map_; | 98 std::map<base::FilePath, ScopedFileVector> cdm_specific_files_map_; |
99 }; | 99 }; |
100 | 100 |
101 // Returns whether the |cdm_adapter_path| corresponds to a known CDM. | 101 // Returns whether the |cdm_adapter_path| corresponds to a known CDM. |
102 bool IsCdm(const base::FilePath& cdm_adapter_path); | 102 bool IsCdm(const base::FilePath& cdm_adapter_path); |
103 | 103 |
104 } // namespace content | 104 } // namespace content |
105 | 105 |
106 #endif // CONTENT_COMMON_MEDIA_CDM_HOST_FILES_H_ | 106 #endif // CONTENT_COMMON_MEDIA_CDM_HOST_FILES_H_ |
OLD | NEW |