| 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 CONTENT_RENDERER_PEPPER_PLUGIN_MODULE_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PLUGIN_MODULE_H_ |
| 6 #define CONTENT_RENDERER_PEPPER_PLUGIN_MODULE_H_ | 6 #define CONTENT_RENDERER_PEPPER_PLUGIN_MODULE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 public: | 63 public: |
| 64 typedef std::set<PepperPluginInstanceImpl*> PluginInstanceSet; | 64 typedef std::set<PepperPluginInstanceImpl*> PluginInstanceSet; |
| 65 | 65 |
| 66 // You must call one of the Init functions after the constructor to create a | 66 // You must call one of the Init functions after the constructor to create a |
| 67 // module of the type you desire. | 67 // module of the type you desire. |
| 68 // | 68 // |
| 69 // The module lifetime delegate is a non-owning pointer that must outlive | 69 // The module lifetime delegate is a non-owning pointer that must outlive |
| 70 // all plugin modules. In practice it will be a global singleton that | 70 // all plugin modules. In practice it will be a global singleton that |
| 71 // tracks which modules are alive. | 71 // tracks which modules are alive. |
| 72 PluginModule(const std::string& name, | 72 PluginModule(const std::string& name, |
| 73 const std::string& version, |
| 73 const base::FilePath& path, | 74 const base::FilePath& path, |
| 74 const ppapi::PpapiPermissions& perms); | 75 const ppapi::PpapiPermissions& perms); |
| 75 | 76 |
| 76 // Sets the given class as being associated with this module. It will be | 77 // Sets the given class as being associated with this module. It will be |
| 77 // deleted when the module is destroyed. You can only set it once, subsequent | 78 // deleted when the module is destroyed. You can only set it once, subsequent |
| 78 // sets will assert. | 79 // sets will assert. |
| 79 void SetRendererPpapiHost(scoped_ptr<RendererPpapiHostImpl> host); | 80 void SetRendererPpapiHost(scoped_ptr<RendererPpapiHostImpl> host); |
| 80 | 81 |
| 81 // Initializes this module as an internal plugin with the given entrypoints. | 82 // Initializes this module as an internal plugin with the given entrypoints. |
| 82 // This is used for "plugins" compiled into Chrome. Returns true on success. | 83 // This is used for "plugins" compiled into Chrome. Returns true on success. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 | 128 |
| 128 RendererPpapiHostImpl* renderer_ppapi_host() { | 129 RendererPpapiHostImpl* renderer_ppapi_host() { |
| 129 return renderer_ppapi_host_.get(); | 130 return renderer_ppapi_host_.get(); |
| 130 } | 131 } |
| 131 | 132 |
| 132 // Returns the module handle. This may be used before Init() is called (the | 133 // Returns the module handle. This may be used before Init() is called (the |
| 133 // proxy needs this information to set itself up properly). | 134 // proxy needs this information to set itself up properly). |
| 134 PP_Module pp_module() const { return pp_module_; } | 135 PP_Module pp_module() const { return pp_module_; } |
| 135 | 136 |
| 136 const std::string& name() const { return name_; } | 137 const std::string& name() const { return name_; } |
| 138 const std::string& version() const { return version_; } |
| 137 const base::FilePath& path() const { return path_; } | 139 const base::FilePath& path() const { return path_; } |
| 138 const ppapi::PpapiPermissions& permissions() const { return permissions_; } | 140 const ppapi::PpapiPermissions& permissions() const { return permissions_; } |
| 139 | 141 |
| 140 PepperPluginInstanceImpl* CreateInstance(RenderFrameImpl* render_frame, | 142 PepperPluginInstanceImpl* CreateInstance(RenderFrameImpl* render_frame, |
| 141 blink::WebPluginContainer* container, | 143 blink::WebPluginContainer* container, |
| 142 const GURL& plugin_url); | 144 const GURL& plugin_url); |
| 143 | 145 |
| 144 // Returns "some" plugin instance associated with this module. This is not | 146 // Returns "some" plugin instance associated with this module. This is not |
| 145 // guaranteed to be any one in particular. This is normally used to execute | 147 // guaranteed to be any one in particular. This is normally used to execute |
| 146 // callbacks up to the browser layer that are not inherently per-instance, | 148 // callbacks up to the browser layer that are not inherently per-instance, |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 // instance wraps functions loaded from a library. Can be NULL. If | 251 // instance wraps functions loaded from a library. Can be NULL. If |
| 250 // |library_| is non-NULL, PluginModule will attempt to unload the library | 252 // |library_| is non-NULL, PluginModule will attempt to unload the library |
| 251 // during destruction. | 253 // during destruction. |
| 252 base::NativeLibrary library_; | 254 base::NativeLibrary library_; |
| 253 | 255 |
| 254 // Contains pointers to the entry points of the actual plugin implementation. | 256 // Contains pointers to the entry points of the actual plugin implementation. |
| 255 // These will be NULL for out-of-process plugins, which is indicated by the | 257 // These will be NULL for out-of-process plugins, which is indicated by the |
| 256 // presence of the host_dispatcher_wrapper_ value. | 258 // presence of the host_dispatcher_wrapper_ value. |
| 257 PepperPluginInfo::EntryPoints entry_points_; | 259 PepperPluginInfo::EntryPoints entry_points_; |
| 258 | 260 |
| 259 // The name and file location of the module. | 261 // The name, version, and file location of the module. |
| 260 const std::string name_; | 262 const std::string name_; |
| 263 const std::string version_; |
| 261 const base::FilePath path_; | 264 const base::FilePath path_; |
| 262 | 265 |
| 263 ppapi::PpapiPermissions permissions_; | 266 ppapi::PpapiPermissions permissions_; |
| 264 | 267 |
| 265 // Non-owning pointers to all instances associated with this module. When | 268 // Non-owning pointers to all instances associated with this module. When |
| 266 // there are no more instances, this object should be deleted. | 269 // there are no more instances, this object should be deleted. |
| 267 PluginInstanceSet instances_; | 270 PluginInstanceSet instances_; |
| 268 | 271 |
| 269 PP_Bool (*reserve_instance_id_)(PP_Module, PP_Instance); | 272 PP_Bool (*reserve_instance_id_)(PP_Module, PP_Instance); |
| 270 | 273 |
| 271 DISALLOW_COPY_AND_ASSIGN(PluginModule); | 274 DISALLOW_COPY_AND_ASSIGN(PluginModule); |
| 272 }; | 275 }; |
| 273 | 276 |
| 274 } // namespace content | 277 } // namespace content |
| 275 | 278 |
| 276 #endif // CONTENT_RENDERER_PEPPER_PLUGIN_MODULE_H_ | 279 #endif // CONTENT_RENDERER_PEPPER_PLUGIN_MODULE_H_ |
| OLD | NEW |