Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(604)

Side by Side Diff: device/media_transfer_protocol/media_transfer_protocol_manager.h

Issue 982283002: Implement DeleteFile and DeleteDirectory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 DEVICE_MEDIA_TRANSFER_PROTOCOL_MEDIA_TRANSFER_PROTOCOL_MANAGER_H_ 5 #ifndef DEVICE_MEDIA_TRANSFER_PROTOCOL_MEDIA_TRANSFER_PROTOCOL_MANAGER_H_
6 #define DEVICE_MEDIA_TRANSFER_PROTOCOL_MEDIA_TRANSFER_PROTOCOL_MANAGER_H_ 6 #define DEVICE_MEDIA_TRANSFER_PROTOCOL_MEDIA_TRANSFER_PROTOCOL_MANAGER_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 // A callback to handle the result of GetFileInfo. 56 // A callback to handle the result of GetFileInfo.
57 // The first argument is a file entry. 57 // The first argument is a file entry.
58 // The second argument is true if there was an error. 58 // The second argument is true if there was an error.
59 typedef base::Callback<void(const MtpFileEntry& file_entry, 59 typedef base::Callback<void(const MtpFileEntry& file_entry,
60 bool error)> GetFileInfoCallback; 60 bool error)> GetFileInfoCallback;
61 61
62 // A callback to handle the result of CopyFileFromLocal. 62 // A callback to handle the result of CopyFileFromLocal.
63 // The first argument is true if there was an error. 63 // The first argument is true if there was an error.
64 typedef base::Callback<void(bool error)> CopyFileFromLocalCallback; 64 typedef base::Callback<void(bool error)> CopyFileFromLocalCallback;
65 65
66 // A callback to handle the result of DeleteObject.
67 // The first argument is true if there was an error.
68 typedef base::Callback<void(bool error)> DeleteObjectCallback;
69
66 // Implement this interface to be notified about MTP storage 70 // Implement this interface to be notified about MTP storage
67 // attachment / detachment events. 71 // attachment / detachment events.
68 class Observer { 72 class Observer {
69 public: 73 public:
70 virtual ~Observer() {} 74 virtual ~Observer() {}
71 75
72 // A function called after a MTP storage has been attached / detached. 76 // A function called after a MTP storage has been attached / detached.
73 virtual void StorageChanged(bool is_attached, 77 virtual void StorageChanged(bool is_attached,
74 const std::string& storage_name) = 0; 78 const std::string& storage_name) = 0;
75 }; 79 };
(...skipping 17 matching lines...) Expand all
93 // Opens |storage_name| in |mode| and runs |callback|. 97 // Opens |storage_name| in |mode| and runs |callback|.
94 virtual void OpenStorage(const std::string& storage_name, 98 virtual void OpenStorage(const std::string& storage_name,
95 const std::string& mode, 99 const std::string& mode,
96 const OpenStorageCallback& callback) = 0; 100 const OpenStorageCallback& callback) = 0;
97 101
98 // Close |storage_handle| and runs |callback|. 102 // Close |storage_handle| and runs |callback|.
99 virtual void CloseStorage(const std::string& storage_handle, 103 virtual void CloseStorage(const std::string& storage_handle,
100 const CloseStorageCallback& callback) = 0; 104 const CloseStorageCallback& callback) = 0;
101 105
102 // Reads directory entries from |file_id| on |storage_handle| and runs 106 // Reads directory entries from |file_id| on |storage_handle| and runs
103 // |callback|. 107 // |callback|. |max_size| is a maximum number of files to be read.
104 virtual void ReadDirectory(const std::string& storage_handle, 108 virtual void ReadDirectory(const std::string& storage_handle,
105 uint32 file_id, 109 const uint32 file_id,
110 const size_t max_size,
106 const ReadDirectoryCallback& callback) = 0; 111 const ReadDirectoryCallback& callback) = 0;
107 112
108 // Reads file data from |file_id| on |storage_handle| and runs |callback|. 113 // Reads file data from |file_id| on |storage_handle| and runs |callback|.
109 // Reads |count| bytes of data starting at |offset|. 114 // Reads |count| bytes of data starting at |offset|.
110 virtual void ReadFileChunk(const std::string& storage_handle, 115 virtual void ReadFileChunk(const std::string& storage_handle,
111 uint32 file_id, 116 uint32 file_id,
112 uint32 offset, 117 uint32 offset,
113 uint32 count, 118 uint32 count,
114 const ReadFileCallback& callback) = 0; 119 const ReadFileCallback& callback) = 0;
115 120
116 // Gets the file metadata for |file_id| on |storage_handle| and runs 121 // Gets the file metadata for |file_id| on |storage_handle| and runs
117 // |callback|. 122 // |callback|.
118 virtual void GetFileInfo(const std::string& storage_handle, 123 virtual void GetFileInfo(const std::string& storage_handle,
119 uint32 file_id, 124 uint32 file_id,
120 const GetFileInfoCallback& callback) = 0; 125 const GetFileInfoCallback& callback) = 0;
121 126
122 // Copies the file from |source_file_descriptor| to |file_name| on 127 // Copies the file from |source_file_descriptor| to |file_name| on
123 // |parent_id|. 128 // |parent_id|.
124 virtual void CopyFileFromLocal(const std::string& storage_handle, 129 virtual void CopyFileFromLocal(const std::string& storage_handle,
125 const int source_file_descriptor, 130 const int source_file_descriptor,
126 const uint32 parent_id, 131 const uint32 parent_id,
127 const std::string& file_name, 132 const std::string& file_name,
128 const CopyFileFromLocalCallback& callback) = 0; 133 const CopyFileFromLocalCallback& callback) = 0;
129 134
135 // Deletes |object_id|.
136 virtual void DeleteObject(const std::string& storage_handle,
137 const uint32 object_id,
138 const DeleteObjectCallback& callback) = 0;
139
130 // Creates and returns the global MediaTransferProtocolManager instance. 140 // Creates and returns the global MediaTransferProtocolManager instance.
131 // On Linux, |task_runner| specifies the task runner to process asynchronous 141 // On Linux, |task_runner| specifies the task runner to process asynchronous
132 // operations. 142 // operations.
133 // On ChromeOS, |task_runner| should just be set to NULL because ChromeOS 143 // On ChromeOS, |task_runner| should just be set to NULL because ChromeOS
134 // already has a dedicated message loop proxy. 144 // already has a dedicated message loop proxy.
135 static MediaTransferProtocolManager* Initialize( 145 static MediaTransferProtocolManager* Initialize(
136 scoped_refptr<base::SequencedTaskRunner> task_runner); 146 scoped_refptr<base::SequencedTaskRunner> task_runner);
137 }; 147 };
138 148
139 } // namespace device 149 } // namespace device
140 150
141 #endif // DEVICE_MEDIA_TRANSFER_PROTOCOL_MEDIA_TRANSFER_PROTOCOL_MANAGER_H_ 151 #endif // DEVICE_MEDIA_TRANSFER_PROTOCOL_MEDIA_TRANSFER_PROTOCOL_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698