| Index: chrome/browser/media_galleries/linux/mtp_device_delegate_impl_linux.h
|
| diff --git a/chrome/browser/media_galleries/linux/mtp_device_delegate_impl_linux.h b/chrome/browser/media_galleries/linux/mtp_device_delegate_impl_linux.h
|
| index eba37039e8281803547dc683055d15a36210c374..58bf1712fa0f4ab9ecc440b76a7c8d19c9fe8e0b 100644
|
| --- a/chrome/browser/media_galleries/linux/mtp_device_delegate_impl_linux.h
|
| +++ b/chrome/browser/media_galleries/linux/mtp_device_delegate_impl_linux.h
|
| @@ -64,6 +64,8 @@ class MTPDeviceDelegateImplLinux : public MTPDeviceAsyncDelegate {
|
| // Maps file paths to file info.
|
| typedef std::map<base::FilePath, storage::DirectoryEntry> FileInfoCache;
|
|
|
| + typedef base::Closure DeleteObjectSuccessCallback;
|
| +
|
| // Should only be called by CreateMTPDeviceAsyncDelegate() factory call.
|
| // Defer the device initializations until the first file operation request.
|
| // Do all the initializations in EnsureInitAndRunTask() function.
|
| @@ -92,12 +94,18 @@ class MTPDeviceDelegateImplLinux : public MTPDeviceAsyncDelegate {
|
| int buf_len,
|
| const ReadBytesSuccessCallback& success_callback,
|
| const ErrorCallback& error_callback) override;
|
| - bool IsReadOnly() override;
|
| + bool IsReadOnly() const override;
|
| void CopyFileFromLocal(
|
| const base::FilePath& source_file_path,
|
| const base::FilePath& device_file_path,
|
| const CopyFileFromLocalSuccessCallback& success_callback,
|
| const ErrorCallback& error_callback) override;
|
| + void DeleteFile(const base::FilePath& file_path,
|
| + const DeleteFileSuccessCallback& success_callback,
|
| + const ErrorCallback& error_callback) override;
|
| + void DeleteDirectory(const base::FilePath& file_path,
|
| + const DeleteDirectorySuccessCallback& success_callback,
|
| + const ErrorCallback& error_callback) override;
|
| void CancelPendingTasksAndDeleteDelegate() override;
|
|
|
| // The internal methods correspond to the similarly named methods above.
|
| @@ -125,6 +133,29 @@ class MTPDeviceDelegateImplLinux : public MTPDeviceAsyncDelegate {
|
| const CopyFileFromLocalSuccessCallback& success_callback,
|
| const ErrorCallback& error_callback,
|
| const int source_file_descriptor);
|
| + virtual void DeleteFileInternal(
|
| + const base::FilePath& file_path,
|
| + const DeleteFileSuccessCallback& success_callback,
|
| + const ErrorCallback& error_callback,
|
| + const base::File::Info& file_info);
|
| + virtual void DeleteDirectoryInternal(
|
| + const base::FilePath& file_path,
|
| + const DeleteDirectorySuccessCallback& success_callback,
|
| + const ErrorCallback& error_callback,
|
| + const base::File::Info& file_info);
|
| +
|
| + // Called when ReadDirectoryEntryIds succeeds.
|
| + virtual void OnDidReadDirectoryEntryIdsToDeleteDirectory(
|
| + const uint32 directory_id,
|
| + const DeleteDirectorySuccessCallback& success_callback,
|
| + const ErrorCallback& error_callback,
|
| + const std::vector<uint32>& file_ids);
|
| +
|
| + // Calls DeleteObjectOnUIThread on UI thread.
|
| + virtual void RunDeleteObjectOnUIThread(
|
| + const uint32 object_id,
|
| + const DeleteObjectSuccessCallback& success_callback,
|
| + const ErrorCallback& error_callback);
|
|
|
| // Ensures the device is initialized for communication.
|
| // If the device is already initialized, call RunTask().
|
| @@ -245,6 +276,14 @@ class MTPDeviceDelegateImplLinux : public MTPDeviceAsyncDelegate {
|
| const int source_file_descriptor,
|
| base::File::Error error);
|
|
|
| + // Called when DeleteObject() succeeds.
|
| + void OnDidDeleteObject(const uint32 object_id,
|
| + const DeleteObjectSuccessCallback success_callback);
|
| +
|
| + // Called when DeleteFileOrDirectory() fails.
|
| + void HandleDeleteFileOrDirectoryError(const ErrorCallback& error_callback,
|
| + base::File::Error error);
|
| +
|
| // Handles the device file |error| while operating on |file_id|.
|
| // |error_callback| is invoked to notify the caller about the file error.
|
| void HandleDeviceFileError(const ErrorCallback& error_callback,
|
| @@ -265,6 +304,9 @@ class MTPDeviceDelegateImplLinux : public MTPDeviceAsyncDelegate {
|
| // and return true.
|
| bool CachedPathToId(const base::FilePath& path, uint32* id) const;
|
|
|
| + // Evict the cache of |id|.
|
| + void EvictCachedPathToId(const uint32 id);
|
| +
|
| // MTP device initialization state.
|
| InitializationState init_state_;
|
|
|
|
|