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

Side by Side Diff: chrome/browser/media_galleries/fileapi/mtp_device_async_delegate.h

Issue 145303002: Convert Media Galleries to use base::File (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 11 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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_FILEAPI_MTP_DEVICE_ASYNC_DELEGATE_H_ 5 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_MTP_DEVICE_ASYNC_DELEGATE_H_
6 #define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_MTP_DEVICE_ASYNC_DELEGATE_H_ 6 #define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_MTP_DEVICE_ASYNC_DELEGATE_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/files/file.h"
9 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
10 #include "base/platform_file.h"
11 #include "webkit/browser/fileapi/async_file_util.h" 11 #include "webkit/browser/fileapi/async_file_util.h"
12 12
13 namespace base { 13 namespace base {
14 class FilePath; 14 class FilePath;
15 } 15 }
16 16
17 namespace net { 17 namespace net {
18 class IOBuffer; 18 class IOBuffer;
19 } 19 }
20 20
21 // Asynchronous delegate for media transfer protocol (MTP) device to perform 21 // Asynchronous delegate for media transfer protocol (MTP) device to perform
22 // media device isolated file system operations. Class that implements this 22 // media device isolated file system operations. Class that implements this
23 // delegate does the actual communication with the MTP device. 23 // delegate does the actual communication with the MTP device.
24 // The lifetime of the delegate is managed by the MTPDeviceMapService class. 24 // The lifetime of the delegate is managed by the MTPDeviceMapService class.
25 // Member functions and callbacks run on the IO thread. 25 // Member functions and callbacks run on the IO thread.
26 class MTPDeviceAsyncDelegate { 26 class MTPDeviceAsyncDelegate {
27 public: 27 public:
28 // A callback to be called when GetFileInfo method call succeeds. 28 // A callback to be called when GetFileInfo method call succeeds.
29 typedef base::Callback< 29 typedef base::Callback<
30 void(const base::PlatformFileInfo& file_info)> GetFileInfoSuccessCallback; 30 void(const base::File::Info& file_info)> GetFileInfoSuccessCallback;
31 31
32 // A callback to be called when ReadDirectory method call succeeds. 32 // A callback to be called when ReadDirectory method call succeeds.
33 typedef base::Callback< 33 typedef base::Callback<
34 void(const fileapi::AsyncFileUtil::EntryList& file_list, 34 void(const fileapi::AsyncFileUtil::EntryList& file_list,
35 bool has_more)> ReadDirectorySuccessCallback; 35 bool has_more)> ReadDirectorySuccessCallback;
36 36
37 // A callback to be called when GetFileInfo/ReadDirectory/CreateSnapshot 37 // A callback to be called when GetFileInfo/ReadDirectory/CreateSnapshot
38 // method call fails. 38 // method call fails.
39 typedef base::Callback< 39 typedef base::Callback<void(base::File::Error error)> ErrorCallback;
40 void(base::PlatformFileError error)> ErrorCallback;
41 40
42 // A callback to be called when CreateSnapshotFile method call succeeds. 41 // A callback to be called when CreateSnapshotFile method call succeeds.
43 typedef base::Callback< 42 typedef base::Callback<
44 void(const base::PlatformFileInfo& file_info, 43 void(const base::File::Info& file_info,
45 const base::FilePath& local_path)> CreateSnapshotFileSuccessCallback; 44 const base::FilePath& local_path)> CreateSnapshotFileSuccessCallback;
46 45
47 // A callback to be called when ReadBytes method call succeeds. 46 // A callback to be called when ReadBytes method call succeeds.
48 typedef base::Callback<void(int)> ReadBytesSuccessCallback; 47 typedef base::Callback<void(int)> ReadBytesSuccessCallback;
49 48
50 struct ReadBytesRequest { 49 struct ReadBytesRequest {
51 ReadBytesRequest(const std::string& device_file_relative_path, 50 ReadBytesRequest(const std::string& device_file_relative_path,
52 net::IOBuffer* buf, int64 offset, int buf_len, 51 net::IOBuffer* buf, int64 offset, int buf_len,
53 const ReadBytesSuccessCallback& success_callback, 52 const ReadBytesSuccessCallback& success_callback,
54 const ErrorCallback& error_callback); 53 const ErrorCallback& error_callback);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 }; 112 };
114 113
115 typedef base::Callback<void(MTPDeviceAsyncDelegate*)> 114 typedef base::Callback<void(MTPDeviceAsyncDelegate*)>
116 CreateMTPDeviceAsyncDelegateCallback; 115 CreateMTPDeviceAsyncDelegateCallback;
117 116
118 void CreateMTPDeviceAsyncDelegate( 117 void CreateMTPDeviceAsyncDelegate(
119 const base::FilePath::StringType& device_location, 118 const base::FilePath::StringType& device_location,
120 const CreateMTPDeviceAsyncDelegateCallback& callback); 119 const CreateMTPDeviceAsyncDelegateCallback& callback);
121 120
122 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_MTP_DEVICE_ASYNC_DELEGATE_H_ 121 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_MTP_DEVICE_ASYNC_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698