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.h" | 8 #include "base/files/file.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 class FileStreamReader; | 22 class FileStreamReader; |
23 } | 23 } |
24 | 24 |
25 enum MediaFileValidationType { | 25 enum MediaFileValidationType { |
26 NO_MEDIA_FILE_VALIDATION, | 26 NO_MEDIA_FILE_VALIDATION, |
27 APPLY_MEDIA_FILE_VALIDATION, | 27 APPLY_MEDIA_FILE_VALIDATION, |
28 }; | 28 }; |
29 | 29 |
30 class DeviceMediaAsyncFileUtil : public storage::AsyncFileUtil { | 30 class DeviceMediaAsyncFileUtil : public storage::AsyncFileUtil { |
31 public: | 31 public: |
32 virtual ~DeviceMediaAsyncFileUtil(); | 32 ~DeviceMediaAsyncFileUtil() override; |
33 | 33 |
34 // Returns an instance of DeviceMediaAsyncFileUtil. | 34 // Returns an instance of DeviceMediaAsyncFileUtil. |
35 static scoped_ptr<DeviceMediaAsyncFileUtil> Create( | 35 static scoped_ptr<DeviceMediaAsyncFileUtil> Create( |
36 const base::FilePath& profile_path, | 36 const base::FilePath& profile_path, |
37 MediaFileValidationType validation_type); | 37 MediaFileValidationType validation_type); |
38 | 38 |
39 bool SupportsStreaming(const storage::FileSystemURL& url); | 39 bool SupportsStreaming(const storage::FileSystemURL& url); |
40 | 40 |
41 // AsyncFileUtil overrides. | 41 // AsyncFileUtil overrides. |
42 virtual void CreateOrOpen( | 42 void CreateOrOpen(scoped_ptr<storage::FileSystemOperationContext> context, |
43 scoped_ptr<storage::FileSystemOperationContext> context, | 43 const storage::FileSystemURL& url, |
44 const storage::FileSystemURL& url, | 44 int file_flags, |
45 int file_flags, | 45 const CreateOrOpenCallback& callback) override; |
46 const CreateOrOpenCallback& callback) override; | 46 void EnsureFileExists(scoped_ptr<storage::FileSystemOperationContext> context, |
47 virtual void EnsureFileExists( | 47 const storage::FileSystemURL& url, |
48 scoped_ptr<storage::FileSystemOperationContext> context, | 48 const EnsureFileExistsCallback& callback) override; |
49 const storage::FileSystemURL& url, | 49 void CreateDirectory(scoped_ptr<storage::FileSystemOperationContext> context, |
50 const EnsureFileExistsCallback& callback) override; | 50 const storage::FileSystemURL& url, |
51 virtual void CreateDirectory( | 51 bool exclusive, |
52 scoped_ptr<storage::FileSystemOperationContext> context, | 52 bool recursive, |
53 const storage::FileSystemURL& url, | 53 const StatusCallback& callback) override; |
54 bool exclusive, | 54 void GetFileInfo(scoped_ptr<storage::FileSystemOperationContext> context, |
55 bool recursive, | 55 const storage::FileSystemURL& url, |
56 const StatusCallback& callback) override; | 56 const GetFileInfoCallback& callback) override; |
57 virtual void GetFileInfo( | 57 void ReadDirectory(scoped_ptr<storage::FileSystemOperationContext> context, |
58 scoped_ptr<storage::FileSystemOperationContext> context, | |
59 const storage::FileSystemURL& url, | |
60 const GetFileInfoCallback& callback) override; | |
61 virtual void ReadDirectory( | |
62 scoped_ptr<storage::FileSystemOperationContext> context, | |
63 const storage::FileSystemURL& url, | |
64 const ReadDirectoryCallback& callback) override; | |
65 virtual void Touch(scoped_ptr<storage::FileSystemOperationContext> context, | |
66 const storage::FileSystemURL& url, | 58 const storage::FileSystemURL& url, |
67 const base::Time& last_access_time, | 59 const ReadDirectoryCallback& callback) override; |
68 const base::Time& last_modified_time, | 60 void Touch(scoped_ptr<storage::FileSystemOperationContext> context, |
| 61 const storage::FileSystemURL& url, |
| 62 const base::Time& last_access_time, |
| 63 const base::Time& last_modified_time, |
| 64 const StatusCallback& callback) override; |
| 65 void Truncate(scoped_ptr<storage::FileSystemOperationContext> context, |
| 66 const storage::FileSystemURL& url, |
| 67 int64 length, |
| 68 const StatusCallback& callback) override; |
| 69 void CopyFileLocal(scoped_ptr<storage::FileSystemOperationContext> context, |
| 70 const storage::FileSystemURL& src_url, |
| 71 const storage::FileSystemURL& dest_url, |
| 72 CopyOrMoveOption option, |
| 73 const CopyFileProgressCallback& progress_callback, |
69 const StatusCallback& callback) override; | 74 const StatusCallback& callback) override; |
70 virtual void Truncate(scoped_ptr<storage::FileSystemOperationContext> context, | 75 void MoveFileLocal(scoped_ptr<storage::FileSystemOperationContext> context, |
71 const storage::FileSystemURL& url, | 76 const storage::FileSystemURL& src_url, |
72 int64 length, | 77 const storage::FileSystemURL& dest_url, |
73 const StatusCallback& callback) override; | 78 CopyOrMoveOption option, |
74 virtual void CopyFileLocal( | 79 const StatusCallback& callback) override; |
75 scoped_ptr<storage::FileSystemOperationContext> context, | 80 void CopyInForeignFile( |
76 const storage::FileSystemURL& src_url, | |
77 const storage::FileSystemURL& dest_url, | |
78 CopyOrMoveOption option, | |
79 const CopyFileProgressCallback& progress_callback, | |
80 const StatusCallback& callback) override; | |
81 virtual void MoveFileLocal( | |
82 scoped_ptr<storage::FileSystemOperationContext> context, | |
83 const storage::FileSystemURL& src_url, | |
84 const storage::FileSystemURL& dest_url, | |
85 CopyOrMoveOption option, | |
86 const StatusCallback& callback) override; | |
87 virtual void CopyInForeignFile( | |
88 scoped_ptr<storage::FileSystemOperationContext> context, | 81 scoped_ptr<storage::FileSystemOperationContext> context, |
89 const base::FilePath& src_file_path, | 82 const base::FilePath& src_file_path, |
90 const storage::FileSystemURL& dest_url, | 83 const storage::FileSystemURL& dest_url, |
91 const StatusCallback& callback) override; | 84 const StatusCallback& callback) override; |
92 virtual void DeleteFile( | 85 void DeleteFile(scoped_ptr<storage::FileSystemOperationContext> context, |
| 86 const storage::FileSystemURL& url, |
| 87 const StatusCallback& callback) override; |
| 88 void DeleteDirectory(scoped_ptr<storage::FileSystemOperationContext> context, |
| 89 const storage::FileSystemURL& url, |
| 90 const StatusCallback& callback) override; |
| 91 void DeleteRecursively( |
93 scoped_ptr<storage::FileSystemOperationContext> context, | 92 scoped_ptr<storage::FileSystemOperationContext> context, |
94 const storage::FileSystemURL& url, | 93 const storage::FileSystemURL& url, |
95 const StatusCallback& callback) override; | 94 const StatusCallback& callback) override; |
96 virtual void DeleteDirectory( | 95 void CreateSnapshotFile( |
97 scoped_ptr<storage::FileSystemOperationContext> context, | |
98 const storage::FileSystemURL& url, | |
99 const StatusCallback& callback) override; | |
100 virtual void DeleteRecursively( | |
101 scoped_ptr<storage::FileSystemOperationContext> context, | |
102 const storage::FileSystemURL& url, | |
103 const StatusCallback& callback) override; | |
104 virtual void CreateSnapshotFile( | |
105 scoped_ptr<storage::FileSystemOperationContext> context, | 96 scoped_ptr<storage::FileSystemOperationContext> context, |
106 const storage::FileSystemURL& url, | 97 const storage::FileSystemURL& url, |
107 const CreateSnapshotFileCallback& callback) override; | 98 const CreateSnapshotFileCallback& callback) override; |
108 | 99 |
109 // This method is called when existing Blobs are read. | 100 // This method is called when existing Blobs are read. |
110 // |expected_modification_time| indicates the expected snapshot state of the | 101 // |expected_modification_time| indicates the expected snapshot state of the |
111 // underlying storage. The returned FileStreamReader must return an error | 102 // underlying storage. The returned FileStreamReader must return an error |
112 // when the state of the underlying storage changes. Any errors associated | 103 // when the state of the underlying storage changes. Any errors associated |
113 // with reading this file are returned by the FileStreamReader itself. | 104 // with reading this file are returned by the FileStreamReader itself. |
114 virtual scoped_ptr<storage::FileStreamReader> GetFileStreamReader( | 105 virtual scoped_ptr<storage::FileStreamReader> GetFileStreamReader( |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 148 |
158 scoped_refptr<MediaPathFilterWrapper> media_path_filter_wrapper_; | 149 scoped_refptr<MediaPathFilterWrapper> media_path_filter_wrapper_; |
159 | 150 |
160 // For callbacks that may run after destruction. | 151 // For callbacks that may run after destruction. |
161 base::WeakPtrFactory<DeviceMediaAsyncFileUtil> weak_ptr_factory_; | 152 base::WeakPtrFactory<DeviceMediaAsyncFileUtil> weak_ptr_factory_; |
162 | 153 |
163 DISALLOW_COPY_AND_ASSIGN(DeviceMediaAsyncFileUtil); | 154 DISALLOW_COPY_AND_ASSIGN(DeviceMediaAsyncFileUtil); |
164 }; | 155 }; |
165 | 156 |
166 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_DEVICE_MEDIA_ASYNC_FILE_UTIL_H
_ | 157 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_DEVICE_MEDIA_ASYNC_FILE_UTIL_H
_ |
OLD | NEW |