| 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_DEVICE_MEDIA_ASYNC_FILE_UTIL_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_DEVICE_MEDIA_ASYNC_FILE_UTIL_H_ |
| 6 #define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_DEVICE_MEDIA_ASYNC_FILE_UTIL_H_ | 6 #define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_DEVICE_MEDIA_ASYNC_FILE_UTIL_H_ |
| 7 | 7 |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/platform_file.h" | 10 #include "base/platform_file.h" |
| 11 #include "webkit/blob/shareable_file_reference.h" |
| 11 #include "webkit/fileapi/async_file_util.h" | 12 #include "webkit/fileapi/async_file_util.h" |
| 12 | 13 |
| 13 namespace base { | 14 namespace base { |
| 14 class SequencedTaskRunner; | 15 class SequencedTaskRunner; |
| 15 class Time; | 16 class Time; |
| 16 } | 17 } |
| 17 | 18 |
| 18 namespace fileapi { | 19 namespace fileapi { |
| 19 class FileSystemOperationContext; | 20 class FileSystemOperationContext; |
| 20 class FileSystemURL; | 21 class FileSystemURL; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 | 133 |
| 133 // Called when ReadDirectory method call failed to enumerate the directory | 134 // Called when ReadDirectory method call failed to enumerate the directory |
| 134 // objects. |callback| is invoked to notify the caller about the |error| | 135 // objects. |callback| is invoked to notify the caller about the |error| |
| 135 // that occured while reading the directory objects. | 136 // that occured while reading the directory objects. |
| 136 void OnReadDirectoryError( | 137 void OnReadDirectoryError( |
| 137 const AsyncFileUtil::ReadDirectoryCallback& callback, | 138 const AsyncFileUtil::ReadDirectoryCallback& callback, |
| 138 base::PlatformFileError error); | 139 base::PlatformFileError error); |
| 139 | 140 |
| 140 // Called when the snapshot file specified by the |platform_path| is | 141 // Called when the snapshot file specified by the |platform_path| is |
| 141 // successfully created. |file_info| contains the device media file details | 142 // successfully created. |file_info| contains the device media file details |
| 142 // for which the snapshot file is created. |callback| is invoked to complete | 143 // for which the snapshot file is created. |
| 143 // the CreateSnapshotFile request. | |
| 144 void OnDidCreateSnapshotFile( | 144 void OnDidCreateSnapshotFile( |
| 145 const AsyncFileUtil::CreateSnapshotFileCallback& callback, | 145 const AsyncFileUtil::CreateSnapshotFileCallback& callback, |
| 146 base::SequencedTaskRunner* media_task_runner, | 146 base::SequencedTaskRunner* media_task_runner, |
| 147 const base::PlatformFileInfo& file_info, | 147 const base::PlatformFileInfo& file_info, |
| 148 const base::FilePath& platform_path); | 148 const base::FilePath& platform_path); |
| 149 | 149 |
| 150 // Called after OnDidCreateSnapshotFile finishes media check. |
| 151 // |callback| is invoked to complete the CreateSnapshotFile request. |
| 152 // It is called with |*error| regardless of result. |
| 153 void OnDidCheckMedia( |
| 154 const AsyncFileUtil::CreateSnapshotFileCallback& callback, |
| 155 base::SequencedTaskRunner* media_task_runner, |
| 156 const base::PlatformFileInfo& file_info, |
| 157 scoped_refptr<webkit_blob::ShareableFileReference> platform_file, |
| 158 base::PlatformFileError* error); |
| 159 |
| 150 // Called when CreateSnapshotFile method call fails. |callback| is invoked to | 160 // Called when CreateSnapshotFile method call fails. |callback| is invoked to |
| 151 // notify the caller about the |error|. | 161 // notify the caller about the |error|. |
| 152 void OnCreateSnapshotFileError( | 162 void OnCreateSnapshotFileError( |
| 153 const AsyncFileUtil::CreateSnapshotFileCallback& callback, | 163 const AsyncFileUtil::CreateSnapshotFileCallback& callback, |
| 154 base::PlatformFileError error); | 164 base::PlatformFileError error); |
| 155 | 165 |
| 156 // Called when the snapshot file specified by the |snapshot_file_path| is | 166 // Called when the snapshot file specified by the |snapshot_file_path| is |
| 157 // created to hold the contents of the |device_file_path|. If the snapshot | 167 // created to hold the contents of the |device_file_path|. If the snapshot |
| 158 // file is successfully created, |snapshot_file_path| will be an non-empty | 168 // file is successfully created, |snapshot_file_path| will be an non-empty |
| 159 // file path. In case of failure, |snapshot_file_path| will be an empty file | 169 // file path. In case of failure, |snapshot_file_path| will be an empty file |
| (...skipping 10 matching lines...) Expand all Loading... |
| 170 | 180 |
| 171 // For callbacks that may run after destruction. | 181 // For callbacks that may run after destruction. |
| 172 base::WeakPtrFactory<DeviceMediaAsyncFileUtil> weak_ptr_factory_; | 182 base::WeakPtrFactory<DeviceMediaAsyncFileUtil> weak_ptr_factory_; |
| 173 | 183 |
| 174 DISALLOW_COPY_AND_ASSIGN(DeviceMediaAsyncFileUtil); | 184 DISALLOW_COPY_AND_ASSIGN(DeviceMediaAsyncFileUtil); |
| 175 }; | 185 }; |
| 176 | 186 |
| 177 } // namespace chrome | 187 } // namespace chrome |
| 178 | 188 |
| 179 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_DEVICE_MEDIA_ASYNC_FILE_UTIL_H
_ | 189 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_DEVICE_MEDIA_ASYNC_FILE_UTIL_H
_ |
| OLD | NEW |