 Chromium Code Reviews
 Chromium Code Reviews Issue 10918174:
  Remove PluginGroup  (Closed) 
  Base URL: http://git.chromium.org/chromium/src.git@remove_async_plugin_finder
    
  
    Issue 10918174:
  Remove PluginGroup  (Closed) 
  Base URL: http://git.chromium.org/chromium/src.git@remove_async_plugin_finder| Index: webkit/plugins/npapi/plugin_list.h | 
| diff --git a/webkit/plugins/npapi/plugin_list.h b/webkit/plugins/npapi/plugin_list.h | 
| index 57204892bb31492462e826a99d4b09828def4a86..f2bdadb094bd37a8612e01062713975c68cf05fe 100644 | 
| --- a/webkit/plugins/npapi/plugin_list.h | 
| +++ b/webkit/plugins/npapi/plugin_list.h | 
| @@ -13,26 +13,21 @@ | 
| #include "base/basictypes.h" | 
| #include "base/callback.h" | 
| #include "base/file_path.h" | 
| +#include "base/lazy_instance.h" | 
| #include "base/memory/linked_ptr.h" | 
| #include "base/memory/scoped_vector.h" | 
| #include "base/synchronization/lock.h" | 
| #include "third_party/npapi/bindings/nphostapi.h" | 
| -#include "webkit/plugins/npapi/plugin_group.h" | 
| #include "webkit/plugins/webkit_plugins_export.h" | 
| #include "webkit/plugins/webplugininfo.h" | 
| class GURL; | 
| -namespace base { | 
| - | 
| -template <typename T> | 
| -struct DefaultLazyInstanceTraits; | 
| - | 
| -} // namespace base | 
| - | 
| namespace webkit { | 
| namespace npapi { | 
| +struct CustomPluginListTraits; | 
| + | 
| // This struct holds entry points into a plugin. The entry points are | 
| // slightly different between Win/Mac and Unixes. Note that the interface for | 
| // querying plugins is synchronous and it is preferable to use a higher-level | 
| @@ -148,30 +143,6 @@ class WEBKIT_PLUGINS_EXPORT PluginList { | 
| std::vector<webkit::WebPluginInfo>* info, | 
| std::vector<std::string>* actual_mime_types); | 
| - // TODO(ibraaaa): DELETE. http://crbug.com/124396 | 
| - // Populates the given vector with all available plugin groups. If | 
| - // |load_if_necessary| is true, this will potentially load the plugin list | 
| - // synchronously. | 
| - void GetPluginGroups(bool load_if_necessary, | 
| - std::vector<PluginGroup>* plugin_groups); | 
| - | 
| - // TODO(ibraaaa): DELETE. http://crbug.com/124396 | 
| - // Returns a copy of the PluginGroup corresponding to the given WebPluginInfo. | 
| - // The caller takes ownership of the returned PluginGroup. | 
| - PluginGroup* GetPluginGroup(const webkit::WebPluginInfo& web_plugin_info); | 
| - | 
| - // TODO(ibraaaa): DELETE. http://crbug.com/124396 | 
| - // Returns the name of the PluginGroup with the given identifier. | 
| - // If no such group exists, an empty string is returned. | 
| - string16 GetPluginGroupName(const std::string& identifier); | 
| - | 
| - // TODO(ibraaaa): DELETE. http://crbug.com/124396 | 
| - // Load a specific plugin with full path. Return true iff loading the plug-in | 
| - // was successful. | 
| - bool LoadPlugin(const FilePath& filename, | 
| - ScopedVector<PluginGroup>* plugin_groups, | 
| - webkit::WebPluginInfo* plugin_info); | 
| - | 
| // Load a specific plugin with full path. Return true iff loading the plug-in | 
| // was successful. | 
| bool LoadPluginIntoPluginList(const FilePath& filename, | 
| @@ -184,11 +155,7 @@ class WEBKIT_PLUGINS_EXPORT PluginList { | 
| // Computes a list of all plugins to potentially load from all sources. | 
| void GetPluginPathsToLoad(std::vector<FilePath>* plugin_paths); | 
| - // TODO(ibraaaa): DELETE. http://crbug.com/124396 | 
| - // Returns the list of hardcoded plug-in groups for testing. | 
| - const std::vector<PluginGroup*>& GetHardcodedPluginGroups() const; | 
| - | 
| - // Clears the internal list of PluginGroups and copies them from the vector. | 
| + // Clears the internal list of Plugins and copies them from the vector. | 
| void SetPlugins(const std::vector<webkit::WebPluginInfo>& plugins); | 
| void set_will_load_plugins_callback(const base::Closure& callback); | 
| @@ -196,16 +163,9 @@ class WEBKIT_PLUGINS_EXPORT PluginList { | 
| virtual ~PluginList(); | 
| protected: | 
| - // TODO(ibraaaa): DELETE and add a different one. http://crbug.com/124396 | 
| - // This constructor is used in unit tests to override the platform-dependent | 
| - // real-world plugin group definitions with custom ones. | 
| - PluginList(const PluginGroupDefinition* definitions, size_t num_definitions); | 
| - | 
| - // TODO(ibraaaa): DELETE. http://crbug.com/124396 | 
| - // Adds the given WebPluginInfo to its corresponding group, creating it if | 
| - // necessary, and returns the group. | 
| - PluginGroup* AddToPluginGroups(const webkit::WebPluginInfo& web_plugin_info, | 
| - ScopedVector<PluginGroup>* plugin_groups); | 
| + // Constructors are private for singletons but we expose this one | 
| + // for subclasses for test purposes. | 
| + PluginList(); | 
| private: | 
| enum LoadingState { | 
| @@ -221,27 +181,7 @@ class WEBKIT_PLUGINS_EXPORT PluginList { | 
| friend class PluginListTest; | 
| friend struct base::DefaultLazyInstanceTraits<PluginList>; | 
| - FRIEND_TEST_ALL_PREFIXES(PluginGroupTest, PluginGroupDefinition); | 
| - | 
| - // Constructors are private for singletons. | 
| - PluginList(); | 
| - | 
| - // TODO(ibraaaa): DELETE. http://crbug.com/124396 | 
| - // Creates PluginGroups for the hardcoded group definitions, and stores them | 
| - // in |hardcoded_plugin_groups_|. | 
| - void AddHardcodedPluginGroups(const PluginGroupDefinition* group_definitions, | 
| - size_t num_group_definitions); | 
| - | 
| - // TODO(ibraaaa): DELETE. http://crbug.com/124396 | 
| - // Creates a new PluginGroup either from a hardcoded group definition, or from | 
| - // the plug-in information. | 
| - // Caller takes ownership of the returned PluginGroup. | 
| - PluginGroup* CreatePluginGroup( | 
| - const webkit::WebPluginInfo& web_plugin_info) const; | 
| - | 
| - // Implements all IO dependent operations of the LoadPlugins method so that | 
| - // test classes can mock these out. | 
| - virtual void LoadPluginsInternal(ScopedVector<PluginGroup>* plugin_groups); | 
| + friend struct CustomPluginListTraits; | 
| // Implements all IO dependent operations of the LoadPlugins method so that | 
| // test classes can mock these out. | 
| @@ -255,13 +195,6 @@ class WEBKIT_PLUGINS_EXPORT PluginList { | 
| // load in that directory. | 
| void GetPluginsInDir(const FilePath& path, std::vector<FilePath>* plugins); | 
| - // TODO(ibraaaa): DELETE. http://crbug.com/124396 | 
| - // Returns true if we should load the given plugin, or false otherwise. | 
| - // |plugins| is the list of plugins we have crawled in the current plugin | 
| - // loading run. | 
| - bool ShouldLoadPlugin(const webkit::WebPluginInfo& info, | 
| - ScopedVector<PluginGroup>* plugins); | 
| - | 
| // Returns true if we should load the given plugin, or false otherwise. | 
| // |plugins| is the list of plugins we have crawled in the current plugin | 
| // loading run. | 
| @@ -325,14 +258,6 @@ class WEBKIT_PLUGINS_EXPORT PluginList { | 
| // Holds information about internal plugins. | 
| std::vector<InternalPlugin> internal_plugins_; | 
| - // TODO(ibraaaa): DELETE. http://crbug.com/124396 | 
| - // Holds the currently available plugin groups. | 
| - ScopedVector<PluginGroup> plugin_groups_; | 
| - | 
| - // Holds the hardcoded definitions of well-known plug-ins. | 
| - // This should only be modified during construction of the PluginList. | 
| - ScopedVector<PluginGroup> hardcoded_plugin_groups_; | 
| - | 
| // A list holding all plug-ins. | 
| std::vector<webkit::WebPluginInfo> plugins_list_; | 
| @@ -346,6 +271,24 @@ class WEBKIT_PLUGINS_EXPORT PluginList { | 
| DISALLOW_COPY_AND_ASSIGN(PluginList); | 
| }; | 
| +// Custom traits for PlugList that performs platform-dependent initialization | 
| 
Bernhard Bauer
2012/09/18 11:01:31
Nit: PluginList
 
ibraaaa
2012/09/18 14:49:01
Done.
 | 
| +// when the instance is created. | 
| +struct CustomPluginListTraits { | 
| 
ibraaaa
2012/09/18 09:47:13
Is it better to define this inside PluginList?
 
Bernhard Bauer
2012/09/18 11:01:31
Hm. Yeah, it's probably best to move the declarati
 
ibraaaa
2012/09/18 14:49:01
Done.
 | 
| + static const bool kRegisterOnExit = true; | 
| + static const bool kAllowedToAccessOnNonjoinableThread = false; | 
| + | 
| + static PluginList* New(void* instance) { | 
| + PluginList* plugin_list = | 
| + base::DefaultLazyInstanceTraits<PluginList>::New(instance); | 
| + plugin_list->PlatformInit(); | 
| + return plugin_list; | 
| + } | 
| + | 
| + static void Delete(PluginList* instance) { | 
| 
Bernhard Bauer
2012/09/18 11:01:31
If you inherited from base::DefaultLazyInstanceTra
 
ibraaaa
2012/09/18 14:49:01
Done.
 | 
| + base::DefaultLazyInstanceTraits<PluginList>::Delete(instance); | 
| + } | 
| +}; | 
| + | 
| } // namespace npapi | 
| } // namespace webkit |