Chromium Code Reviews| 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/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
|
| + 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_ |