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_COMMON_PEPPER_PLUGIN_REGISTRY_H_ | 5 #ifndef CONTENT_COMMON_PEPPER_PLUGIN_REGISTRY_H_ |
6 #define CONTENT_COMMON_PEPPER_PLUGIN_REGISTRY_H_ | 6 #define CONTENT_COMMON_PEPPER_PLUGIN_REGISTRY_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 | 10 |
11 #include "content/public/common/pepper_plugin_info.h" | 11 #include "content/public/common/pepper_plugin_info.h" |
12 #include "webkit/plugins/ppapi/plugin_delegate.h" | 12 #include "webkit/plugins/ppapi/plugin_delegate.h" |
13 | 13 |
14 namespace content { | 14 namespace content { |
15 | 15 |
16 // Constructs a PepperPluginInfo from a WebPluginInfo. Returns false if | 16 // Constructs a PepperPluginInfo from a WebPluginInfo. Returns false if |
17 // the operation is not possible, in particular the WebPluginInfo::type | 17 // the operation is not possible, in particular the WebPluginInfo::type |
18 // must be one of the pepper types. | 18 // must be one of the pepper types. |
19 bool MakePepperPluginInfo(const webkit::WebPluginInfo& webplugin_info, | 19 bool MakePepperPluginInfo(const WebPluginInfo& webplugin_info, |
20 PepperPluginInfo* pepper_info); | 20 PepperPluginInfo* pepper_info); |
21 | 21 |
22 // This class holds references to all of the known pepper plugin modules. | 22 // This class holds references to all of the known pepper plugin modules. |
23 // | 23 // |
24 // It keeps two lists. One list of preloaded in-process modules, and one list | 24 // It keeps two lists. One list of preloaded in-process modules, and one list |
25 // is a list of all live modules (some of which may be out-of-process and hence | 25 // is a list of all live modules (some of which may be out-of-process and hence |
26 // not preloaded). | 26 // not preloaded). |
27 class PepperPluginRegistry | 27 class PepperPluginRegistry |
28 : public webkit::ppapi::PluginDelegate::ModuleLifetime { | 28 : public webkit::ppapi::PluginDelegate::ModuleLifetime { |
29 public: | 29 public: |
(...skipping 12 matching lines...) Expand all Loading... |
42 | 42 |
43 // Loads the (native) libraries but does not initialize them (i.e., does not | 43 // Loads the (native) libraries but does not initialize them (i.e., does not |
44 // call PPP_InitializeModule). This is needed by the zygote on Linux to get | 44 // call PPP_InitializeModule). This is needed by the zygote on Linux to get |
45 // access to the plugins before entering the sandbox. | 45 // access to the plugins before entering the sandbox. |
46 static void PreloadModules(); | 46 static void PreloadModules(); |
47 | 47 |
48 // Retrieves the information associated with the given plugin info. The | 48 // Retrieves the information associated with the given plugin info. The |
49 // return value will be NULL if there is no such plugin. | 49 // return value will be NULL if there is no such plugin. |
50 // | 50 // |
51 // The returned pointer is owned by the PluginRegistry. | 51 // The returned pointer is owned by the PluginRegistry. |
52 const PepperPluginInfo* GetInfoForPlugin(const webkit::WebPluginInfo& info); | 52 const PepperPluginInfo* GetInfoForPlugin(const WebPluginInfo& info); |
53 | 53 |
54 // Returns an existing loaded module for the given path. It will search for | 54 // Returns an existing loaded module for the given path. It will search for |
55 // both preloaded in-process or currently active (non crashed) out-of-process | 55 // both preloaded in-process or currently active (non crashed) out-of-process |
56 // plugins matching the given name. Returns NULL if the plugin hasn't been | 56 // plugins matching the given name. Returns NULL if the plugin hasn't been |
57 // loaded. | 57 // loaded. |
58 webkit::ppapi::PluginModule* GetLiveModule(const base::FilePath& path); | 58 webkit::ppapi::PluginModule* GetLiveModule(const base::FilePath& path); |
59 | 59 |
60 // Notifies the registry that a new non-preloaded module has been created. | 60 // Notifies the registry that a new non-preloaded module has been created. |
61 // This is normally called for out-of-process plugins. Once this is called, | 61 // This is normally called for out-of-process plugins. Once this is called, |
62 // the module is available to be returned by GetModule(). The module will | 62 // the module is available to be returned by GetModule(). The module will |
(...skipping 27 matching lines...) Expand all Loading... |
90 typedef std::map<base::FilePath, webkit::ppapi::PluginModule*> | 90 typedef std::map<base::FilePath, webkit::ppapi::PluginModule*> |
91 NonOwningModuleMap; | 91 NonOwningModuleMap; |
92 NonOwningModuleMap live_modules_; | 92 NonOwningModuleMap live_modules_; |
93 | 93 |
94 DISALLOW_COPY_AND_ASSIGN(PepperPluginRegistry); | 94 DISALLOW_COPY_AND_ASSIGN(PepperPluginRegistry); |
95 }; | 95 }; |
96 | 96 |
97 } // namespace content | 97 } // namespace content |
98 | 98 |
99 #endif // CONTENT_COMMON_PEPPER_PLUGIN_REGISTRY_H_ | 99 #endif // CONTENT_COMMON_PEPPER_PLUGIN_REGISTRY_H_ |
OLD | NEW |