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

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

Issue 2572683004: mediaview: Introduce ArcDocumentsProviderRoot. (Closed)
Patch Set: Fix failing unit tests. 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
(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,
Luis Héctor Chávez 2016/12/15 21:26:10 I couldn't find any calls for this function from a
Shuhei Takahashi 2016/12/16 03:21:12 Makes sense. I've just moved the implementation in
36 const std::string& root_document_id) const;
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) const;
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 _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698