// Copyright 2018 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 device.mojom; import "services/device/public/mojom/mtp_file_entry.mojom"; import "services/device/public/mojom/mtp_storage_info.mojom"; interface MtpManagerClient { // Notifies the client that a storage is attached. StorageAttached(MtpStorageInfo storage_info); // Notifies the client that a storage is detached. StorageDetached(string storage_name); }; interface MtpManager { // This is a combined interface to get existing storages and set a // client for incoming storage change events. It is designed to reduce // async calls and eliminate a potential race condition between // the client being set and storage updates being made. EnumerateStoragesAndSetClient(associated MtpManagerClient client) => (array storages); // Gets storage metadata for |storage_name|. GetStorageInfo(string storage_name) => (MtpStorageInfo storage_info); // Reads the metadata of |storage_name| from device. GetStorageInfoFromDevice(string storage_name) => (MtpStorageInfo storage_info, bool error); // Opens |storage_name| in |mode|. OpenStorage(string storage_name, string mode) => (string storage_handle, bool error); // Closes |storage_handle|. CloseStorage(string storage_handle) => (bool error); // Creates |directory_name| in |parent_id|. CreateDirectory(string storage_handle, uint32 parent_id, string directory_name) => (bool error); // Reads the directory listing for |file_id| and returns the list of file ids. ReadDirectoryEntryIds(string storage_handle, uint32 file_id) => (array file_ids, bool error); // Reads file data from |file_id| on |storage_handle|. // Reads |count| bytes of data starting at |offset|. ReadFileChunk(string storage_handle, uint32 file_id, uint32 offset, uint32 count) => (string data, bool error); // Gets the file metadata for entries in |file_ids| on |storage_handle|. // Only do so for the |entries_to_read| number of entries in |file_ids| // starting at 0-based |offset|. GetFileInfo(string storage_handle, array file_ids, uint32 offset, uint32 entries_to_read) => (array file_entries, bool error); // Renames |object_id| to |new_name|. RenameObject(string storage_handle, uint32 object_id, string new_name) => (bool error); // Copies the file from |source_file_descriptor| to |file_name| on // |parent_id|. CopyFileFromLocal(string storage_handle, int64 source_file_descriptor, uint32 parent_id, string file_name) => (bool error); // Deletes |object_id|. DeleteObject(string storage_handle, uint32 object_id) => (bool error); };