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 |url|. |
| 34 // |path| is set to the remaining path part of |url|. |
| 35 // Returns nullptr if |url| is invalid or no corresponding root is registered. |
| 36 ArcDocumentsProviderRoot* ParseAndLookup(const storage::FileSystemURL& url, |
| 37 base::FilePath* path) const; |
| 38 |
| 39 private: |
| 40 // Key is (authority, root_document_id). |
| 41 using Key = std::pair<std::string, std::string>; |
| 42 std::map<Key, std::unique_ptr<ArcDocumentsProviderRoot>> map_; |
| 43 |
| 44 DISALLOW_COPY_AND_ASSIGN(ArcDocumentsProviderRootMap); |
| 45 }; |
| 46 |
| 47 } // namespace arc |
| 48 |
| 49 #endif // CHROME_BROWSER_CHROMEOS_ARC_FILEAPI_ARC_DOCUMENTS_PROVIDER_ROOT_MAP_H
_ |
OLD | NEW |