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 WEBKIT_PLUGINS_PPAPI_PLUGIN_MODULE_H_ | 5 #ifndef WEBKIT_PLUGINS_PPAPI_PLUGIN_MODULE_H_ |
6 #define WEBKIT_PLUGINS_PPAPI_PLUGIN_MODULE_H_ | 6 #define WEBKIT_PLUGINS_PPAPI_PLUGIN_MODULE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 | 76 |
77 typedef std::set<PluginInstance*> PluginInstanceSet; | 77 typedef std::set<PluginInstance*> PluginInstanceSet; |
78 | 78 |
79 // You must call one of the Init functions after the constructor to create a | 79 // You must call one of the Init functions after the constructor to create a |
80 // module of the type you desire. | 80 // module of the type you desire. |
81 // | 81 // |
82 // The module lifetime delegate is a non-owning pointer that must outlive | 82 // The module lifetime delegate is a non-owning pointer that must outlive |
83 // all plugin modules. In practice it will be a global singleton that | 83 // all plugin modules. In practice it will be a global singleton that |
84 // tracks which modules are alive. | 84 // tracks which modules are alive. |
85 PluginModule(const std::string& name, | 85 PluginModule(const std::string& name, |
| 86 const std::string& version, |
86 const FilePath& path, | 87 const FilePath& path, |
87 PluginDelegate::ModuleLifetime* lifetime_delegate, | 88 PluginDelegate::ModuleLifetime* lifetime_delegate, |
88 const ::ppapi::PpapiPermissions& perms); | 89 const ::ppapi::PpapiPermissions& perms); |
89 | 90 |
90 ~PluginModule(); | 91 ~PluginModule(); |
91 | 92 |
92 // Sets the given class as being associated with this module. It will be | 93 // Sets the given class as being associated with this module. It will be |
93 // deleted when the module is destroyed. You can only set it once, subsequent | 94 // deleted when the module is destroyed. You can only set it once, subsequent |
94 // sets will assert. | 95 // sets will assert. |
95 // | 96 // |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 // registration. | 134 // registration. |
134 // NOTE: those custom interfaces provided by PpapiInterfaceFactoryManager | 135 // NOTE: those custom interfaces provided by PpapiInterfaceFactoryManager |
135 // will not be considered when called on the browser process. | 136 // will not be considered when called on the browser process. |
136 static bool SupportsInterface(const char* name); | 137 static bool SupportsInterface(const char* name); |
137 | 138 |
138 // Returns the module handle. This may be used before Init() is called (the | 139 // Returns the module handle. This may be used before Init() is called (the |
139 // proxy needs this information to set itself up properly). | 140 // proxy needs this information to set itself up properly). |
140 PP_Module pp_module() const { return pp_module_; } | 141 PP_Module pp_module() const { return pp_module_; } |
141 | 142 |
142 const std::string& name() const { return name_; } | 143 const std::string& name() const { return name_; } |
| 144 const std::string& version() const { return version_; } |
143 const FilePath& path() const { return path_; } | 145 const FilePath& path() const { return path_; } |
144 const ::ppapi::PpapiPermissions& permissions() const { return permissions_; } | 146 const ::ppapi::PpapiPermissions& permissions() const { return permissions_; } |
145 | 147 |
146 PluginInstance* CreateInstance(PluginDelegate* delegate, | 148 PluginInstance* CreateInstance(PluginDelegate* delegate, |
147 WebKit::WebPluginContainer* container, | 149 WebKit::WebPluginContainer* container, |
148 const GURL& plugin_url); | 150 const GURL& plugin_url); |
149 | 151 |
150 // Returns "some" plugin instance associated with this module. This is not | 152 // Returns "some" plugin instance associated with this module. This is not |
151 // guaranteed to be any one in particular. This is normally used to execute | 153 // guaranteed to be any one in particular. This is normally used to execute |
152 // callbacks up to the browser layer that are not inherently per-instance, | 154 // callbacks up to the browser layer that are not inherently per-instance, |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 // instance wraps functions loaded from a library. Can be NULL. If | 230 // instance wraps functions loaded from a library. Can be NULL. If |
229 // |library_| is non-NULL, PluginModule will attempt to unload the library | 231 // |library_| is non-NULL, PluginModule will attempt to unload the library |
230 // during destruction. | 232 // during destruction. |
231 base::NativeLibrary library_; | 233 base::NativeLibrary library_; |
232 | 234 |
233 // Contains pointers to the entry points of the actual plugin implementation. | 235 // Contains pointers to the entry points of the actual plugin implementation. |
234 // These will be NULL for out-of-process plugins, which is indicated by the | 236 // These will be NULL for out-of-process plugins, which is indicated by the |
235 // presence of the out_of_process_proxy_ value. | 237 // presence of the out_of_process_proxy_ value. |
236 EntryPoints entry_points_; | 238 EntryPoints entry_points_; |
237 | 239 |
238 // The name and file location of the module. | 240 // The name, version, and file location of the module. |
239 const std::string name_; | 241 const std::string name_; |
| 242 const std::string version_; |
240 const FilePath path_; | 243 const FilePath path_; |
241 | 244 |
242 ::ppapi::PpapiPermissions permissions_; | 245 ::ppapi::PpapiPermissions permissions_; |
243 | 246 |
244 // Non-owning pointers to all instances associated with this module. When | 247 // Non-owning pointers to all instances associated with this module. When |
245 // there are no more instances, this object should be deleted. | 248 // there are no more instances, this object should be deleted. |
246 PluginInstanceSet instances_; | 249 PluginInstanceSet instances_; |
247 | 250 |
248 PP_Bool (*reserve_instance_id_)(PP_Module, PP_Instance); | 251 PP_Bool (*reserve_instance_id_)(PP_Module, PP_Instance); |
249 | 252 |
250 DISALLOW_COPY_AND_ASSIGN(PluginModule); | 253 DISALLOW_COPY_AND_ASSIGN(PluginModule); |
251 }; | 254 }; |
252 | 255 |
253 } // namespace ppapi | 256 } // namespace ppapi |
254 } // namespace webkit | 257 } // namespace webkit |
255 | 258 |
256 #endif // WEBKIT_PLUGINS_PPAPI_PLUGIN_MODULE_H_ | 259 #endif // WEBKIT_PLUGINS_PPAPI_PLUGIN_MODULE_H_ |
OLD | NEW |