OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 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 PPAPI_HOST_FILE_SYSTEM_REGISTRY_H_ | |
6 #define PPAPI_HOST_FILE_SYSTEM_REGISTRY_H_ | |
7 | |
8 #include <map> | |
9 #include <string> | |
10 #include <utility> | |
11 | |
12 #include "base/basictypes.h" | |
13 #include "base/memory/singleton.h" | |
14 #include "ppapi/c/pp_file_info.h" | |
15 #include "ppapi/c/pp_instance.h" | |
16 #include "ppapi/c/pp_resource.h" | |
17 #include "ppapi/host/ppapi_host_export.h" | |
18 | |
19 class GURL; | |
20 | |
21 namespace ppapi { | |
22 namespace host { | |
23 | |
24 // A singleton class to manage file system registry. The main purpose of this | |
25 // class is to allow a host to peek information of a registered file system, | |
26 // which can be a PPB_FileSystem or PPB_Ext_CrxFileSystem_Private. | |
27 class PPAPI_HOST_EXPORT FileSystemRegistry { | |
yzshen1
2013/04/30 19:31:19
I think we don't need to have yet another map.
We
victorhsieh
2013/04/30 22:04:32
Do you mean to add a ...
FileSystemHostBase* Resou
yzshen1
2013/05/01 17:45:10
I agree. :/ This is another reason I think we shou
| |
28 public: | |
29 class FileSystemPeeker { | |
30 public: | |
31 virtual PP_FileSystemType GetType() const = 0; | |
32 virtual bool IsOpened() const = 0; | |
33 virtual const GURL& GetRootUrl() const = 0; | |
34 }; | |
35 | |
36 static FileSystemRegistry* GetInstance(); | |
37 | |
38 void Register(PP_Instance instance, | |
39 PP_Resource resource, | |
40 const FileSystemPeeker* peeker); | |
41 | |
42 void Unregister(PP_Instance instance, PP_Resource resource); | |
43 | |
44 const FileSystemPeeker& LookUp(PP_Instance instance, | |
45 PP_Resource resource) const; | |
46 | |
47 private: | |
48 FileSystemRegistry(); | |
49 ~FileSystemRegistry(); | |
50 friend struct DefaultSingletonTraits<FileSystemRegistry>; | |
51 | |
52 typedef std::map<std::pair<PP_Instance, PP_Resource>, | |
53 const FileSystemPeeker*> ResourceMap; | |
54 ResourceMap mapping_; | |
55 | |
56 DISALLOW_COPY_AND_ASSIGN(FileSystemRegistry); | |
57 }; | |
58 | |
59 } // namespace host | |
60 } // namespace ppapi | |
61 | |
62 #endif // PPAPI_HOST_FILE_SYSTEM_REGISTRY_H_ | |
OLD | NEW |