Index: ppapi/host/file_system_registry.h |
diff --git a/ppapi/host/file_system_registry.h b/ppapi/host/file_system_registry.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..763aad35f83132ecc7b9d605bf1b12fbc73e691e |
--- /dev/null |
+++ b/ppapi/host/file_system_registry.h |
@@ -0,0 +1,62 @@ |
+// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef PPAPI_HOST_FILE_SYSTEM_REGISTRY_H_ |
+#define PPAPI_HOST_FILE_SYSTEM_REGISTRY_H_ |
+ |
+#include <map> |
+#include <string> |
+#include <utility> |
+ |
+#include "base/basictypes.h" |
+#include "base/memory/singleton.h" |
+#include "ppapi/c/pp_file_info.h" |
+#include "ppapi/c/pp_instance.h" |
+#include "ppapi/c/pp_resource.h" |
+#include "ppapi/host/ppapi_host_export.h" |
+ |
+class GURL; |
+ |
+namespace ppapi { |
+namespace host { |
+ |
+// A singleton class to manage file system registry. The main purpose of this |
+// class is to allow a host to peek information of a registered file system, |
+// which can be a PPB_FileSystem or PPB_Ext_CrxFileSystem_Private. |
+class PPAPI_HOST_EXPORT FileSystemRegistry { |
yzshen1
2013/05/02 23:22:01
Please delete it entirely.
victorhsieh
2013/05/03 17:26:58
Done.
|
+ public: |
+ class FileSystemPeeker { |
+ public: |
+ virtual PP_FileSystemType GetType() const = 0; |
+ virtual bool IsOpened() const = 0; |
+ virtual const GURL& GetRootUrl() const = 0; |
+ }; |
+ |
+ static FileSystemRegistry* GetInstance(); |
+ |
+ void Register(PP_Instance instance, |
+ PP_Resource resource, |
+ const FileSystemPeeker* peeker); |
+ |
+ void Unregister(PP_Instance instance, PP_Resource resource); |
+ |
+ const FileSystemPeeker& LookUp(PP_Instance instance, |
+ PP_Resource resource) const; |
+ |
+ private: |
+ FileSystemRegistry(); |
+ ~FileSystemRegistry(); |
+ friend struct DefaultSingletonTraits<FileSystemRegistry>; |
+ |
+ typedef std::map<std::pair<PP_Instance, PP_Resource>, |
+ const FileSystemPeeker*> ResourceMap; |
+ ResourceMap mapping_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(FileSystemRegistry); |
+}; |
+ |
+} // namespace host |
+} // namespace ppapi |
+ |
+#endif // PPAPI_HOST_FILE_SYSTEM_REGISTRY_H_ |