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_COMMON_MEDIA_CDM_HOST_FILE_H_ |
| 6 #define CONTENT_COMMON_MEDIA_CDM_HOST_FILE_H_ |
| 7 |
| 8 #include <memory> |
| 9 |
| 10 #include "base/files/file.h" |
| 11 #include "base/files/file_path.h" |
| 12 #include "base/macros.h" |
| 13 |
| 14 namespace cdm { |
| 15 struct HostFile; |
| 16 } |
| 17 |
| 18 namespace content { |
| 19 |
| 20 // Represents a file that participated in hosting the CDM. |
| 21 class CdmHostFile { |
| 22 public: |
| 23 // Opens the file at |file_path| and the corresponding signature file at |
| 24 // |sig_file_path|. Upon success, constructs and returns a CdmHostFile object. |
| 25 // Otherwise returns nullptr. The opened files are closed when |this| is |
| 26 // destructed unless TakePlatformFile() was called, in which case the caller |
| 27 // must make sure the files are closed properly. |
| 28 static std::unique_ptr<CdmHostFile> Create( |
| 29 const base::FilePath& file_path, |
| 30 const base::FilePath& sig_file_path); |
| 31 |
| 32 // Takes the PlatformFile of the |file_| and |sig_file_| and put them in the |
| 33 // returned cdm::HostFile. The caller must make sure the PlatformFiles are |
| 34 // properly closed after use. |
| 35 cdm::HostFile TakePlatformFile(); |
| 36 |
| 37 private: |
| 38 CdmHostFile(const base::FilePath& file_path, |
| 39 base::File file, |
| 40 base::File sig_file); |
| 41 |
| 42 base::FilePath file_path_; |
| 43 base::File file_; |
| 44 |
| 45 // The signature file associated with |file_|. |
| 46 base::File sig_file_; |
| 47 |
| 48 DISALLOW_COPY_AND_ASSIGN(CdmHostFile); |
| 49 }; |
| 50 |
| 51 } // namespace content |
| 52 |
| 53 #endif // CONTENT_COMMON_MEDIA_CDM_HOST_FILE_H_ |
OLD | NEW |