OLD | NEW |
| (Empty) |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef COMPONENTS_ARC_FILE_SYSTEM_ARC_FILE_SYSTEM_OPERATION_RUNNER_H_ | |
6 #define COMPONENTS_ARC_FILE_SYSTEM_ARC_FILE_SYSTEM_OPERATION_RUNNER_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "components/arc/arc_service.h" | |
11 #include "components/arc/common/file_system.mojom.h" | |
12 | |
13 class GURL; | |
14 | |
15 namespace arc { | |
16 | |
17 // An interface to run ARC file system operations. | |
18 // | |
19 // This is an abstraction layer on top of mojom::FileSystemInstance. | |
20 // In production, ArcDeferredFileSystemOperationRunner is always used which | |
21 // defers file system operations while ARC is booting. | |
22 // In unit tests, fake implementations will be injected. | |
23 // | |
24 // All member functions must be called on the UI thread. | |
25 class ArcFileSystemOperationRunner : public ArcService { | |
26 public: | |
27 // For supporting ArcServiceManager::GetService<T>(). | |
28 static const char kArcServiceName[]; | |
29 | |
30 explicit ArcFileSystemOperationRunner(ArcBridgeService* bridge_service); | |
31 ~ArcFileSystemOperationRunner() override; | |
32 | |
33 using GetFileSizeCallback = mojom::FileSystemInstance::GetFileSizeCallback; | |
34 using OpenFileToReadCallback = | |
35 mojom::FileSystemInstance::OpenFileToReadCallback; | |
36 using GetDocumentCallback = mojom::FileSystemInstance::GetDocumentCallback; | |
37 using GetChildDocumentsCallback = | |
38 mojom::FileSystemInstance::GetChildDocumentsCallback; | |
39 | |
40 // Runs file system operations. See file_system.mojom for documentation. | |
41 virtual void GetFileSize(const GURL& url, | |
42 const GetFileSizeCallback& callback) = 0; | |
43 virtual void OpenFileToRead(const GURL& url, | |
44 const OpenFileToReadCallback& callback) = 0; | |
45 virtual void GetDocument(const std::string& authority, | |
46 const std::string& document_id, | |
47 const GetDocumentCallback& callback) = 0; | |
48 virtual void GetChildDocuments(const std::string& authority, | |
49 const std::string& parent_document_id, | |
50 const GetChildDocumentsCallback& callback) = 0; | |
51 }; | |
52 | |
53 } // namespace arc | |
54 | |
55 #endif // COMPONENTS_ARC_FILE_SYSTEM_ARC_FILE_SYSTEM_OPERATION_RUNNER_H_ | |
OLD | NEW |