Chromium Code Reviews| Index: content/browser/plugin_service.h |
| diff --git a/content/browser/plugin_service.h b/content/browser/plugin_service.h |
| index 2d2596e3d4e5e6173e28b55db512258c8f6c9615..d5c0c2d5733aaddc6203bfc3eedd2d6313b81912 100644 |
| --- a/content/browser/plugin_service.h |
| +++ b/content/browser/plugin_service.h |
| @@ -13,6 +13,7 @@ |
| #include <vector> |
| #include "base/basictypes.h" |
| +#include "base/callback.h" |
| #include "base/memory/scoped_vector.h" |
| #include "base/memory/singleton.h" |
| #include "base/synchronization/waitable_event_watcher.h" |
| @@ -25,7 +26,6 @@ |
| #include "content/common/notification_registrar.h" |
| #include "googleurl/src/gurl.h" |
| #include "ipc/ipc_channel_handle.h" |
| -#include "webkit/plugins/webplugininfo.h" |
| #if defined(OS_WIN) |
| #include "base/memory/scoped_ptr.h" |
| @@ -39,13 +39,26 @@ |
| struct PepperPluginInfo; |
| class PluginDirWatcherDelegate; |
| +namespace base { |
| +class MessageLoopProxy; |
| +} |
| + |
| namespace content { |
| class ResourceContext; |
| class PluginServiceFilter; |
| } |
| +namespace webkit { |
| +namespace npapi { |
| +class PluginGroup; |
| +class PluginList; |
| +} |
| +} |
| + |
| // This must be created on the main thread but it's only called on the IO/file |
| -// thread. |
| +// thread. This is an asynchronous wrapper around the PluginList interface for |
| +// querying plugin information, and this should instead of that class wherever |
| +// possible. |
| class CONTENT_EXPORT PluginService |
| : public base::WaitableEventWatcher::Delegate, |
| public NotificationObserver { |
| @@ -115,10 +128,17 @@ class CONTENT_EXPORT PluginService |
| webkit::WebPluginInfo* info, |
| std::string* actual_mime_type); |
| - // Returns a list of all plug-ins available to the resource context. Must be |
| - // called on the FILE thread. |
| - void GetPlugins(const content::ResourceContext& context, |
| - std::vector<webkit::WebPluginInfo>* plugins); |
| + // Causes the plugin list to be reloaded if necessary. If |refresh| is true, |
| + // a reload will be forced. |
| + void LoadPluginList(bool refresh, const base::Closure& completion_callback); |
|
jam
2011/09/21 23:45:13
i think having only one GetPlugins function is bet
jam
2011/09/21 23:45:55
please ignore this comment, i put before i wrote t
|
| + |
| + // Returns the list of cached plugin information. This can be called from any |
| + // thread, but the data can be stale. |
|
Bernhard Bauer
2011/09/21 22:47:05
Nit: I think the more common case will be that the
|
| + void GetPlugins(std::vector<webkit::WebPluginInfo>* plugins); |
| + |
| + // Returns the list of cached plugin groups. This can be called from any |
| + // thread, but note that the data can be stale. |
| + void GetPluginGroups(std::vector<webkit::npapi::PluginGroup>* groups); |
| // Tells all the renderer processes to throw away their cache of the plugin |
| // list, and optionally also reload all the pages with plugins. |
| @@ -128,6 +148,7 @@ class CONTENT_EXPORT PluginService |
| void set_filter(content::PluginServiceFilter* filter) { |
| filter_ = filter; |
| } |
| + content::PluginServiceFilter* filter() { return filter_; } |
| private: |
| friend struct DefaultSingletonTraits<PluginService>; |
| @@ -148,6 +169,10 @@ class CONTENT_EXPORT PluginService |
| PepperPluginInfo* GetRegisteredPpapiPluginInfo(const FilePath& plugin_path); |
| + // Function that is run on the FILE thread to load the plugins synchronously. |
| + void GetPluginsInternal(base::MessageLoopProxy* target_loop, |
| + const base::Closure& completion_callback); |
| + |
| // Helper so we can do the plugin lookup on the FILE thread. |
| void GetAllowedPluginForOpenChannelToPlugin( |
| int render_process_id, |