Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: chrome/browser/chromeos/arc/fileapi/arc_documents_provider_root.h

Issue 2574173002: mediaview: Implement ArcDocumentsProviderRoot. (Closed)
Patch Set: Rebased to ToT. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_ROOT_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_ARC_FILEAPI_ARC_DOCUMENTS_PROVIDER_ROOT_H_
6 #define CHROME_BROWSER_CHROMEOS_ARC_FILEAPI_ARC_DOCUMENTS_PROVIDER_ROOT_H_ 6 #define CHROME_BROWSER_CHROMEOS_ARC_FILEAPI_ARC_DOCUMENTS_PROVIDER_ROOT_H_
7 7
8 #include <memory>
8 #include <string> 9 #include <string>
10 #include <vector>
9 11
10 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
11 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/weak_ptr.h"
15 #include "base/optional.h"
16 #include "components/arc/common/file_system.mojom.h"
12 #include "storage/browser/fileapi/async_file_util.h" 17 #include "storage/browser/fileapi/async_file_util.h"
13 18
14 namespace arc { 19 namespace arc {
15 20
21 class ArcDocumentsProviderDocument;
22
16 // Represents a file system root in Android Documents Provider. 23 // Represents a file system root in Android Documents Provider.
17 // 24 //
18 // All methods must be called on the IO thread. 25 // All methods must be called on the IO thread.
26 // If this object is deleted while there are in-flight operations, callbacks
27 // for those operations will be never called.
19 class ArcDocumentsProviderRoot { 28 class ArcDocumentsProviderRoot {
20 public: 29 public:
21 using GetFileInfoCallback = storage::AsyncFileUtil::GetFileInfoCallback; 30 using GetFileInfoCallback = storage::AsyncFileUtil::GetFileInfoCallback;
22 using ReadDirectoryCallback = storage::AsyncFileUtil::ReadDirectoryCallback; 31 using ReadDirectoryCallback = storage::AsyncFileUtil::ReadDirectoryCallback;
23 32
24 ArcDocumentsProviderRoot(const std::string& authority, 33 ArcDocumentsProviderRoot(const std::string& authority,
25 const std::string& root_document_id); 34 const std::string& root_document_id);
26 ~ArcDocumentsProviderRoot(); 35 ~ArcDocumentsProviderRoot();
27 36
28 // Queries information of a file just like AsyncFileUtil.GetFileInfo(). 37 // Queries information of a file just like AsyncFileUtil.GetFileInfo().
29 void GetFileInfo(const base::FilePath& path, 38 void GetFileInfo(const base::FilePath& path,
30 const GetFileInfoCallback& callback); 39 const GetFileInfoCallback& callback);
31 40
32 // Queries a list of files under a directory just like 41 // Queries a list of files under a directory just like
33 // AsyncFileUtil.ReadDirectory(). 42 // AsyncFileUtil.ReadDirectory().
34 void ReadDirectory(const base::FilePath& path, 43 void ReadDirectory(const base::FilePath& path,
35 const ReadDirectoryCallback& callback); 44 const ReadDirectoryCallback& callback);
36 45
37 private: 46 private:
47 void GetFileInfoAfterCacheUpdate(const base::FilePath& path,
48 const GetFileInfoCallback& callback);
49 void GetFileInfoWithDocument(const GetFileInfoCallback& callback,
50 mojom::DocumentPtr document);
51
52 void ReadDirectoryAfterCacheUpdate(const base::FilePath& path,
53 const ReadDirectoryCallback& callback);
54 void ReadDirectoryWithChildDocuments(
55 const base::FilePath& path,
56 const ReadDirectoryCallback& callback,
57 base::Optional<std::vector<mojom::DocumentPtr>> children);
58
59 void UpdateDirectoryCacheUpTo(const base::FilePath& path,
hashimoto 2016/12/19 06:40:48 Please add a comment to describe what this method
Shuhei Takahashi 2016/12/19 10:01:56 N/A
60 const base::Closure& callback);
61 void UpdateDirectoryCacheIter(const base::FilePath& parent_directory_path,
hashimoto 2016/12/19 06:40:48 What does "iter" mean? Generally speaking, you sho
Shuhei Takahashi 2016/12/19 10:01:56 N/A
62 const base::FilePath& remaining_path,
63 const base::Closure& callback);
64 void UpdateDirectoryCacheIterWithChildDocuments(
65 const base::FilePath& parent_directory_path,
66 const base::FilePath& remaining_path,
67 const base::Closure& callback,
68 base::Optional<std::vector<mojom::DocumentPtr>> children);
69
70 const std::string authority_;
71 const std::unique_ptr<ArcDocumentsProviderDocument> root_directory_;
72 base::WeakPtrFactory<ArcDocumentsProviderRoot> weak_ptr_factory_;
73
38 DISALLOW_COPY_AND_ASSIGN(ArcDocumentsProviderRoot); 74 DISALLOW_COPY_AND_ASSIGN(ArcDocumentsProviderRoot);
39 }; 75 };
40 76
41 } // namespace arc 77 } // namespace arc
42 78
43 #endif // CHROME_BROWSER_CHROMEOS_ARC_FILEAPI_ARC_DOCUMENTS_PROVIDER_ROOT_H_ 79 #endif // CHROME_BROWSER_CHROMEOS_ARC_FILEAPI_ARC_DOCUMENTS_PROVIDER_ROOT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698