OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_CHROMEOS_ARC_FILEAPI_ARC_DOCUMENTS_PROVIDER_ASYNC_FILE_UT
IL_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_ARC_FILEAPI_ARC_DOCUMENTS_PROVIDER_ASYNC_FILE_UT
IL_H_ |
6 #define CHROME_BROWSER_CHROMEOS_ARC_FILEAPI_ARC_DOCUMENTS_PROVIDER_ASYNC_FILE_UT
IL_H_ | 6 #define CHROME_BROWSER_CHROMEOS_ARC_FILEAPI_ARC_DOCUMENTS_PROVIDER_ASYNC_FILE_UT
IL_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/weak_ptr.h" |
12 #include "storage/browser/fileapi/async_file_util.h" | 13 #include "storage/browser/fileapi/async_file_util.h" |
13 | 14 |
14 namespace arc { | 15 namespace arc { |
15 | 16 |
| 17 class ArcDocumentsProviderRootMap; |
| 18 |
16 // The implementation of storage::AsyncFileUtil for media view. | 19 // The implementation of storage::AsyncFileUtil for media view. |
17 // | 20 // |
18 // All of the methods must be called on the IO thread. | 21 // All of the methods must be called on the IO thread. |
19 class ArcDocumentsProviderAsyncFileUtil : public storage::AsyncFileUtil { | 22 class ArcDocumentsProviderAsyncFileUtil : public storage::AsyncFileUtil { |
20 public: | 23 public: |
21 ArcDocumentsProviderAsyncFileUtil(); | 24 explicit ArcDocumentsProviderAsyncFileUtil( |
| 25 ArcDocumentsProviderRootMap* roots); |
22 ~ArcDocumentsProviderAsyncFileUtil() override; | 26 ~ArcDocumentsProviderAsyncFileUtil() override; |
23 | 27 |
24 // storage::AsyncFileUtil overrides. | 28 // storage::AsyncFileUtil overrides. |
25 void CreateOrOpen( | 29 void CreateOrOpen( |
26 std::unique_ptr<storage::FileSystemOperationContext> context, | 30 std::unique_ptr<storage::FileSystemOperationContext> context, |
27 const storage::FileSystemURL& url, | 31 const storage::FileSystemURL& url, |
28 int file_flags, | 32 int file_flags, |
29 const CreateOrOpenCallback& callback) override; | 33 const CreateOrOpenCallback& callback) override; |
30 void EnsureFileExists( | 34 void EnsureFileExists( |
31 std::unique_ptr<storage::FileSystemOperationContext> context, | 35 std::unique_ptr<storage::FileSystemOperationContext> context, |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 void DeleteRecursively( | 86 void DeleteRecursively( |
83 std::unique_ptr<storage::FileSystemOperationContext> context, | 87 std::unique_ptr<storage::FileSystemOperationContext> context, |
84 const storage::FileSystemURL& url, | 88 const storage::FileSystemURL& url, |
85 const StatusCallback& callback) override; | 89 const StatusCallback& callback) override; |
86 void CreateSnapshotFile( | 90 void CreateSnapshotFile( |
87 std::unique_ptr<storage::FileSystemOperationContext> context, | 91 std::unique_ptr<storage::FileSystemOperationContext> context, |
88 const storage::FileSystemURL& url, | 92 const storage::FileSystemURL& url, |
89 const CreateSnapshotFileCallback& callback) override; | 93 const CreateSnapshotFileCallback& callback) override; |
90 | 94 |
91 private: | 95 private: |
| 96 void OnGetFileInfo( |
| 97 std::unique_ptr<storage::FileSystemOperationContext> context, |
| 98 const GetFileInfoCallback& callback, |
| 99 base::File::Error result, |
| 100 const base::File::Info& file_info); |
| 101 void OnReadDirectory( |
| 102 std::unique_ptr<storage::FileSystemOperationContext>* context, |
| 103 const ReadDirectoryCallback& callback, |
| 104 base::File::Error result, |
| 105 const EntryList& file_list, |
| 106 bool has_more); |
| 107 |
| 108 // Owned by ArcDocumentsProviderBackendDelegate. |
| 109 ArcDocumentsProviderRootMap* const roots_; |
| 110 base::WeakPtrFactory<ArcDocumentsProviderAsyncFileUtil> weak_ptr_factory_; |
| 111 |
92 DISALLOW_COPY_AND_ASSIGN(ArcDocumentsProviderAsyncFileUtil); | 112 DISALLOW_COPY_AND_ASSIGN(ArcDocumentsProviderAsyncFileUtil); |
93 }; | 113 }; |
94 | 114 |
95 } // namespace arc | 115 } // namespace arc |
96 | 116 |
97 #endif // CHROME_BROWSER_CHROMEOS_ARC_FILEAPI_ARC_DOCUMENTS_PROVIDER_ASYNC_FILE
_UTIL_H_ | 117 #endif // CHROME_BROWSER_CHROMEOS_ARC_FILEAPI_ARC_DOCUMENTS_PROVIDER_ASYNC_FILE
_UTIL_H_ |
OLD | NEW |