OLD | NEW |
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 // Asynchronous delegate for media transfer protocol (MTP) device to perform | 17 // Asynchronous delegate for media transfer protocol (MTP) device to perform |
18 // media device isolated file system operations. Class that implements this | 18 // media device isolated file system operations. Class that implements this |
19 // delegate does the actual communication with the MTP device. | 19 // delegate does the actual communication with the MTP device. |
20 // The lifetime of the delegate is managed by the MTPDeviceMapService class. | 20 // The lifetime of the delegate is managed by the MTPDeviceMapService class. |
21 // Member functions and callbacks run on the IO thread. | 21 // Member functions and callbacks run on the IO thread. |
22 class MTPDeviceAsyncDelegate { | 22 class MTPDeviceAsyncDelegate { |
23 public: | 23 public: |
24 // A callback to be called when GetFileInfo method call succeeds. | 24 // A callback to be called when GetFileInfo method call succeeds. |
25 typedef base::Callback< | 25 typedef base::Callback< |
26 void(const base::PlatformFileInfo& file_info)> GetFileInfoSuccessCallback; | 26 void(const base::File::Info& file_info)> GetFileInfoSuccessCallback; |
27 | 27 |
28 // A callback to be called when ReadDirectory method call succeeds. | 28 // A callback to be called when ReadDirectory method call succeeds. |
29 typedef base::Callback< | 29 typedef base::Callback< |
30 void(const fileapi::AsyncFileUtil::EntryList& file_list, | 30 void(const fileapi::AsyncFileUtil::EntryList& file_list, |
31 bool has_more)> ReadDirectorySuccessCallback; | 31 bool has_more)> ReadDirectorySuccessCallback; |
32 | 32 |
33 // A callback to be called when GetFileInfo/ReadDirectory/CreateSnapshot | 33 // A callback to be called when GetFileInfo/ReadDirectory/CreateSnapshot |
34 // method call fails. | 34 // method call fails. |
35 typedef base::Callback< | 35 typedef base::Callback<void(base::File::Error error)> ErrorCallback; |
36 void(base::PlatformFileError error)> ErrorCallback; | |
37 | 36 |
38 // A callback to be called when CreateSnapshotFile method call succeeds. | 37 // A callback to be called when CreateSnapshotFile method call succeeds. |
39 typedef base::Callback< | 38 typedef base::Callback< |
40 void(const base::PlatformFileInfo& file_info, | 39 void(const base::File::Info& file_info, |
41 const base::FilePath& local_path)> CreateSnapshotFileSuccessCallback; | 40 const base::FilePath& local_path)> CreateSnapshotFileSuccessCallback; |
42 | 41 |
43 // Gets information about the given |file_path| and invokes the appropriate | 42 // Gets information about the given |file_path| and invokes the appropriate |
44 // callback asynchronously when complete. | 43 // callback asynchronously when complete. |
45 virtual void GetFileInfo( | 44 virtual void GetFileInfo( |
46 const base::FilePath& file_path, | 45 const base::FilePath& file_path, |
47 const GetFileInfoSuccessCallback& success_callback, | 46 const GetFileInfoSuccessCallback& success_callback, |
48 const ErrorCallback& error_callback) = 0; | 47 const ErrorCallback& error_callback) = 0; |
49 | 48 |
50 // Enumerates the |root| directory contents and invokes the appropriate | 49 // Enumerates the |root| directory contents and invokes the appropriate |
(...skipping 27 matching lines...) Expand all Loading... |
78 }; | 77 }; |
79 | 78 |
80 typedef base::Callback<void(MTPDeviceAsyncDelegate*)> | 79 typedef base::Callback<void(MTPDeviceAsyncDelegate*)> |
81 CreateMTPDeviceAsyncDelegateCallback; | 80 CreateMTPDeviceAsyncDelegateCallback; |
82 | 81 |
83 void CreateMTPDeviceAsyncDelegate( | 82 void CreateMTPDeviceAsyncDelegate( |
84 const base::FilePath::StringType& device_location, | 83 const base::FilePath::StringType& device_location, |
85 const CreateMTPDeviceAsyncDelegateCallback& callback); | 84 const CreateMTPDeviceAsyncDelegateCallback& callback); |
86 | 85 |
87 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_MTP_DEVICE_ASYNC_DELEGATE_H_ | 86 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_MTP_DEVICE_ASYNC_DELEGATE_H_ |
OLD | NEW |