| OLD | NEW |
| 1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 * Use of this source code is governed by a BSD-style license that can be | 2 * Use of this source code is governed by a BSD-style license that can be |
| 3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
| 4 */ | 4 */ |
| 5 #ifndef LIBRARIES_NACL_MOUNTS_PEPPER_INTERFACE_H_ | 5 #ifndef LIBRARIES_NACL_MOUNTS_PEPPER_INTERFACE_H_ |
| 6 #define LIBRARIES_NACL_MOUNTS_PEPPER_INTERFACE_H_ | 6 #define LIBRARIES_NACL_MOUNTS_PEPPER_INTERFACE_H_ |
| 7 | 7 |
| 8 #include <ppapi/c/dev/ppb_directory_reader_dev.h> | 8 #include <ppapi/c/dev/ppb_directory_reader_dev.h> |
| 9 #include <ppapi/c/pp_completion_callback.h> | 9 #include <ppapi/c/pp_completion_callback.h> |
| 10 #include <ppapi/c/pp_instance.h> | 10 #include <ppapi/c/pp_instance.h> |
| 11 #include <ppapi/c/pp_resource.h> | 11 #include <ppapi/c/pp_resource.h> |
| 12 #include <ppapi/c/pp_var.h> | 12 #include <ppapi/c/pp_var.h> |
| 13 #include <ppapi/c/ppb_console.h> |
| 14 #include <ppapi/c/ppb_messaging.h> |
| 15 |
| 13 #include <utils/macros.h> | 16 #include <utils/macros.h> |
| 14 | 17 |
| 18 class ConsoleInterface; |
| 15 class DirectoryReaderInterface; | 19 class DirectoryReaderInterface; |
| 16 class FileIoInterface; | 20 class FileIoInterface; |
| 17 class FileRefInterface; | 21 class FileRefInterface; |
| 18 class FileSystemInterface; | 22 class FileSystemInterface; |
| 23 class MessagingInterface; |
| 19 class VarInterface; | 24 class VarInterface; |
| 20 | 25 |
| 21 class PepperInterface { | 26 class PepperInterface { |
| 22 public: | 27 public: |
| 23 virtual ~PepperInterface() {} | 28 virtual ~PepperInterface() {} |
| 24 virtual PP_Instance GetInstance() = 0; | 29 virtual PP_Instance GetInstance() = 0; |
| 25 virtual void AddRefResource(PP_Resource) = 0; | 30 virtual void AddRefResource(PP_Resource) = 0; |
| 26 virtual void ReleaseResource(PP_Resource) = 0; | 31 virtual void ReleaseResource(PP_Resource) = 0; |
| 32 virtual ConsoleInterface* GetConsoleInterface() = 0; |
| 27 virtual FileSystemInterface* GetFileSystemInterface() = 0; | 33 virtual FileSystemInterface* GetFileSystemInterface() = 0; |
| 28 virtual FileRefInterface* GetFileRefInterface() = 0; | 34 virtual FileRefInterface* GetFileRefInterface() = 0; |
| 29 virtual FileIoInterface* GetFileIoInterface() = 0; | 35 virtual FileIoInterface* GetFileIoInterface() = 0; |
| 30 virtual DirectoryReaderInterface* GetDirectoryReaderInterface() = 0; | 36 virtual DirectoryReaderInterface* GetDirectoryReaderInterface() = 0; |
| 37 virtual MessagingInterface* GetMessagingInterface() = 0; |
| 31 virtual VarInterface* GetVarInterface() = 0; | 38 virtual VarInterface* GetVarInterface() = 0; |
| 32 }; | 39 }; |
| 33 | 40 |
| 41 class ConsoleInterface { |
| 42 public: |
| 43 virtual ~ConsoleInterface() {} |
| 44 virtual void Log(PP_Instance, PP_LogLevel, struct PP_Var) = 0; |
| 45 }; |
| 46 |
| 34 class FileSystemInterface { | 47 class FileSystemInterface { |
| 35 public: | 48 public: |
| 36 virtual ~FileSystemInterface() {} | 49 virtual ~FileSystemInterface() {} |
| 37 virtual PP_Resource Create(PP_Instance, PP_FileSystemType) = 0; | 50 virtual PP_Resource Create(PP_Instance, PP_FileSystemType) = 0; |
| 38 virtual int32_t Open(PP_Resource, int64_t, PP_CompletionCallback) = 0; | 51 virtual int32_t Open(PP_Resource, int64_t, PP_CompletionCallback) = 0; |
| 39 }; | 52 }; |
| 40 | 53 |
| 41 class FileRefInterface { | 54 class FileRefInterface { |
| 42 public: | 55 public: |
| 43 virtual ~FileRefInterface() {} | 56 virtual ~FileRefInterface() {} |
| (...skipping 23 matching lines...) Expand all Loading... |
| 67 }; | 80 }; |
| 68 | 81 |
| 69 class DirectoryReaderInterface { | 82 class DirectoryReaderInterface { |
| 70 public: | 83 public: |
| 71 virtual ~DirectoryReaderInterface() {} | 84 virtual ~DirectoryReaderInterface() {} |
| 72 virtual PP_Resource Create(PP_Resource) = 0; | 85 virtual PP_Resource Create(PP_Resource) = 0; |
| 73 virtual int32_t GetNextEntry(PP_Resource, PP_DirectoryEntry_Dev*, | 86 virtual int32_t GetNextEntry(PP_Resource, PP_DirectoryEntry_Dev*, |
| 74 PP_CompletionCallback) = 0; | 87 PP_CompletionCallback) = 0; |
| 75 }; | 88 }; |
| 76 | 89 |
| 90 class MessagingInterface { |
| 91 public: |
| 92 virtual ~MessagingInterface() {} |
| 93 virtual void PostMessage(PP_Instance, struct PP_Var ) = 0; |
| 94 }; |
| 95 |
| 77 class VarInterface { | 96 class VarInterface { |
| 78 public: | 97 public: |
| 79 virtual ~VarInterface() {} | 98 virtual ~VarInterface() {} |
| 99 virtual struct PP_Var VarFromUtf8(const char*, uint32_t) = 0; |
| 80 virtual const char* VarToUtf8(PP_Var, uint32_t*) = 0; | 100 virtual const char* VarToUtf8(PP_Var, uint32_t*) = 0; |
| 81 }; | 101 }; |
| 82 | 102 |
| 83 | 103 |
| 84 class ScopedResource { | 104 class ScopedResource { |
| 85 public: | 105 public: |
| 86 struct NoAddRef {}; | 106 struct NoAddRef {}; |
| 87 | 107 |
| 88 ScopedResource(PepperInterface* ppapi, PP_Resource resource); | 108 ScopedResource(PepperInterface* ppapi, PP_Resource resource); |
| 89 ScopedResource(PepperInterface* ppapi, PP_Resource resource, NoAddRef); | 109 ScopedResource(PepperInterface* ppapi, PP_Resource resource, NoAddRef); |
| 90 ~ScopedResource(); | 110 ~ScopedResource(); |
| 91 | 111 |
| 92 private: | 112 private: |
| 93 PepperInterface* ppapi_; | 113 PepperInterface* ppapi_; |
| 94 PP_Resource resource_; | 114 PP_Resource resource_; |
| 95 | 115 |
| 96 DISALLOW_COPY_AND_ASSIGN(ScopedResource); | 116 DISALLOW_COPY_AND_ASSIGN(ScopedResource); |
| 97 }; | 117 }; |
| 98 | 118 |
| 99 #endif // LIBRARIES_NACL_MOUNTS_PEPPER_INTERFACE_H_ | 119 #endif // LIBRARIES_NACL_MOUNTS_PEPPER_INTERFACE_H_ |
| OLD | NEW |