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

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

Issue 378263002: Devices: Remove MTP functions that use file paths. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 typedef base::Callback<void(const MtpStorageInfo& storage_info) 47 typedef base::Callback<void(const MtpStorageInfo& storage_info)
48 > GetStorageInfoCallback; 48 > GetStorageInfoCallback;
49 49
50 // A callback to handle the result of OpenStorage. 50 // A callback to handle the result of OpenStorage.
51 // The argument is the returned handle. 51 // The argument is the returned handle.
52 typedef base::Callback<void(const std::string& handle)> OpenStorageCallback; 52 typedef base::Callback<void(const std::string& handle)> OpenStorageCallback;
53 53
54 // A callback to handle the result of CloseStorage. 54 // A callback to handle the result of CloseStorage.
55 typedef base::Closure CloseStorageCallback; 55 typedef base::Closure CloseStorageCallback;
56 56
57 // A callback to handle the result of ReadDirectoryByPath/Id. 57 // A callback to handle the result of ReadDirectoryById.
58 // The argument is a vector of file entries. 58 // The argument is a vector of file entries.
59 typedef base::Callback<void(const std::vector<MtpFileEntry>& file_entries) 59 typedef base::Callback<void(const std::vector<MtpFileEntry>& file_entries)
60 > ReadDirectoryCallback; 60 > ReadDirectoryCallback;
61 61
62 // A callback to handle the result of ReadFileChunkByPath/Id. 62 // A callback to handle the result of ReadFileChunkById.
63 // The argument is a string containing the file data. 63 // The argument is a string containing the file data.
64 typedef base::Callback<void(const std::string& data)> ReadFileCallback; 64 typedef base::Callback<void(const std::string& data)> ReadFileCallback;
65 65
66 // A callback to handle the result of GetFileInfoByPath/Id. 66 // A callback to handle the result of GetFileInfoById.
67 // The argument is a file entry. 67 // The argument is a file entry.
68 typedef base::Callback<void(const MtpFileEntry& file_entry) 68 typedef base::Callback<void(const MtpFileEntry& file_entry)
69 > GetFileInfoCallback; 69 > GetFileInfoCallback;
70 70
71 // A callback to handle storage attach/detach events. 71 // A callback to handle storage attach/detach events.
72 // The first argument is true for attach, false for detach. 72 // The first argument is true for attach, false for detach.
73 // The second argument is the storage name. 73 // The second argument is the storage name.
74 typedef base::Callback<void(bool is_attach, 74 typedef base::Callback<void(bool is_attach,
75 const std::string& storage_name) 75 const std::string& storage_name)
76 > MTPStorageEventHandler; 76 > MTPStorageEventHandler;
(...skipping 20 matching lines...) Expand all
97 const OpenStorageCallback& callback, 97 const OpenStorageCallback& callback,
98 const ErrorCallback& error_callback) = 0; 98 const ErrorCallback& error_callback) = 0;
99 99
100 // Calls CloseStorage method. |callback| is called after the method call 100 // Calls CloseStorage method. |callback| is called after the method call
101 // succeeds, otherwise, |error_callback| is called. 101 // succeeds, otherwise, |error_callback| is called.
102 // |handle| comes from a OpenStorageCallback. 102 // |handle| comes from a OpenStorageCallback.
103 virtual void CloseStorage(const std::string& handle, 103 virtual void CloseStorage(const std::string& handle,
104 const CloseStorageCallback& callback, 104 const CloseStorageCallback& callback,
105 const ErrorCallback& error_callback) = 0; 105 const ErrorCallback& error_callback) = 0;
106 106
107 // Calls ReadDirectoryByPath method. |callback| is called after the method
108 // call succeeds, otherwise, |error_callback| is called.
109 virtual void ReadDirectoryByPath(const std::string& handle,
110 const std::string& path,
111 const ReadDirectoryCallback& callback,
112 const ErrorCallback& error_callback) = 0;
113
114 // Calls ReadDirectoryById method. |callback| is called after the method 107 // Calls ReadDirectoryById method. |callback| is called after the method
115 // call succeeds, otherwise, |error_callback| is called. 108 // call succeeds, otherwise, |error_callback| is called.
116 // |file_id| is a MTP-device specific id for a file. 109 // |file_id| is a MTP-device specific id for a file.
117 virtual void ReadDirectoryById(const std::string& handle, 110 virtual void ReadDirectoryById(const std::string& handle,
118 uint32 file_id, 111 uint32 file_id,
119 const ReadDirectoryCallback& callback, 112 const ReadDirectoryCallback& callback,
120 const ErrorCallback& error_callback) = 0; 113 const ErrorCallback& error_callback) = 0;
121 114
122 // Calls ReadFileChunkByPath method. |callback| is called after the method
123 // call succeeds, otherwise, |error_callback| is called.
124 // |bytes_to_read| cannot exceed 1 MiB.
125 virtual void ReadFileChunkByPath(const std::string& handle,
126 const std::string& path,
127 uint32 offset,
128 uint32 bytes_to_read,
129 const ReadFileCallback& callback,
130 const ErrorCallback& error_callback) = 0;
131
132 // TODO(thestig) Remove this in the near future if we don't see anyone using
133 // it.
134 // Calls ReadFilePathById method. |callback| is called after the method call 115 // Calls ReadFilePathById method. |callback| is called after the method call
135 // succeeds, otherwise, |error_callback| is called. 116 // succeeds, otherwise, |error_callback| is called.
136 // |file_id| is a MTP-device specific id for a file. 117 // |file_id| is a MTP-device specific id for a file.
137 // |bytes_to_read| cannot exceed 1 MiB. 118 // |bytes_to_read| cannot exceed 1 MiB.
138 virtual void ReadFileChunkById(const std::string& handle, 119 virtual void ReadFileChunkById(const std::string& handle,
139 uint32 file_id, 120 uint32 file_id,
140 uint32 offset, 121 uint32 offset,
141 uint32 bytes_to_read, 122 uint32 bytes_to_read,
142 const ReadFileCallback& callback, 123 const ReadFileCallback& callback,
143 const ErrorCallback& error_callback) = 0; 124 const ErrorCallback& error_callback) = 0;
144 125
145 // Calls GetFileInfoByPath method. |callback| is called after the method
146 // call succeeds, otherwise, |error_callback| is called.
147 virtual void GetFileInfoByPath(const std::string& handle,
148 const std::string& path,
149 const GetFileInfoCallback& callback,
150 const ErrorCallback& error_callback) = 0;
151
152 // Calls GetFileInfoById method. |callback| is called after the method 126 // Calls GetFileInfoById method. |callback| is called after the method
153 // call succeeds, otherwise, |error_callback| is called. 127 // call succeeds, otherwise, |error_callback| is called.
154 // |file_id| is a MTP-device specific id for a file. 128 // |file_id| is a MTP-device specific id for a file.
155 virtual void GetFileInfoById(const std::string& handle, 129 virtual void GetFileInfoById(const std::string& handle,
156 uint32 file_id, 130 uint32 file_id,
157 const GetFileInfoCallback& callback, 131 const GetFileInfoCallback& callback,
158 const ErrorCallback& error_callback) = 0; 132 const ErrorCallback& error_callback) = 0;
159 133
160 // Registers given callback for events. Should only be called once. 134 // Registers given callback for events. Should only be called once.
161 // |storage_event_handler| is called when a mtp storage attach or detach 135 // |storage_event_handler| is called when a mtp storage attach or detach
162 // signal is received. 136 // signal is received.
163 virtual void ListenForChanges(const MTPStorageEventHandler& handler) = 0; 137 virtual void ListenForChanges(const MTPStorageEventHandler& handler) = 0;
164 138
165 // Factory function, creates a new instance and returns ownership. 139 // Factory function, creates a new instance and returns ownership.
166 static MediaTransferProtocolDaemonClient* Create(dbus::Bus* bus); 140 static MediaTransferProtocolDaemonClient* Create(dbus::Bus* bus);
167 141
168 protected: 142 protected:
169 // Create() should be used instead. 143 // Create() should be used instead.
170 MediaTransferProtocolDaemonClient(); 144 MediaTransferProtocolDaemonClient();
171 145
172 private: 146 private:
173 DISALLOW_COPY_AND_ASSIGN(MediaTransferProtocolDaemonClient); 147 DISALLOW_COPY_AND_ASSIGN(MediaTransferProtocolDaemonClient);
174 }; 148 };
175 149
176 } // namespace device 150 } // namespace device
177 151
178 #endif // DEVICE_MEDIA_TRANSFER_PROTOCOL_MEDIA_TRANSFER_PROTOCOL_DAEMON_CLIENT_ H_ 152 #endif // DEVICE_MEDIA_TRANSFER_PROTOCOL_MEDIA_TRANSFER_PROTOCOL_DAEMON_CLIENT_ H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698