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..64575e30409af91e7a6c391691627dc77b31de8f 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 |
|
jam
2011/09/22 21:10:59
nit: we should make this more forceful, i.e. "This
Robert Sesek
2011/09/22 23:26:51
Done. Happily.
|
| +// possible. |
| class CONTENT_EXPORT PluginService |
| : public base::WaitableEventWatcher::Delegate, |
| public NotificationObserver { |
| @@ -57,6 +70,11 @@ class CONTENT_EXPORT PluginService |
| webkit::WebPluginInfo plugin; |
| }; |
| + typedef base::Callback<void(const std::vector<webkit::WebPluginInfo>&)> |
| + GetPluginsCallback; |
| + typedef base::Callback<void(const std::vector<webkit::npapi::PluginGroup>&)> |
| + GetPluginGroupsCallback; |
| + |
| // Returns the PluginService singleton. |
| static PluginService* GetInstance(); |
| @@ -115,10 +133,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); |
| + // Marks the plugin list as dirty and will cause the plugins to be reloaded |
| + // on the next access through GetPlugins() or GetPluginGroups(). |
| + void RefreshPluginList(); |
| + |
| + // Asynchronously loads plugins and then calls back to the provided function |
|
jam
2011/09/22 21:10:59
nit: this doesn't always load the plugins, so how
Robert Sesek
2011/09/22 23:26:51
Done and below.
|
| + // on the calling MessageLoop on completion. |
| + void GetPlugins(const GetPluginsCallback& callback); |
| + |
| + // Gets the list of plugin groups, reloading them from disk if marked as dirty |
|
jam
2011/09/22 21:10:59
nit, we should make this the same comment above. b
|
| + // with RefreshPluginList(). |
| + void GetPluginGroups(const GetPluginGroupsCallback& callback); |
| // 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 +153,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 +174,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 GetPluginsCallback& callback); |
| + |
| // Helper so we can do the plugin lookup on the FILE thread. |
| void GetAllowedPluginForOpenChannelToPlugin( |
| int render_process_id, |