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

Side by Side Diff: chrome/browser/media_galleries/linux/mtp_device_task_helper.h

Issue 1007173003: Implement MoveFileLocal (with rename operation). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 CHROME_BROWSER_MEDIA_GALLERIES_LINUX_MTP_DEVICE_TASK_HELPER_H_ 5 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_LINUX_MTP_DEVICE_TASK_HELPER_H_
6 #define CHROME_BROWSER_MEDIA_GALLERIES_LINUX_MTP_DEVICE_TASK_HELPER_H_ 6 #define CHROME_BROWSER_MEDIA_GALLERIES_LINUX_MTP_DEVICE_TASK_HELPER_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 18 matching lines...) Expand all
29 typedef base::Callback<void(bool succeeded)> OpenStorageCallback; 29 typedef base::Callback<void(bool succeeded)> OpenStorageCallback;
30 30
31 typedef MTPDeviceAsyncDelegate::GetFileInfoSuccessCallback 31 typedef MTPDeviceAsyncDelegate::GetFileInfoSuccessCallback
32 GetFileInfoSuccessCallback; 32 GetFileInfoSuccessCallback;
33 33
34 // NOTE: The file names in the entry list have their file id appended at the 34 // NOTE: The file names in the entry list have their file id appended at the
35 // end. e.g. foo.jpg with file id 45 becomes foo.jpg,45. 35 // end. e.g. foo.jpg with file id 45 becomes foo.jpg,45.
36 typedef base::Callback<void(const storage::AsyncFileUtil::EntryList& entries, 36 typedef base::Callback<void(const storage::AsyncFileUtil::EntryList& entries,
37 bool has_more)> ReadDirectorySuccessCallback; 37 bool has_more)> ReadDirectorySuccessCallback;
38 38
39 typedef base::Closure RenameObjectSuccessCallback;
40
39 typedef base::Closure CopyFileFromLocalSuccessCallback; 41 typedef base::Closure CopyFileFromLocalSuccessCallback;
40 42
41 typedef base::Closure DeleteObjectSuccessCallback; 43 typedef base::Closure DeleteObjectSuccessCallback;
42 44
43 typedef MTPDeviceAsyncDelegate::ErrorCallback ErrorCallback; 45 typedef MTPDeviceAsyncDelegate::ErrorCallback ErrorCallback;
44 46
45 MTPDeviceTaskHelper(); 47 MTPDeviceTaskHelper();
46 ~MTPDeviceTaskHelper(); 48 ~MTPDeviceTaskHelper();
47 49
48 // Dispatches the request to the MediaTransferProtocolManager to open the MTP 50 // Dispatches the request to the MediaTransferProtocolManager to open the MTP
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 const SnapshotRequestInfo& request_info, 96 const SnapshotRequestInfo& request_info,
95 const base::File::Info& snapshot_file_info); 97 const base::File::Info& snapshot_file_info);
96 98
97 // Dispatches the read bytes request to the MediaTransferProtocolManager. 99 // Dispatches the read bytes request to the MediaTransferProtocolManager.
98 // 100 //
99 // |request| contains details about the byte request including the file path, 101 // |request| contains details about the byte request including the file path,
100 // byte range, and the callbacks. The callbacks specified within |request| are 102 // byte range, and the callbacks. The callbacks specified within |request| are
101 // called on the IO thread to notify the caller about success or failure. 103 // called on the IO thread to notify the caller about success or failure.
102 void ReadBytes(const MTPDeviceAsyncDelegate::ReadBytesRequest& request); 104 void ReadBytes(const MTPDeviceAsyncDelegate::ReadBytesRequest& request);
103 105
106 // Forwards RenameObject request to the MediaTransferProtocolManager.
107 void RenameObject(const uint32 object_id,
108 const std::string& new_name,
109 const RenameObjectSuccessCallback& success_callback,
110 const ErrorCallback& error_callback);
111
104 // Forwards CopyFileFromLocal request to the MediaTransferProtocolManager. 112 // Forwards CopyFileFromLocal request to the MediaTransferProtocolManager.
105 void CopyFileFromLocal( 113 void CopyFileFromLocal(
106 const std::string& storage_name, 114 const std::string& storage_name,
107 const int source_file_descriptor, 115 const int source_file_descriptor,
108 const uint32 parent_id, 116 const uint32 parent_id,
109 const std::string& file_name, 117 const std::string& file_name,
110 const CopyFileFromLocalSuccessCallback& success_callback, 118 const CopyFileFromLocalSuccessCallback& success_callback,
111 const ErrorCallback& error_callback); 119 const ErrorCallback& error_callback);
112 120
113 // Forwards DeleteObject request to the MediaTransferProtocolManager. 121 // Forwards DeleteObject request to the MediaTransferProtocolManager.
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 // 180 //
173 // If there is an error, |error| is set to true, the buffer within |request| 181 // If there is an error, |error| is set to true, the buffer within |request|
174 // is untouched, and the error callback within |request| is invoked on the 182 // is untouched, and the error callback within |request| is invoked on the
175 // IO thread to notify the caller. 183 // IO thread to notify the caller.
176 void OnDidReadBytes( 184 void OnDidReadBytes(
177 const MTPDeviceAsyncDelegate::ReadBytesRequest& request, 185 const MTPDeviceAsyncDelegate::ReadBytesRequest& request,
178 const base::File::Info& file_info, 186 const base::File::Info& file_info,
179 const std::string& data, 187 const std::string& data,
180 bool error) const; 188 bool error) const;
181 189
190 // Called when RenameObject completes.
191 void OnRenameObject(const RenameObjectSuccessCallback& success_callback,
192 const ErrorCallback& error_callback,
193 const bool error) const;
194
182 // Called when CopyFileFromLocal completes. 195 // Called when CopyFileFromLocal completes.
183 void OnCopyFileFromLocal( 196 void OnCopyFileFromLocal(
184 const CopyFileFromLocalSuccessCallback& success_callback, 197 const CopyFileFromLocalSuccessCallback& success_callback,
185 const ErrorCallback& error_callback, 198 const ErrorCallback& error_callback,
186 const bool error) const; 199 const bool error) const;
187 200
188 // Called when DeleteObject completes. 201 // Called when DeleteObject completes.
189 void OnDeleteObject(const DeleteObjectSuccessCallback& success_callback, 202 void OnDeleteObject(const DeleteObjectSuccessCallback& success_callback,
190 const ErrorCallback& error_callback, 203 const ErrorCallback& error_callback,
191 const bool error) const; 204 const bool error) const;
(...skipping 11 matching lines...) Expand all
203 // Used to handle WriteDataInfoSnapshotFile request. 216 // Used to handle WriteDataInfoSnapshotFile request.
204 scoped_ptr<MTPReadFileWorker> read_file_worker_; 217 scoped_ptr<MTPReadFileWorker> read_file_worker_;
205 218
206 // For callbacks that may run after destruction. 219 // For callbacks that may run after destruction.
207 base::WeakPtrFactory<MTPDeviceTaskHelper> weak_ptr_factory_; 220 base::WeakPtrFactory<MTPDeviceTaskHelper> weak_ptr_factory_;
208 221
209 DISALLOW_COPY_AND_ASSIGN(MTPDeviceTaskHelper); 222 DISALLOW_COPY_AND_ASSIGN(MTPDeviceTaskHelper);
210 }; 223 };
211 224
212 #endif // CHROME_BROWSER_MEDIA_GALLERIES_LINUX_MTP_DEVICE_TASK_HELPER_H_ 225 #endif // CHROME_BROWSER_MEDIA_GALLERIES_LINUX_MTP_DEVICE_TASK_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698