OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This class responds to requests from renderers for the list of plugins, and | 5 // This class responds to requests from renderers for the list of plugins, and |
6 // also a proxy object for plugin instances. | 6 // also a proxy object for plugin instances. |
7 | 7 |
8 #ifndef CONTENT_BROWSER_PLUGIN_SERVICE_H_ | 8 #ifndef CONTENT_BROWSER_PLUGIN_SERVICE_H_ |
9 #define CONTENT_BROWSER_PLUGIN_SERVICE_H_ | 9 #define CONTENT_BROWSER_PLUGIN_SERVICE_H_ |
10 #pragma once | 10 #pragma once |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
47 class PluginServiceFilter; | 47 class PluginServiceFilter; |
48 } | 48 } |
49 | 49 |
50 namespace webkit { | 50 namespace webkit { |
51 namespace npapi { | 51 namespace npapi { |
52 class PluginGroup; | 52 class PluginGroup; |
53 class PluginList; | 53 class PluginList; |
54 } | 54 } |
55 } | 55 } |
56 | 56 |
57 namespace { | |
58 struct ForwardOpenChannelParams; | |
jam
2011/10/04 22:42:30
nit: seems a little odd to forward declare stuff i
| |
59 } | |
60 | |
57 // This must be created on the main thread but it's only called on the IO/file | 61 // This must be created on the main thread but it's only called on the IO/file |
58 // thread. This is an asynchronous wrapper around the PluginList interface for | 62 // thread. This is an asynchronous wrapper around the PluginList interface for |
59 // querying plugin information. This must be used instead of that to avoid | 63 // querying plugin information. This must be used instead of that to avoid |
60 // doing expensive disk operations on the IO/UI threads. | 64 // doing expensive disk operations on the IO/UI threads. |
61 class CONTENT_EXPORT PluginService | 65 class CONTENT_EXPORT PluginService |
62 : public base::WaitableEventWatcher::Delegate, | 66 : public base::WaitableEventWatcher::Delegate, |
63 public NotificationObserver { | 67 public NotificationObserver { |
64 public: | 68 public: |
65 struct OverriddenPlugin { | 69 struct OverriddenPlugin { |
66 int render_process_id; | 70 int render_process_id; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
113 PluginProcessHost::Client* client); | 117 PluginProcessHost::Client* client); |
114 void OpenChannelToPpapiPlugin(const FilePath& path, | 118 void OpenChannelToPpapiPlugin(const FilePath& path, |
115 PpapiPluginProcessHost::PluginClient* client); | 119 PpapiPluginProcessHost::PluginClient* client); |
116 void OpenChannelToPpapiBroker(const FilePath& path, | 120 void OpenChannelToPpapiBroker(const FilePath& path, |
117 PpapiPluginProcessHost::BrokerClient* client); | 121 PpapiPluginProcessHost::BrokerClient* client); |
118 | 122 |
119 // Cancels opening a channel to a NPAPI plugin. | 123 // Cancels opening a channel to a NPAPI plugin. |
120 void CancelOpenChannelToNpapiPlugin(PluginProcessHost::Client* client); | 124 void CancelOpenChannelToNpapiPlugin(PluginProcessHost::Client* client); |
121 | 125 |
122 // Gets the plugin in the list of plugins that matches the given url and mime | 126 // Gets the plugin in the list of plugins that matches the given url and mime |
123 // type. Must be called on the FILE thread if |use_stale| is NULL. | 127 // type. Returns true if the data is frome a stale plugin list, false if it |
128 // is up to date. This can be called from any thread. | |
129 bool GetPluginInfoArray(const GURL& url, | |
130 const std::string& mime_type, | |
131 bool allow_wildcard, | |
132 std::vector<webkit::WebPluginInfo>* info, | |
133 std::vector<std::string>* actual_mime_types); | |
134 | |
135 // Gets plugin info for an individual plugin and filters the plugins using | |
136 // the |context| and renderer IDs. This will report whether the data is stale | |
137 // via |is_stale| and returns whether or not the plugin can be found. | |
124 bool GetPluginInfo(int render_process_id, | 138 bool GetPluginInfo(int render_process_id, |
125 int render_view_id, | 139 int render_view_id, |
126 const content::ResourceContext& context, | 140 const content::ResourceContext& context, |
127 const GURL& url, | 141 const GURL& url, |
128 const GURL& page_url, | 142 const GURL& page_url, |
129 const std::string& mime_type, | 143 const std::string& mime_type, |
130 bool allow_wildcard, | 144 bool allow_wildcard, |
131 bool* use_stale, | 145 bool* is_stale, |
132 webkit::WebPluginInfo* info, | 146 webkit::WebPluginInfo* info, |
133 std::string* actual_mime_type); | 147 std::string* actual_mime_type); |
134 | 148 |
149 // Get plugin info by plugin path (including disabled plugins). Returns true | |
150 // if the plugin is found and WebPluginInfo has been filled in |info|. This | |
151 // will use cached data in the plugin list. | |
152 bool GetPluginInfoByPath(const FilePath& plugin_path, | |
153 webkit::WebPluginInfo* info); | |
154 | |
135 // Marks the plugin list as dirty and will cause the plugins to be reloaded | 155 // Marks the plugin list as dirty and will cause the plugins to be reloaded |
136 // on the next access through GetPlugins() or GetPluginGroups(). | 156 // on the next access through GetPlugins() or GetPluginGroups(). |
137 void RefreshPluginList(); | 157 void RefreshPluginList(); |
138 | 158 |
139 // Asynchronously loads plugins if necessary and then calls back to the | 159 // Asynchronously loads plugins if necessary and then calls back to the |
140 // provided function on the calling MessageLoop on completion. | 160 // provided function on the calling MessageLoop on completion. |
141 void GetPlugins(const GetPluginsCallback& callback); | 161 void GetPlugins(const GetPluginsCallback& callback); |
142 | 162 |
143 // Asynchronously loads the list of plugin groups if necessary and then calls | 163 // Asynchronously loads the list of plugin groups if necessary and then calls |
144 // back to the provided function on the calling MessageLoop on completion. | 164 // back to the provided function on the calling MessageLoop on completion. |
(...skipping 25 matching lines...) Expand all Loading... | |
170 const NotificationDetails& details); | 190 const NotificationDetails& details); |
171 | 191 |
172 void RegisterPepperPlugins(); | 192 void RegisterPepperPlugins(); |
173 | 193 |
174 PepperPluginInfo* GetRegisteredPpapiPluginInfo(const FilePath& plugin_path); | 194 PepperPluginInfo* GetRegisteredPpapiPluginInfo(const FilePath& plugin_path); |
175 | 195 |
176 // Function that is run on the FILE thread to load the plugins synchronously. | 196 // Function that is run on the FILE thread to load the plugins synchronously. |
177 void GetPluginsInternal(base::MessageLoopProxy* target_loop, | 197 void GetPluginsInternal(base::MessageLoopProxy* target_loop, |
178 const GetPluginsCallback& callback); | 198 const GetPluginsCallback& callback); |
179 | 199 |
200 // Binding directly to GetAllowedPluginForOpenChannelToPlugin() isn't possible | |
201 // because more arity is needed <http://crbug.com/98542>. This just forwards. | |
Bernhard Bauer
2011/10/05 13:00:46
I'm running into the same issue in http://coderevi
Robert Sesek
2011/10/05 18:27:16
Done.
| |
202 void ForwardGetAllowedPluginForOpenChannelToPlugin( | |
203 const ForwardOpenChannelParams& params, | |
204 const GURL& url, | |
205 const GURL& page_url, | |
206 const std::string& mime_type, | |
207 const std::vector<webkit::WebPluginInfo>&); | |
180 // Helper so we can do the plugin lookup on the FILE thread. | 208 // Helper so we can do the plugin lookup on the FILE thread. |
181 void GetAllowedPluginForOpenChannelToPlugin( | 209 void GetAllowedPluginForOpenChannelToPlugin( |
182 int render_process_id, | 210 int render_process_id, |
183 int render_view_id, | 211 int render_view_id, |
184 const GURL& url, | 212 const GURL& url, |
185 const GURL& page_url, | 213 const GURL& page_url, |
186 const std::string& mime_type, | 214 const std::string& mime_type, |
187 PluginProcessHost::Client* client, | 215 PluginProcessHost::Client* client, |
188 const content::ResourceContext* resource_context); | 216 const content::ResourceContext* resource_context); |
189 | 217 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
227 content::PluginServiceFilter* filter_; | 255 content::PluginServiceFilter* filter_; |
228 | 256 |
229 std::set<PluginProcessHost::Client*> pending_plugin_clients_; | 257 std::set<PluginProcessHost::Client*> pending_plugin_clients_; |
230 | 258 |
231 DISALLOW_COPY_AND_ASSIGN(PluginService); | 259 DISALLOW_COPY_AND_ASSIGN(PluginService); |
232 }; | 260 }; |
233 | 261 |
234 DISABLE_RUNNABLE_METHOD_REFCOUNT(PluginService); | 262 DISABLE_RUNNABLE_METHOD_REFCOUNT(PluginService); |
235 | 263 |
236 #endif // CONTENT_BROWSER_PLUGIN_SERVICE_H_ | 264 #endif // CONTENT_BROWSER_PLUGIN_SERVICE_H_ |
OLD | NEW |