Chromium Code Reviews| 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..63aaf53cd0e056eac487e889a9e65408764f811f 100644 |
| --- a/webkit/plugins/npapi/plugin_list.h |
| +++ b/webkit/plugins/npapi/plugin_list.h |
| @@ -13,23 +13,16 @@ |
| #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 { |
| @@ -55,6 +48,13 @@ struct PluginEntryPoints { |
| // This object is thread safe. |
| class WEBKIT_PLUGINS_EXPORT PluginList { |
| public: |
| + // Custom traits that performs platform-dependent initialization |
| + // when the instance is created. |
| + struct CustomLazyInstanceTraits |
|
Bernhard Bauer
2012/09/20 17:03:00
I think you could forward-declare the struct, move
ibraaaa
2012/09/21 09:24:57
If I understand correctly, then you mean:
.h file
Bernhard Bauer
2012/09/21 09:33:52
Yes, it will only be forward-declared for other cl
ibraaaa
2012/09/21 09:37:56
yes but the LazyInstance in the .cc file is declar
Bernhard Bauer
2012/09/21 09:53:28
Ah, you meant visible in the 'public'/'private' se
|
| + : base::DefaultLazyInstanceTraits<PluginList> { |
| + static PluginList* New(void* instance); |
| + }; |
| + |
| // Gets the one instance of the PluginList. |
| static PluginList* Singleton(); |
| @@ -148,30 +148,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 +160,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 +168,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 +186,6 @@ 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); |
| // Implements all IO dependent operations of the LoadPlugins method so that |
| // test classes can mock these out. |
| @@ -255,13 +199,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 +262,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_; |