Chromium Code Reviews| Index: chrome/browser/plugin_service.h |
| =================================================================== |
| --- chrome/browser/plugin_service.h (revision 71882) |
| +++ chrome/browser/plugin_service.h (working copy) |
| @@ -14,6 +14,7 @@ |
| #include "base/basictypes.h" |
| #include "base/file_path.h" |
| #include "base/hash_tables.h" |
| +#include "base/lock.h" |
|
brettw
2011/01/21 21:42:30
The new name is base/synchronization/lock.h
|
| #include "base/scoped_vector.h" |
| #include "base/singleton.h" |
| #include "base/synchronization/waitable_event_watcher.h" |
| @@ -23,6 +24,7 @@ |
| #include "chrome/common/notification_registrar.h" |
| #include "googleurl/src/gurl.h" |
| #include "ipc/ipc_channel_handle.h" |
| +#include "webkit/plugins/npapi/webplugininfo.h" |
| #if defined(OS_WIN) |
| #include "base/scoped_ptr.h" |
| @@ -52,18 +54,19 @@ |
| class URLRequestContext; |
| } // namespace net |
| -namespace webkit { |
| -namespace npapi { |
| -struct WebPluginInfo; |
| -} |
| -} |
| - |
| // This must be created on the main thread but it's only called on the IO/file |
| // thread. |
| class PluginService |
| : public base::WaitableEventWatcher::Delegate, |
| public NotificationObserver { |
| public: |
| + struct OverriddenPlugin { |
| + int render_process_id; |
| + int render_view_id; |
| + GURL url; |
| + webkit::npapi::WebPluginInfo plugin; |
| + }; |
| + |
| // Initializes the global instance; should be called on startup from the main |
| // thread. |
| static void InitGlobalInstance(Profile* profile); |
| @@ -97,13 +100,17 @@ |
| // Opens a channel to a plugin process for the given mime type, starting |
| // a new plugin process if necessary. This must be called on the IO thread |
| // or else a deadlock can occur. |
| - void OpenChannelToPlugin(const GURL& url, |
| + void OpenChannelToPlugin(int render_process_id, |
| + int render_view_id, |
| + const GURL& url, |
| const std::string& mime_type, |
| PluginProcessHost::Client* client); |
| // Gets the first allowed plugin in the list of plugins that matches |
| // the given url and mime type. Must be called on the FILE thread. |
| - bool GetFirstAllowedPluginInfo(const GURL& url, |
| + bool GetFirstAllowedPluginInfo(int render_process_id, |
| + int render_view_id, |
| + const GURL& url, |
| const std::string& mime_type, |
| webkit::npapi::WebPluginInfo* info, |
| std::string* actual_mime_type); |
| @@ -112,6 +119,9 @@ |
| // the given URL. |
| bool PrivatePluginAllowedForURL(const FilePath& plugin_path, const GURL& url); |
| + // Safe to be called from any thread. |
| + void OverridePluginForTab(OverriddenPlugin plugin); |
| + |
| // The UI thread's message loop |
| MessageLoop* main_message_loop() { return main_message_loop_; } |
| @@ -140,6 +150,8 @@ |
| // Helper so we can do the plugin lookup on the FILE thread. |
| void GetAllowedPluginForOpenChannelToPlugin( |
| + int render_process_id, |
| + int render_view_id, |
| const GURL& url, |
| const std::string& mime_type, |
| PluginProcessHost::Client* client); |
| @@ -203,6 +215,9 @@ |
| // Set to true if chrome plugins are enabled. Defaults to true. |
| static bool enable_chrome_plugins_; |
| + std::vector<OverriddenPlugin> overridden_plugins_; |
| + base::Lock overridden_plugins_lock_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(PluginService); |
| }; |