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 #ifndef WEBKIT_PLUGINS_NPAPI_PLUGIN_LIST_H_ | 5 #ifndef WEBKIT_PLUGINS_NPAPI_PLUGIN_LIST_H_ |
6 #define WEBKIT_PLUGINS_NPAPI_PLUGIN_LIST_H_ | 6 #define WEBKIT_PLUGINS_NPAPI_PLUGIN_LIST_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 const std::string& description, | 95 const std::string& description, |
96 const std::string& mime_type, | 96 const std::string& mime_type, |
97 const PluginEntryPoints& entry_points); | 97 const PluginEntryPoints& entry_points); |
98 | 98 |
99 // Removes a specified internal plugin from the list. The search will match | 99 // Removes a specified internal plugin from the list. The search will match |
100 // on the path from the version info previously registered. | 100 // on the path from the version info previously registered. |
101 // | 101 // |
102 // This is generally only necessary for tests. | 102 // This is generally only necessary for tests. |
103 void UnregisterInternalPlugin(const FilePath& path); | 103 void UnregisterInternalPlugin(const FilePath& path); |
104 | 104 |
| 105 // Gets a list of all the registered internal plugins. |
| 106 void GetInternalPlugins(std::vector<webkit::WebPluginInfo>* plugins); |
| 107 |
105 // Creates a WebPluginInfo structure given a plugin's path. On success | 108 // Creates a WebPluginInfo structure given a plugin's path. On success |
106 // returns true, with the information being put into "info". If it's an | 109 // returns true, with the information being put into "info". If it's an |
107 // internal plugin, "entry_points" is filled in as well with a | 110 // internal plugin, "entry_points" is filled in as well with a |
108 // internally-owned PluginEntryPoints pointer. | 111 // internally-owned PluginEntryPoints pointer. |
109 // Returns false if the library couldn't be found, or if it's not a plugin. | 112 // Returns false if the library couldn't be found, or if it's not a plugin. |
110 bool ReadPluginInfo(const FilePath& filename, | 113 bool ReadPluginInfo(const FilePath& filename, |
111 webkit::WebPluginInfo* info, | 114 webkit::WebPluginInfo* info, |
112 const PluginEntryPoints** entry_points); | 115 const PluginEntryPoints** entry_points); |
113 | 116 |
114 // In Windows plugins, the mime types are passed as a specially formatted list | 117 // In Windows plugins, the mime types are passed as a specially formatted list |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 // If no such group exists, an empty string is returned. | 165 // If no such group exists, an empty string is returned. |
163 string16 GetPluginGroupName(const std::string& identifier); | 166 string16 GetPluginGroupName(const std::string& identifier); |
164 | 167 |
165 // Load a specific plugin with full path. | 168 // Load a specific plugin with full path. |
166 void LoadPlugin(const FilePath& filename, | 169 void LoadPlugin(const FilePath& filename, |
167 ScopedVector<PluginGroup>* plugin_groups); | 170 ScopedVector<PluginGroup>* plugin_groups); |
168 | 171 |
169 // The following functions are used to support probing for WebPluginInfo | 172 // The following functions are used to support probing for WebPluginInfo |
170 // using a different instance of this class. | 173 // using a different instance of this class. |
171 | 174 |
172 // Returns the extra plugin paths, extra plugin directories, and internal | 175 // Computes a list of all plugins to potentially load from all sources. |
173 // plugin paths that should be loaded. | 176 void GetPluginPathsToLoad(std::vector<FilePath>* plugin_paths); |
174 void GetPluginPathListsToLoad( | |
175 std::vector<FilePath>* extra_plugin_paths, | |
176 std::vector<FilePath>* extra_plugin_dirs, | |
177 std::vector<webkit::WebPluginInfo>* internal_plugins); | |
178 | 177 |
179 // Clears the internal list of PluginGroups and copies them from the vector. | 178 // Clears the internal list of PluginGroups and copies them from the vector. |
180 void SetPlugins(const std::vector<webkit::WebPluginInfo>& plugins); | 179 void SetPlugins(const std::vector<webkit::WebPluginInfo>& plugins); |
181 | 180 |
182 void set_will_load_plugins_callback(const base::Closure& callback); | 181 void set_will_load_plugins_callback(const base::Closure& callback); |
183 | 182 |
184 virtual ~PluginList(); | 183 virtual ~PluginList(); |
185 | 184 |
186 protected: | 185 protected: |
187 // This constructor is used in unit tests to override the platform-dependent | 186 // This constructor is used in unit tests to override the platform-dependent |
(...skipping 25 matching lines...) Expand all Loading... |
213 PluginGroup* CreatePluginGroup( | 212 PluginGroup* CreatePluginGroup( |
214 const webkit::WebPluginInfo& web_plugin_info) const; | 213 const webkit::WebPluginInfo& web_plugin_info) const; |
215 | 214 |
216 // Implements all IO dependent operations of the LoadPlugins method so that | 215 // Implements all IO dependent operations of the LoadPlugins method so that |
217 // test classes can mock these out. | 216 // test classes can mock these out. |
218 virtual void LoadPluginsInternal(ScopedVector<PluginGroup>* plugin_groups); | 217 virtual void LoadPluginsInternal(ScopedVector<PluginGroup>* plugin_groups); |
219 | 218 |
220 // Load all plugins from the default plugins directory. | 219 // Load all plugins from the default plugins directory. |
221 void LoadPlugins(); | 220 void LoadPlugins(); |
222 | 221 |
223 // Load all plugins from a specific directory. | 222 // Walks a directory and produces a list of all the plugins to potentially |
224 // |plugin_groups| is updated with loaded plugin information. | 223 // load in that directory. |
225 // |visited_plugins| is updated with paths to all plugins that were considered | 224 void GetPluginsInDir(const FilePath& path, std::vector<FilePath>* plugins); |
226 // (including those we didn't load). | |
227 void LoadPluginsFromDir(const FilePath& path, | |
228 ScopedVector<PluginGroup>* plugin_groups, | |
229 std::set<FilePath>* visited_plugins); | |
230 | 225 |
231 // Returns true if we should load the given plugin, or false otherwise. | 226 // Returns true if we should load the given plugin, or false otherwise. |
232 // |plugins| is the list of plugins we have crawled in the current plugin | 227 // |plugins| is the list of plugins we have crawled in the current plugin |
233 // loading run. | 228 // loading run. |
234 bool ShouldLoadPlugin(const webkit::WebPluginInfo& info, | 229 bool ShouldLoadPlugin(const webkit::WebPluginInfo& info, |
235 ScopedVector<PluginGroup>* plugins); | 230 ScopedVector<PluginGroup>* plugins); |
236 | 231 |
237 // Returns true if the plugin supports |mime_type|. |mime_type| should be all | 232 // Returns true if the plugin supports |mime_type|. |mime_type| should be all |
238 // lower case. | 233 // lower case. |
239 bool SupportsType(const webkit::WebPluginInfo& plugin, | 234 bool SupportsType(const webkit::WebPluginInfo& plugin, |
(...skipping 16 matching lines...) Expand all Loading... |
256 void PlatformInit(); | 251 void PlatformInit(); |
257 | 252 |
258 // | 253 // |
259 // Command-line switches | 254 // Command-line switches |
260 // | 255 // |
261 | 256 |
262 #if defined(OS_WIN) | 257 #if defined(OS_WIN) |
263 // true if we shouldn't load the new WMP plugin. | 258 // true if we shouldn't load the new WMP plugin. |
264 bool dont_load_new_wmp_; | 259 bool dont_load_new_wmp_; |
265 | 260 |
266 // Loads plugins registered under HKCU\Software\MozillaPlugins and | 261 // Gets plugin paths registered under HKCU\Software\MozillaPlugins and |
267 // HKLM\Software\MozillaPlugins. | 262 // HKLM\Software\MozillaPlugins. |
268 void LoadPluginsFromRegistry(ScopedVector<PluginGroup>* plugins, | 263 void GetPluginPathsFromRegistry(std::vector<FilePath>* plugins); |
269 std::set<FilePath>* visited_plugins); | |
270 #endif | 264 #endif |
271 | 265 |
272 // | 266 // |
273 // Internals | 267 // Internals |
274 // | 268 // |
275 | 269 |
276 // If true, we reload plugins even if they've been loaded already. | 270 // If true, we reload plugins even if they've been loaded already. |
277 bool plugins_need_refresh_; | 271 bool plugins_need_refresh_; |
278 | 272 |
279 // Extra plugin paths that we want to search when loading. | 273 // Extra plugin paths that we want to search when loading. |
(...skipping 26 matching lines...) Expand all Loading... |
306 // Set to true if the default plugin is enabled. | 300 // Set to true if the default plugin is enabled. |
307 bool default_plugin_enabled_; | 301 bool default_plugin_enabled_; |
308 | 302 |
309 DISALLOW_COPY_AND_ASSIGN(PluginList); | 303 DISALLOW_COPY_AND_ASSIGN(PluginList); |
310 }; | 304 }; |
311 | 305 |
312 } // namespace npapi | 306 } // namespace npapi |
313 } // namespace webkit | 307 } // namespace webkit |
314 | 308 |
315 #endif // WEBKIT_PLUGINS_NPAPI_PLUGIN_LIST_H_ | 309 #endif // WEBKIT_PLUGINS_NPAPI_PLUGIN_LIST_H_ |
OLD | NEW |