OLD | NEW |
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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 const ReadDirectorySuccessCallback& success_callback, | 78 const ReadDirectorySuccessCallback& success_callback, |
79 const ErrorCallback& error_callback); | 79 const ErrorCallback& error_callback); |
80 | 80 |
81 // Forwards the WriteDataIntoSnapshotFile request to the MTPReadFileWorker | 81 // Forwards the WriteDataIntoSnapshotFile request to the MTPReadFileWorker |
82 // object. | 82 // object. |
83 // | 83 // |
84 // |request_info| specifies the snapshot file request params. | 84 // |request_info| specifies the snapshot file request params. |
85 // |snapshot_file_info| specifies the metadata of the snapshot file. | 85 // |snapshot_file_info| specifies the metadata of the snapshot file. |
86 void WriteDataIntoSnapshotFile( | 86 void WriteDataIntoSnapshotFile( |
87 const SnapshotRequestInfo& request_info, | 87 const SnapshotRequestInfo& request_info, |
88 const base::PlatformFileInfo& snapshot_file_info); | 88 const base::File::Info& snapshot_file_info); |
89 | 89 |
90 // Dispatches the CloseStorage request to the MediaTransferProtocolManager. | 90 // Dispatches the CloseStorage request to the MediaTransferProtocolManager. |
91 void CloseStorage() const; | 91 void CloseStorage() const; |
92 | 92 |
93 private: | 93 private: |
94 // Query callback for OpenStorage() to run |callback| on the IO thread. | 94 // Query callback for OpenStorage() to run |callback| on the IO thread. |
95 // | 95 // |
96 // If OpenStorage request succeeds, |error| is set to false and | 96 // If OpenStorage request succeeds, |error| is set to false and |
97 // |device_handle| contains the handle to communicate with the MTP device. | 97 // |device_handle| contains the handle to communicate with the MTP device. |
98 // | 98 // |
(...skipping 29 matching lines...) Expand all Loading... |
128 const ReadDirectorySuccessCallback& success_callback, | 128 const ReadDirectorySuccessCallback& success_callback, |
129 const ErrorCallback& error_callback, | 129 const ErrorCallback& error_callback, |
130 const std::vector<MtpFileEntry>& file_entries, | 130 const std::vector<MtpFileEntry>& file_entries, |
131 bool error) const; | 131 bool error) const; |
132 | 132 |
133 // Called when the device is uninitialized. | 133 // Called when the device is uninitialized. |
134 // | 134 // |
135 // Runs |error_callback| on the IO thread to notify the caller about the | 135 // Runs |error_callback| on the IO thread to notify the caller about the |
136 // device |error|. | 136 // device |error|. |
137 void HandleDeviceError(const ErrorCallback& error_callback, | 137 void HandleDeviceError(const ErrorCallback& error_callback, |
138 base::PlatformFileError error) const; | 138 base::File::Error error) const; |
139 | 139 |
140 // Handle to communicate with the MTP device. | 140 // Handle to communicate with the MTP device. |
141 std::string device_handle_; | 141 std::string device_handle_; |
142 | 142 |
143 // Used to handle WriteDataInfoSnapshotFile request. | 143 // Used to handle WriteDataInfoSnapshotFile request. |
144 scoped_ptr<MTPReadFileWorker> read_file_worker_; | 144 scoped_ptr<MTPReadFileWorker> read_file_worker_; |
145 | 145 |
146 // For callbacks that may run after destruction. | 146 // For callbacks that may run after destruction. |
147 base::WeakPtrFactory<MTPDeviceTaskHelper> weak_ptr_factory_; | 147 base::WeakPtrFactory<MTPDeviceTaskHelper> weak_ptr_factory_; |
148 | 148 |
149 DISALLOW_COPY_AND_ASSIGN(MTPDeviceTaskHelper); | 149 DISALLOW_COPY_AND_ASSIGN(MTPDeviceTaskHelper); |
150 }; | 150 }; |
151 | 151 |
152 #endif // CHROME_BROWSER_MEDIA_GALLERIES_LINUX_MTP_DEVICE_TASK_HELPER_H_ | 152 #endif // CHROME_BROWSER_MEDIA_GALLERIES_LINUX_MTP_DEVICE_TASK_HELPER_H_ |
OLD | NEW |