From 90d4137638f7f8e0abd591d796ff0bd396ae6826 Mon Sep 17 00:00:00 2001 From: "evan@chromium.org" Date: Mon, 30 Nov 2009 21:52:32 +0000 Subject: Relocate plugin list fetching to PluginService We fetch the plugin list from three places. Previously, each location had custom code to proxy the query to the file thread. This change moves the query to the PluginService, which then internally manages posting to the file thread and calling back. I experimented with some different approaches to handling the lifetimes of the requests and responses. The approach now is simple: - The PluginService plugin methods are called and respond on the IO thread. Two of the three consumers of the plugin lists are already on the IO thread, so they don't need any complicated thread handling. - None of the callers ever need to cancel their requests: one is a singleton, and the other two always wait (in terms of holding a ref on the object) for the requests to complete. This makes lifetime management a lot simpler than it would otherwise be. With this change in place, I can then look at refactoring the PluginService implementation on Linux to do more complicated plugin loading as needed in bug 17863. BUG=17863 Review URL: http://codereview.chromium.org/437069 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33344 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/plugin_service.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'chrome/browser/plugin_service.h') diff --git a/chrome/browser/plugin_service.h b/chrome/browser/plugin_service.h index 7ab39e2..fba9b04 100644 --- a/chrome/browser/plugin_service.h +++ b/chrome/browser/plugin_service.h @@ -53,6 +53,19 @@ class PluginService void SetChromePluginDataDir(const FilePath& data_dir); const FilePath& GetChromePluginDataDir(); + // An interface for GetPluginList callbacks. Note that this is + // called directly by the PluginService on the IO thread, so the + // implementor of this interface must outlive the request. + class GetPluginListClient { + public: + // Called when the request completes. + virtual void OnGetPluginList(const std::vector& plugins) = 0; + }; + + // Start a query for the list of plugins. + // If |refresh| is true, refreshes the list. + void GetPluginList(bool refresh, GetPluginListClient* client); + // Gets the browser's UI locale. const std::wstring& GetUILocale(); -- cgit v1.1