Index: content/common/pepper_plugin_registry.h |
=================================================================== |
--- content/common/pepper_plugin_registry.h (revision 101488) |
+++ content/common/pepper_plugin_registry.h (working copy) |
@@ -6,61 +6,15 @@ |
#define CONTENT_COMMON_PEPPER_PLUGIN_REGISTRY_H_ |
#pragma once |
-#include <list> |
-#include <map> |
-#include <string> |
-#include <vector> |
- |
-#include "base/file_path.h" |
+#include "base/memory/singleton.h" |
#include "content/common/content_export.h" |
#include "webkit/plugins/ppapi/plugin_delegate.h" |
-#include "webkit/plugins/ppapi/plugin_module.h" |
-#include "webkit/plugins/webplugininfo.h" |
+#include "webkit/plugins/ppapi/ppapi_plugin_list.h" |
-struct CONTENT_EXPORT PepperPluginInfo { |
- PepperPluginInfo(); |
- ~PepperPluginInfo(); |
- |
- webkit::WebPluginInfo ToWebPluginInfo() const; |
- |
- // Indicates internal plugins for which there's not actually a library. |
- // These plugins are implemented in the Chrome binary using a separate set |
- // of entry points (see internal_entry_points below). |
- // Defaults to false. |
- bool is_internal; |
- |
- // True when this plugin should be run out of process. Defaults to false. |
- bool is_out_of_process; |
- |
- FilePath path; // Internal plugins have "internal-[name]" as path. |
- std::string name; |
- std::string description; |
- std::string version; |
- std::vector<webkit::WebPluginMimeType> mime_types; |
- |
- // When is_internal is set, this contains the function pointers to the |
- // entry points for the internal plugins. |
- webkit::ppapi::PluginModule::EntryPoints internal_entry_points; |
-}; |
- |
-// Constructs a PepperPluginInfo from a WebPluginInfo. Returns false if |
-// the operation is not possible, in particular the WebPluginInfo::type |
-// must be one of the pepper types. |
-bool MakePepperPluginInfo(const webkit::WebPluginInfo& webplugin_info, |
- PepperPluginInfo* pepper_info); |
- |
-// This class holds references to all of the known pepper plugin modules. |
-// |
-// It keeps two lists. One list of preloaded in-process modules, and one list |
-// is a list of all live modules (some of which may be out-of-process and hence |
-// not preloaded). |
+// Static helper class to manage webkit::ppapi::PluginList. |
class PepperPluginRegistry |
: public webkit::ppapi::PluginDelegate::ModuleLifetime { |
public: |
- ~PepperPluginRegistry(); |
- |
- static PepperPluginRegistry* GetInstance(); |
- |
// Computes the list of known pepper plugins. |
// |
// This method is static so that it can be used by the browser process, which |
@@ -68,19 +22,21 @@ |
// plugin list every time it is called. Generally, code in the registry should |
// be using the cached plugin_list_ instead. |
CONTENT_EXPORT static void ComputeList( |
- std::vector<PepperPluginInfo>* plugins); |
+ webkit::ppapi::PluginList* plugin_list); |
// Loads the (native) libraries but does not initialize them (i.e., does not |
// call PPP_InitializeModule). This is needed by the zygote on Linux to get |
// access to the plugins before entering the sandbox. |
static void PreloadModules(); |
+ static PepperPluginRegistry* GetInstance(); |
+ |
// Retrieves the information associated with the given plugin info. The |
// return value will be NULL if there is no such plugin. |
// |
// The returned pointer is owned by the PluginRegistry. |
- const PepperPluginInfo* GetInfoForPlugin( |
- const webkit::WebPluginInfo& info); |
+ const webkit::ppapi::PluginInfo* GetInfoForPlugin( |
+ const FilePath& plugin_path); |
// Returns an existing loaded module for the given path. It will search for |
// both preloaded in-process or currently active (non crashed) out-of-process |
@@ -99,26 +55,8 @@ |
private: |
PepperPluginRegistry(); |
- |
- // All known pepper plugins. |
- std::vector<PepperPluginInfo> plugin_list_; |
- |
- // Plugins that have been preloaded so they can be executed in-process in |
- // the renderer (the sandbox prevents on-demand loading). |
- typedef std::map<FilePath, scoped_refptr<webkit::ppapi::PluginModule> > |
- OwningModuleMap; |
- OwningModuleMap preloaded_modules_; |
- |
- // A list of non-owning pointers to all currently-live plugin modules. This |
- // includes both preloaded ones in preloaded_modules_, and out-of-process |
- // modules whose lifetime is managed externally. This will contain only |
- // non-crashed modules. If an out-of-process module crashes, it may |
- // continue as long as there are WebKit references to it, but it will not |
- // appear in this list. |
- typedef std::map<FilePath, webkit::ppapi::PluginModule*> NonOwningModuleMap; |
- NonOwningModuleMap live_modules_; |
- |
- DISALLOW_COPY_AND_ASSIGN(PepperPluginRegistry); |
+ ~PepperPluginRegistry(); |
+ friend struct DefaultSingletonTraits<PepperPluginRegistry>; |
}; |
#endif // CONTENT_COMMON_PEPPER_PLUGIN_REGISTRY_H_ |