| // Copyright 2017 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| module media.mojom; |
| |
| import "mojo/common/file.mojom"; |
| |
| // Provides a way to organize persistent per-origin/per-cdm-type data |
| // in the browser's file system. |
| interface CdmStorage { |
| enum Status { |
| kSuccess, // File was successfully opened. |
| kInUse, // File is already open by another client. |
| kFailure // Unable to open file. |
| }; |
| |
| // Opens the file specified by |file_name| for read or write. Can be called |
| // multiple times for different files, or for the same file if the first one |
| // has been closed. If successful, kSuccess will be returned, |file| can |
| // be used to access the contents, and |releaser| should be closed when |
| // access to the file is no longer needed (i.e. file closed). On failure, |
| // |status| <> kSuccess and |file| and |releaser| are null. |
| // - If the file is already opened by another CDM instance, kInUse will |
| // be returned in |status|. |
| // - |file_name| must not contain forward slash ('/') or backslash ('\'), |
| // and must not start with an underscore ('_'). If this happens, |
| // |status| == kFailure is returned. |
| // - if |key_system| passed to Initialize() is not recognized, kFailure |
| // will be returned. |
| Open(string file_name) |
| => (Status status, |
| mojo.common.mojom.File? file, |
| associated CdmFileReleaser? releaser); |
| }; |
| |
| // Provides a way to keep track of the file opened. When the connection to this |
| // object is broken, it is assumed that the file has been closed and that no |
| // more operations will be performed on it. |
| interface CdmFileReleaser { |
| }; |