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

Side by Side Diff: device/media_transfer_protocol/media_transfer_protocol_daemon_client.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 // Client code to talk to the Media Transfer Protocol daemon. The MTP daemon is 5 // Client code to talk to the Media Transfer Protocol daemon. The MTP daemon is
6 // responsible for communicating with PTP / MTP capable devices like cameras 6 // responsible for communicating with PTP / MTP capable devices like cameras
7 // and smartphones. 7 // and smartphones.
8 8
9 #ifndef DEVICE_MEDIA_TRANSFER_PROTOCOL_MEDIA_TRANSFER_PROTOCOL_DAEMON_CLIENT_H_ 9 #ifndef DEVICE_MEDIA_TRANSFER_PROTOCOL_MEDIA_TRANSFER_PROTOCOL_DAEMON_CLIENT_H_
10 #define DEVICE_MEDIA_TRANSFER_PROTOCOL_MEDIA_TRANSFER_PROTOCOL_DAEMON_CLIENT_H_ 10 #define DEVICE_MEDIA_TRANSFER_PROTOCOL_MEDIA_TRANSFER_PROTOCOL_DAEMON_CLIENT_H_
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 typedef base::Callback<void(const std::vector<MtpFileEntry>& file_entries) 64 typedef base::Callback<void(const std::vector<MtpFileEntry>& file_entries)
65 > GetFileInfoCallback; 65 > GetFileInfoCallback;
66 66
67 // A callback to handle the result of ReadFileChunkById. 67 // A callback to handle the result of ReadFileChunkById.
68 // The argument is a string containing the file data. 68 // The argument is a string containing the file data.
69 typedef base::Callback<void(const std::string& data)> ReadFileCallback; 69 typedef base::Callback<void(const std::string& data)> ReadFileCallback;
70 70
71 // A callback to handle the result of CopyFileFromLocal. 71 // A callback to handle the result of CopyFileFromLocal.
72 typedef base::Closure CopyFileFromLocalCallback; 72 typedef base::Closure CopyFileFromLocalCallback;
73 73
74 // A callback to handle the result of DeleteObject.
75 typedef base::Closure DeleteObjectCallback;
76
74 // A callback to handle storage attach/detach events. 77 // A callback to handle storage attach/detach events.
75 // The first argument is true for attach, false for detach. 78 // The first argument is true for attach, false for detach.
76 // The second argument is the storage name. 79 // The second argument is the storage name.
77 typedef base::Callback<void(bool is_attach, 80 typedef base::Callback<void(bool is_attach,
78 const std::string& storage_name) 81 const std::string& storage_name)
79 > MTPStorageEventHandler; 82 > MTPStorageEventHandler;
80 83
81 virtual ~MediaTransferProtocolDaemonClient(); 84 virtual ~MediaTransferProtocolDaemonClient();
82 85
83 // Calls EnumerateStorages method. |callback| is called after the 86 // Calls EnumerateStorages method. |callback| is called after the
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 // |source_file_descriptor| is a file descriptor of source file. 148 // |source_file_descriptor| is a file descriptor of source file.
146 // |parent_id| is a object id of a target directory. 149 // |parent_id| is a object id of a target directory.
147 // |file_name| is a file name of a target file. 150 // |file_name| is a file name of a target file.
148 virtual void CopyFileFromLocal(const std::string& handle, 151 virtual void CopyFileFromLocal(const std::string& handle,
149 const int source_file_descriptor, 152 const int source_file_descriptor,
150 const uint32 parent_id, 153 const uint32 parent_id,
151 const std::string& file_name, 154 const std::string& file_name,
152 const CopyFileFromLocalCallback& callback, 155 const CopyFileFromLocalCallback& callback,
153 const ErrorCallback& error_callback) = 0; 156 const ErrorCallback& error_callback) = 0;
154 157
158 // Calls DeleteObject method. |callback| is called after the method call
159 // succeeds, otherwise, |error_callback| is called.
160 // |object_id| is an object id of a file or directory which is deleted.
161 virtual void DeleteObject(const std::string& handle,
162 const uint32 object_id,
163 const DeleteObjectCallback& callback,
164 const ErrorCallback& error_callback) = 0;
165
155 // Registers given callback for events. Should only be called once. 166 // Registers given callback for events. Should only be called once.
156 // |storage_event_handler| is called when a mtp storage attach or detach 167 // |storage_event_handler| is called when a mtp storage attach or detach
157 // signal is received. 168 // signal is received.
158 virtual void ListenForChanges(const MTPStorageEventHandler& handler) = 0; 169 virtual void ListenForChanges(const MTPStorageEventHandler& handler) = 0;
159 170
160 // Factory function, creates a new instance and returns ownership. 171 // Factory function, creates a new instance and returns ownership.
161 static MediaTransferProtocolDaemonClient* Create(dbus::Bus* bus); 172 static MediaTransferProtocolDaemonClient* Create(dbus::Bus* bus);
162 173
163 protected: 174 protected:
164 // Create() should be used instead. 175 // Create() should be used instead.
165 MediaTransferProtocolDaemonClient(); 176 MediaTransferProtocolDaemonClient();
166 177
167 private: 178 private:
168 DISALLOW_COPY_AND_ASSIGN(MediaTransferProtocolDaemonClient); 179 DISALLOW_COPY_AND_ASSIGN(MediaTransferProtocolDaemonClient);
169 }; 180 };
170 181
171 } // namespace device 182 } // namespace device
172 183
173 #endif // DEVICE_MEDIA_TRANSFER_PROTOCOL_MEDIA_TRANSFER_PROTOCOL_DAEMON_CLIENT_ H_ 184 #endif // DEVICE_MEDIA_TRANSFER_PROTOCOL_MEDIA_TRANSFER_PROTOCOL_DAEMON_CLIENT_ H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698