OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <list> | 9 #include <list> |
10 #include <map> | 10 #include <map> |
(...skipping 28 matching lines...) Expand all Loading... |
39 std::string name; | 39 std::string name; |
40 std::string description; | 40 std::string description; |
41 std::string version; | 41 std::string version; |
42 std::vector<webkit::WebPluginMimeType> mime_types; | 42 std::vector<webkit::WebPluginMimeType> mime_types; |
43 | 43 |
44 // When is_internal is set, this contains the function pointers to the | 44 // When is_internal is set, this contains the function pointers to the |
45 // entry points for the internal plugins. | 45 // entry points for the internal plugins. |
46 webkit::ppapi::PluginModule::EntryPoints internal_entry_points; | 46 webkit::ppapi::PluginModule::EntryPoints internal_entry_points; |
47 }; | 47 }; |
48 | 48 |
| 49 // Constructs a PepperPluginInfo from a WebPluginInfo. Returns false if |
| 50 // the operation is not possible, in particular the WebPluginInfo::type |
| 51 // must be one of the pepper types. |
| 52 bool MakePepperPluginInfo(const webkit::WebPluginInfo& webplugin_info, |
| 53 PepperPluginInfo* pepper_info); |
| 54 |
49 // This class holds references to all of the known pepper plugin modules. | 55 // This class holds references to all of the known pepper plugin modules. |
50 // | 56 // |
51 // It keeps two lists. One list of preloaded in-process modules, and one list | 57 // It keeps two lists. One list of preloaded in-process modules, and one list |
52 // is a list of all live modules (some of which may be out-of-process and hence | 58 // is a list of all live modules (some of which may be out-of-process and hence |
53 // not preloaded). | 59 // not preloaded). |
54 class PepperPluginRegistry | 60 class PepperPluginRegistry |
55 : public webkit::ppapi::PluginDelegate::ModuleLifetime, | 61 : public webkit::ppapi::PluginDelegate::ModuleLifetime, |
56 public pp::proxy::ProxyChannel::Delegate { | 62 public pp::proxy::ProxyChannel::Delegate { |
57 public: | 63 public: |
58 ~PepperPluginRegistry(); | 64 ~PepperPluginRegistry(); |
59 | 65 |
60 static PepperPluginRegistry* GetInstance(); | 66 static PepperPluginRegistry* GetInstance(); |
61 | 67 |
62 // Computes the list of known pepper plugins. | 68 // Computes the list of known pepper plugins. |
63 // | 69 // |
64 // This method is static so that it can be used by the browser process, which | 70 // This method is static so that it can be used by the browser process, which |
65 // has no need to load the pepper plugin modules. It will re-compute the | 71 // has no need to load the pepper plugin modules. It will re-compute the |
66 // plugin list every time it is called. Generally, code in the registry should | 72 // plugin list every time it is called. Generally, code in the registry should |
67 // be using the cached plugin_list_ instead. | 73 // be using the cached plugin_list_ instead. |
68 static void ComputeList(std::vector<PepperPluginInfo>* plugins); | 74 static void ComputeList(std::vector<PepperPluginInfo>* plugins); |
69 | 75 |
70 // Loads the (native) libraries but does not initialize them (i.e., does not | 76 // Loads the (native) libraries but does not initialize them (i.e., does not |
71 // call PPP_InitializeModule). This is needed by the zygote on Linux to get | 77 // call PPP_InitializeModule). This is needed by the zygote on Linux to get |
72 // access to the plugins before entering the sandbox. | 78 // access to the plugins before entering the sandbox. |
73 static void PreloadModules(); | 79 static void PreloadModules(); |
74 | 80 |
75 // Retrieves the information associated with the given plugin path. The | 81 // Retrieves the information associated with the given plugin info. The |
76 // return value will be NULL if there is no such plugin. | 82 // return value will be NULL if there is no such plugin. |
77 // | 83 // |
78 // The returned pointer is owned by the PluginRegistry. | 84 // The returned pointer is owned by the PluginRegistry. |
79 const PepperPluginInfo* GetInfoForPlugin(const FilePath& path) const; | 85 const PepperPluginInfo* GetInfoForPlugin( |
| 86 const webkit::WebPluginInfo& info); |
80 | 87 |
81 // Returns an existing loaded module for the given path. It will search for | 88 // Returns an existing loaded module for the given path. It will search for |
82 // both preloaded in-process or currently active (non crashed) out-of-process | 89 // both preloaded in-process or currently active (non crashed) out-of-process |
83 // plugins matching the given name. Returns NULL if the plugin hasn't been | 90 // plugins matching the given name. Returns NULL if the plugin hasn't been |
84 // loaded. | 91 // loaded. |
85 webkit::ppapi::PluginModule* GetLiveModule(const FilePath& path); | 92 webkit::ppapi::PluginModule* GetLiveModule(const FilePath& path); |
86 | 93 |
87 // Notifies the registry that a new non-preloaded module has been created. | 94 // Notifies the registry that a new non-preloaded module has been created. |
88 // This is normally called for out-of-process plugins. Once this is called, | 95 // This is normally called for out-of-process plugins. Once this is called, |
89 // the module is available to be returned by GetModule(). The module will | 96 // the module is available to be returned by GetModule(). The module will |
(...skipping 25 matching lines...) Expand all Loading... |
115 // non-crashed modules. If an out-of-process module crashes, it may | 122 // non-crashed modules. If an out-of-process module crashes, it may |
116 // continue as long as there are WebKit references to it, but it will not | 123 // continue as long as there are WebKit references to it, but it will not |
117 // appear in this list. | 124 // appear in this list. |
118 typedef std::map<FilePath, webkit::ppapi::PluginModule*> NonOwningModuleMap; | 125 typedef std::map<FilePath, webkit::ppapi::PluginModule*> NonOwningModuleMap; |
119 NonOwningModuleMap live_modules_; | 126 NonOwningModuleMap live_modules_; |
120 | 127 |
121 DISALLOW_COPY_AND_ASSIGN(PepperPluginRegistry); | 128 DISALLOW_COPY_AND_ASSIGN(PepperPluginRegistry); |
122 }; | 129 }; |
123 | 130 |
124 #endif // CONTENT_COMMON_PEPPER_PLUGIN_REGISTRY_H_ | 131 #endif // CONTENT_COMMON_PEPPER_PLUGIN_REGISTRY_H_ |
OLD | NEW |