| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 PPAPI_CPP_MODULE_H_ | 5 #ifndef PPAPI_CPP_MODULE_H_ |
| 6 #define PPAPI_CPP_MODULE_H_ | 6 #define PPAPI_CPP_MODULE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "ppapi/c/pp_instance.h" | 11 #include "ppapi/c/pp_instance.h" |
| 12 #include "ppapi/c/pp_module.h" | 12 #include "ppapi/c/pp_module.h" |
| 13 #include "ppapi/c/pp_stdint.h" | 13 #include "ppapi/c/pp_stdint.h" |
| 14 #include "ppapi/c/ppb.h" | 14 #include "ppapi/c/ppb.h" |
| 15 #include "ppapi/c/ppb_core.h" | 15 #include "ppapi/c/ppb_core.h" |
| 16 #include "ppapi/cpp/common.h" |
| 16 #include "ppapi/cpp/core.h" | 17 #include "ppapi/cpp/core.h" |
| 17 | 18 |
| 18 namespace pp { | 19 namespace pp { |
| 19 | 20 |
| 20 class Instance; | 21 class Instance; |
| 21 | 22 |
| 22 class Module { | 23 class Module { |
| 23 public: | 24 public: |
| 24 // You may not call any other PP functions from the constructor, put them | 25 // You may not call any other PP functions from the constructor, put them |
| 25 // in Init instead. Various things will not be set up until the constructor | 26 // in Init instead. Various things will not be set up until the constructor |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 // TODO(brettw) make this private when I can figure out how to make the | 87 // TODO(brettw) make this private when I can figure out how to make the |
| 87 // initialize function a friend. | 88 // initialize function a friend. |
| 88 bool InternalInit(PP_Module mod, | 89 bool InternalInit(PP_Module mod, |
| 89 PPB_GetInterface get_browser_interface); | 90 PPB_GetInterface get_browser_interface); |
| 90 | 91 |
| 91 protected: | 92 protected: |
| 92 // Override to create your own plugin type. | 93 // Override to create your own plugin type. |
| 93 virtual Instance* CreateInstance(PP_Instance instance) = 0; | 94 virtual Instance* CreateInstance(PP_Instance instance) = 0; |
| 94 | 95 |
| 95 private: | 96 private: |
| 96 friend bool Instance_DidCreate(PP_Instance pp_instance, | 97 friend PP_Bool Instance_DidCreate(PP_Instance pp_instance, |
| 97 uint32_t argc, | 98 uint32_t argc, |
| 98 const char* argn[], | 99 const char* argn[], |
| 99 const char* argv[]); | 100 const char* argv[]); |
| 100 friend void Instance_DidDestroy(PP_Instance instance); | 101 friend void Instance_DidDestroy(PP_Instance instance); |
| 101 | 102 |
| 102 // Unimplemented (disallow copy and assign). | 103 // Unimplemented (disallow copy and assign). |
| 103 Module(const Module&); | 104 Module(const Module&); |
| 104 Module& operator=(const Module&); | 105 Module& operator=(const Module&); |
| 105 | 106 |
| 106 // Instance tracking. | 107 // Instance tracking. |
| 107 typedef std::map<PP_Instance, Instance*> InstanceMap; | 108 typedef std::map<PP_Instance, Instance*> InstanceMap; |
| 108 InstanceMap current_instances_; | 109 InstanceMap current_instances_; |
| 109 | 110 |
| 110 PP_Module pp_module_; | 111 PP_Module pp_module_; |
| 111 PPB_GetInterface get_browser_interface_; | 112 PPB_GetInterface get_browser_interface_; |
| 112 | 113 |
| 113 Core* core_; | 114 Core* core_; |
| 114 | 115 |
| 115 // All additional interfaces this plugin can handle as registered by | 116 // All additional interfaces this plugin can handle as registered by |
| 116 // AddPluginInterface. | 117 // AddPluginInterface. |
| 117 typedef std::map<std::string, const void*> InterfaceMap; | 118 typedef std::map<std::string, const void*> InterfaceMap; |
| 118 InterfaceMap additional_interfaces_; | 119 InterfaceMap additional_interfaces_; |
| 119 }; | 120 }; |
| 120 | 121 |
| 121 } // namespace pp | 122 } // namespace pp |
| 122 | 123 |
| 123 #endif // PPAPI_CPP_MODULE_H_ | 124 #endif // PPAPI_CPP_MODULE_H_ |
| OLD | NEW |