| 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/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 class DeviceMediaAsyncFileUtil : public fileapi::AsyncFileUtil { | 27 class DeviceMediaAsyncFileUtil : public fileapi::AsyncFileUtil { |
| 28 public: | 28 public: |
| 29 virtual ~DeviceMediaAsyncFileUtil(); | 29 virtual ~DeviceMediaAsyncFileUtil(); |
| 30 | 30 |
| 31 // Returns an instance of DeviceMediaAsyncFileUtil. Returns NULL if | 31 // Returns an instance of DeviceMediaAsyncFileUtil. Returns NULL if |
| 32 // asynchronous operation is not supported. Callers own the returned | 32 // asynchronous operation is not supported. Callers own the returned |
| 33 // object. | 33 // object. |
| 34 static DeviceMediaAsyncFileUtil* Create(const base::FilePath& profile_path); | 34 static DeviceMediaAsyncFileUtil* Create(const base::FilePath& profile_path); |
| 35 | 35 |
| 36 // AsyncFileUtil overrides. | 36 // AsyncFileUtil overrides. |
| 37 virtual bool CreateOrOpen( | 37 virtual void CreateOrOpen( |
| 38 scoped_ptr<fileapi::FileSystemOperationContext> context, | 38 scoped_ptr<fileapi::FileSystemOperationContext> context, |
| 39 const fileapi::FileSystemURL& url, | 39 const fileapi::FileSystemURL& url, |
| 40 int file_flags, | 40 int file_flags, |
| 41 const CreateOrOpenCallback& callback) OVERRIDE; | 41 const CreateOrOpenCallback& callback) OVERRIDE; |
| 42 virtual bool EnsureFileExists( | 42 virtual void EnsureFileExists( |
| 43 scoped_ptr<fileapi::FileSystemOperationContext> context, | 43 scoped_ptr<fileapi::FileSystemOperationContext> context, |
| 44 const fileapi::FileSystemURL& url, | 44 const fileapi::FileSystemURL& url, |
| 45 const EnsureFileExistsCallback& callback) OVERRIDE; | 45 const EnsureFileExistsCallback& callback) OVERRIDE; |
| 46 virtual bool CreateDirectory( | 46 virtual void CreateDirectory( |
| 47 scoped_ptr<fileapi::FileSystemOperationContext> context, | 47 scoped_ptr<fileapi::FileSystemOperationContext> context, |
| 48 const fileapi::FileSystemURL& url, | 48 const fileapi::FileSystemURL& url, |
| 49 bool exclusive, | 49 bool exclusive, |
| 50 bool recursive, | 50 bool recursive, |
| 51 const StatusCallback& callback) OVERRIDE; | 51 const StatusCallback& callback) OVERRIDE; |
| 52 virtual bool GetFileInfo( | 52 virtual void GetFileInfo( |
| 53 scoped_ptr<fileapi::FileSystemOperationContext> context, | 53 scoped_ptr<fileapi::FileSystemOperationContext> context, |
| 54 const fileapi::FileSystemURL& url, | 54 const fileapi::FileSystemURL& url, |
| 55 const GetFileInfoCallback& callback) OVERRIDE; | 55 const GetFileInfoCallback& callback) OVERRIDE; |
| 56 virtual bool ReadDirectory( | 56 virtual void ReadDirectory( |
| 57 scoped_ptr<fileapi::FileSystemOperationContext> context, | 57 scoped_ptr<fileapi::FileSystemOperationContext> context, |
| 58 const fileapi::FileSystemURL& url, | 58 const fileapi::FileSystemURL& url, |
| 59 const ReadDirectoryCallback& callback) OVERRIDE; | 59 const ReadDirectoryCallback& callback) OVERRIDE; |
| 60 virtual bool Touch( | 60 virtual void Touch( |
| 61 scoped_ptr<fileapi::FileSystemOperationContext> context, | 61 scoped_ptr<fileapi::FileSystemOperationContext> context, |
| 62 const fileapi::FileSystemURL& url, | 62 const fileapi::FileSystemURL& url, |
| 63 const base::Time& last_access_time, | 63 const base::Time& last_access_time, |
| 64 const base::Time& last_modified_time, | 64 const base::Time& last_modified_time, |
| 65 const StatusCallback& callback) OVERRIDE; | 65 const StatusCallback& callback) OVERRIDE; |
| 66 virtual bool Truncate( | 66 virtual void Truncate( |
| 67 scoped_ptr<fileapi::FileSystemOperationContext> context, | 67 scoped_ptr<fileapi::FileSystemOperationContext> context, |
| 68 const fileapi::FileSystemURL& url, | 68 const fileapi::FileSystemURL& url, |
| 69 int64 length, | 69 int64 length, |
| 70 const StatusCallback& callback) OVERRIDE; | 70 const StatusCallback& callback) OVERRIDE; |
| 71 virtual bool CopyFileLocal( | 71 virtual void CopyFileLocal( |
| 72 scoped_ptr<fileapi::FileSystemOperationContext> context, | 72 scoped_ptr<fileapi::FileSystemOperationContext> context, |
| 73 const fileapi::FileSystemURL& src_url, | 73 const fileapi::FileSystemURL& src_url, |
| 74 const fileapi::FileSystemURL& dest_url, | 74 const fileapi::FileSystemURL& dest_url, |
| 75 const StatusCallback& callback) OVERRIDE; | 75 const StatusCallback& callback) OVERRIDE; |
| 76 virtual bool MoveFileLocal( | 76 virtual void MoveFileLocal( |
| 77 scoped_ptr<fileapi::FileSystemOperationContext> context, | 77 scoped_ptr<fileapi::FileSystemOperationContext> context, |
| 78 const fileapi::FileSystemURL& src_url, | 78 const fileapi::FileSystemURL& src_url, |
| 79 const fileapi::FileSystemURL& dest_url, | 79 const fileapi::FileSystemURL& dest_url, |
| 80 const StatusCallback& callback) OVERRIDE; | 80 const StatusCallback& callback) OVERRIDE; |
| 81 virtual bool CopyInForeignFile( | 81 virtual void CopyInForeignFile( |
| 82 scoped_ptr<fileapi::FileSystemOperationContext> context, | 82 scoped_ptr<fileapi::FileSystemOperationContext> context, |
| 83 const base::FilePath& src_file_path, | 83 const base::FilePath& src_file_path, |
| 84 const fileapi::FileSystemURL& dest_url, | 84 const fileapi::FileSystemURL& dest_url, |
| 85 const StatusCallback& callback) OVERRIDE; | 85 const StatusCallback& callback) OVERRIDE; |
| 86 virtual bool DeleteFile( | 86 virtual void DeleteFile( |
| 87 scoped_ptr<fileapi::FileSystemOperationContext> context, | 87 scoped_ptr<fileapi::FileSystemOperationContext> context, |
| 88 const fileapi::FileSystemURL& url, | 88 const fileapi::FileSystemURL& url, |
| 89 const StatusCallback& callback) OVERRIDE; | 89 const StatusCallback& callback) OVERRIDE; |
| 90 virtual bool DeleteDirectory( | 90 virtual void DeleteDirectory( |
| 91 scoped_ptr<fileapi::FileSystemOperationContext> context, | 91 scoped_ptr<fileapi::FileSystemOperationContext> context, |
| 92 const fileapi::FileSystemURL& url, | 92 const fileapi::FileSystemURL& url, |
| 93 const StatusCallback& callback) OVERRIDE; | 93 const StatusCallback& callback) OVERRIDE; |
| 94 virtual bool DeleteRecursively( | 94 virtual void DeleteRecursively( |
| 95 scoped_ptr<fileapi::FileSystemOperationContext> context, | 95 scoped_ptr<fileapi::FileSystemOperationContext> context, |
| 96 const fileapi::FileSystemURL& url, | 96 const fileapi::FileSystemURL& url, |
| 97 const StatusCallback& callback) OVERRIDE; | 97 const StatusCallback& callback) OVERRIDE; |
| 98 virtual bool CreateSnapshotFile( | 98 virtual void CreateSnapshotFile( |
| 99 scoped_ptr<fileapi::FileSystemOperationContext> context, | 99 scoped_ptr<fileapi::FileSystemOperationContext> context, |
| 100 const fileapi::FileSystemURL& url, | 100 const fileapi::FileSystemURL& url, |
| 101 const CreateSnapshotFileCallback& callback) OVERRIDE; | 101 const CreateSnapshotFileCallback& callback) OVERRIDE; |
| 102 | 102 |
| 103 private: | 103 private: |
| 104 // Use Create() to get an instance of DeviceMediaAsyncFileUtil. | 104 // Use Create() to get an instance of DeviceMediaAsyncFileUtil. |
| 105 explicit DeviceMediaAsyncFileUtil(const base::FilePath& profile_path); | 105 explicit DeviceMediaAsyncFileUtil(const base::FilePath& profile_path); |
| 106 | 106 |
| 107 // Called when GetFileInfo method call succeeds. |file_info| | 107 // Called when GetFileInfo method call succeeds. |file_info| |
| 108 // contains the |platform_path| file details. |callback| is invoked | 108 // contains the |platform_path| file details. |callback| is invoked |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 | 183 |
| 184 // For callbacks that may run after destruction. | 184 // For callbacks that may run after destruction. |
| 185 base::WeakPtrFactory<DeviceMediaAsyncFileUtil> weak_ptr_factory_; | 185 base::WeakPtrFactory<DeviceMediaAsyncFileUtil> weak_ptr_factory_; |
| 186 | 186 |
| 187 DISALLOW_COPY_AND_ASSIGN(DeviceMediaAsyncFileUtil); | 187 DISALLOW_COPY_AND_ASSIGN(DeviceMediaAsyncFileUtil); |
| 188 }; | 188 }; |
| 189 | 189 |
| 190 } // namespace chrome | 190 } // namespace chrome |
| 191 | 191 |
| 192 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_DEVICE_MEDIA_ASYNC_FILE_UTIL_H
_ | 192 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_DEVICE_MEDIA_ASYNC_FILE_UTIL_H
_ |
| OLD | NEW |