Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: webkit/plugins/ppapi/plugin_module.h

Issue 10735011: Add permissions buts for Pepper plugins. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/file_path.h" 13 #include "base/file_path.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "base/native_library.h" 17 #include "base/native_library.h"
18 #include "base/process.h" 18 #include "base/process.h"
19 #include "ppapi/c/pp_bool.h" 19 #include "ppapi/c/pp_bool.h"
20 #include "ppapi/c/pp_instance.h" 20 #include "ppapi/c/pp_instance.h"
21 #include "ppapi/c/pp_module.h" 21 #include "ppapi/c/pp_module.h"
22 #include "ppapi/c/ppb.h" 22 #include "ppapi/c/ppb.h"
23 #include "ppapi/c/ppb_core.h" 23 #include "ppapi/c/ppb_core.h"
24 #include "ppapi/shared_impl/ppapi_permissions.h"
24 #include "webkit/plugins/ppapi/plugin_delegate.h" 25 #include "webkit/plugins/ppapi/plugin_delegate.h"
25 #include "webkit/plugins/webkit_plugins_export.h" 26 #include "webkit/plugins/webkit_plugins_export.h"
26 27
27 class FilePath; 28 class FilePath;
28 typedef void* NPIdentifier; 29 typedef void* NPIdentifier;
29 30
30 namespace ppapi { 31 namespace ppapi {
31 class CallbackTracker; 32 class CallbackTracker;
32 class WebKitForwarding; 33 class WebKitForwarding;
33 } // namespace ppapi 34 } // namespace ppapi
(...skipping 29 matching lines...) Expand all
63 typedef std::set<PluginInstance*> PluginInstanceSet; 64 typedef std::set<PluginInstance*> PluginInstanceSet;
64 65
65 // 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
66 // module of the type you desire. 67 // module of the type you desire.
67 // 68 //
68 // 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
69 // 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
70 // tracks which modules are alive. 71 // tracks which modules are alive.
71 PluginModule(const std::string& name, 72 PluginModule(const std::string& name,
72 const FilePath& path, 73 const FilePath& path,
73 PluginDelegate::ModuleLifetime* lifetime_delegate); 74 PluginDelegate::ModuleLifetime* lifetime_delegate,
75 const ::ppapi::PpapiPermissions& perms);
74 76
75 ~PluginModule(); 77 ~PluginModule();
76 78
77 // Initializes this module as an internal plugin with the given entrypoints. 79 // Initializes this module as an internal plugin with the given entrypoints.
78 // This is used for "plugins" compiled into Chrome. Returns true on success. 80 // This is used for "plugins" compiled into Chrome. Returns true on success.
79 // False means that the plugin can not be used. 81 // False means that the plugin can not be used.
80 bool InitAsInternalPlugin(const EntryPoints& entry_points); 82 bool InitAsInternalPlugin(const EntryPoints& entry_points);
81 83
82 // Initializes this module using the given library path as the plugin. 84 // Initializes this module using the given library path as the plugin.
83 // Returns true on success. False means that the plugin can not be used. 85 // Returns true on success. False means that the plugin can not be used.
(...skipping 14 matching lines...) Expand all
98 // Returns a pointer to the local GetInterface function for retrieving 100 // Returns a pointer to the local GetInterface function for retrieving
99 // PPB interfaces. 101 // PPB interfaces.
100 static GetInterfaceFunc GetLocalGetInterfaceFunc(); 102 static GetInterfaceFunc GetLocalGetInterfaceFunc();
101 103
102 // Returns the module handle. This may be used before Init() is called (the 104 // Returns the module handle. This may be used before Init() is called (the
103 // proxy needs this information to set itself up properly). 105 // proxy needs this information to set itself up properly).
104 PP_Module pp_module() const { return pp_module_; } 106 PP_Module pp_module() const { return pp_module_; }
105 107
106 const std::string& name() const { return name_; } 108 const std::string& name() const { return name_; }
107 const FilePath& path() const { return path_; } 109 const FilePath& path() const { return path_; }
110 const ::ppapi::PpapiPermissions permissions() const { return permissions_; }
108 111
109 PluginInstance* CreateInstance(PluginDelegate* delegate); 112 PluginInstance* CreateInstance(PluginDelegate* delegate);
110 113
111 // Returns "some" plugin instance associated with this module. This is not 114 // Returns "some" plugin instance associated with this module. This is not
112 // guaranteed to be any one in particular. This is normally used to execute 115 // guaranteed to be any one in particular. This is normally used to execute
113 // callbacks up to the browser layer that are not inherently per-instance, 116 // callbacks up to the browser layer that are not inherently per-instance,
114 // but the delegate lives only on the plugin instance so we need one of them. 117 // but the delegate lives only on the plugin instance so we need one of them.
115 PluginInstance* GetSomeInstance() const; 118 PluginInstance* GetSomeInstance() const;
116 119
117 const PluginInstanceSet& GetAllInstances() const { return instances_; } 120 const PluginInstanceSet& GetAllInstances() const { return instances_; }
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 193
191 // Contains pointers to the entry points of the actual plugin implementation. 194 // Contains pointers to the entry points of the actual plugin implementation.
192 // These will be NULL for out-of-process plugins, which is indicated by the 195 // These will be NULL for out-of-process plugins, which is indicated by the
193 // presence of the out_of_process_proxy_ value. 196 // presence of the out_of_process_proxy_ value.
194 EntryPoints entry_points_; 197 EntryPoints entry_points_;
195 198
196 // The name and file location of the module. 199 // The name and file location of the module.
197 const std::string name_; 200 const std::string name_;
198 const FilePath path_; 201 const FilePath path_;
199 202
203 ::ppapi::PpapiPermissions permissions_;
204
200 // Non-owning pointers to all instances associated with this module. When 205 // Non-owning pointers to all instances associated with this module. When
201 // there are no more instances, this object should be deleted. 206 // there are no more instances, this object should be deleted.
202 PluginInstanceSet instances_; 207 PluginInstanceSet instances_;
203 208
204 PP_Bool (*reserve_instance_id_)(PP_Module, PP_Instance); 209 PP_Bool (*reserve_instance_id_)(PP_Module, PP_Instance);
205 210
206 bool nacl_ipc_proxy_; 211 bool nacl_ipc_proxy_;
207 212
208 DISALLOW_COPY_AND_ASSIGN(PluginModule); 213 DISALLOW_COPY_AND_ASSIGN(PluginModule);
209 }; 214 };
210 215
211 } // namespace ppapi 216 } // namespace ppapi
212 } // namespace webkit 217 } // namespace webkit
213 218
214 #endif // WEBKIT_PLUGINS_PPAPI_PLUGIN_MODULE_H_ 219 #endif // WEBKIT_PLUGINS_PPAPI_PLUGIN_MODULE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698