OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_CHROMEOS_ARC_FILEAPI_ARC_DOCUMENTS_PROVIDER_ROOT_MAP_H_ | |
6 #define CHROME_BROWSER_CHROMEOS_ARC_FILEAPI_ARC_DOCUMENTS_PROVIDER_ROOT_MAP_H_ | |
7 | |
8 #include <map> | |
9 #include <memory> | |
10 #include <string> | |
11 #include <utility> | |
12 | |
13 #include "base/files/file_path.h" | |
14 #include "base/macros.h" | |
15 | |
16 namespace storage { | |
17 class FileSystemURL; | |
18 } // namespace storage | |
19 | |
20 namespace arc { | |
21 | |
22 class ArcDocumentsProviderRoot; | |
23 | |
24 // Container of ArcDocumentsProviderRoot instances. | |
25 // | |
26 // This class is thread-safe, but ArcDocumentsProviderRoot must be accessed | |
27 // only on the IO thread anyway. | |
28 class ArcDocumentsProviderRootMap { | |
29 public: | |
30 ArcDocumentsProviderRootMap(); | |
31 ~ArcDocumentsProviderRootMap(); | |
32 | |
33 // Looks up a root corresponding to |authority| and |root_document_id|. | |
34 // Returns nullptr if no such root is registered. | |
35 ArcDocumentsProviderRoot* Lookup(const std::string& authority, | |
36 const std::string& root_document_id); | |
hashimoto
2016/12/15 03:53:22
const?
Shuhei Takahashi
2016/12/15 05:21:53
Done.
| |
37 | |
38 // Looks up a root corresponding to |url|. | |
39 // |path| is set to the remaining path part of |url|. | |
40 // Returns nullptr if |url| is invalid or no corresponding root is registered. | |
41 ArcDocumentsProviderRoot* ParseAndLookup(const storage::FileSystemURL& url, | |
42 base::FilePath* path); | |
hashimoto
2016/12/15 03:53:22
const?
Shuhei Takahashi
2016/12/15 05:21:53
Done.
| |
43 | |
44 private: | |
45 // Key is (authority, root_document_id). | |
46 using Key = std::pair<std::string, std::string>; | |
47 std::map<Key, std::unique_ptr<ArcDocumentsProviderRoot>> map_; | |
48 | |
49 DISALLOW_COPY_AND_ASSIGN(ArcDocumentsProviderRootMap); | |
50 }; | |
51 | |
52 } // namespace arc | |
53 | |
54 #endif // CHROME_BROWSER_CHROMEOS_ARC_FILEAPI_ARC_DOCUMENTS_PROVIDER_ROOT_MAP_H _ | |
OLD | NEW |