OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 // when the instance is created. | 52 // when the instance is created. |
53 struct CustomLazyInstanceTraits; | 53 struct CustomLazyInstanceTraits; |
54 | 54 |
55 // Gets the one instance of the PluginList. | 55 // Gets the one instance of the PluginList. |
56 static PluginList* Singleton(); | 56 static PluginList* Singleton(); |
57 | 57 |
58 // Returns true if we're in debug-plugin-loading mode. This is controlled | 58 // Returns true if we're in debug-plugin-loading mode. This is controlled |
59 // by a command line switch. | 59 // by a command line switch. |
60 static bool DebugPluginLoading(); | 60 static bool DebugPluginLoading(); |
61 | 61 |
| 62 // Returns true if the plugin supports |mime_type|. |mime_type| should be all |
| 63 // lower case. |
| 64 static bool SupportsType(const webkit::WebPluginInfo& plugin, |
| 65 const std::string& mime_type, |
| 66 bool allow_wildcard); |
| 67 |
62 // Cause the plugin list to refresh next time they are accessed, regardless | 68 // Cause the plugin list to refresh next time they are accessed, regardless |
63 // of whether they are already loaded. | 69 // of whether they are already loaded. |
64 void RefreshPlugins(); | 70 void RefreshPlugins(); |
65 | 71 |
66 // Add/Remove an extra plugin to load when we actually do the loading. Must | 72 // Add/Remove an extra plugin to load when we actually do the loading. Must |
67 // be called before the plugins have been loaded. | 73 // be called before the plugins have been loaded. |
68 void AddExtraPluginPath(const FilePath& plugin_path); | 74 void AddExtraPluginPath(const FilePath& plugin_path); |
69 void RemoveExtraPluginPath(const FilePath& plugin_path); | 75 void RemoveExtraPluginPath(const FilePath& plugin_path); |
70 | 76 |
71 // Same as above, but specifies a directory in which to search for plugins. | 77 // Same as above, but specifies a directory in which to search for plugins. |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 // load in that directory. | 202 // load in that directory. |
197 void GetPluginsInDir(const FilePath& path, std::vector<FilePath>* plugins); | 203 void GetPluginsInDir(const FilePath& path, std::vector<FilePath>* plugins); |
198 | 204 |
199 // Returns true if we should load the given plugin, or false otherwise. | 205 // Returns true if we should load the given plugin, or false otherwise. |
200 // |plugins| is the list of plugins we have crawled in the current plugin | 206 // |plugins| is the list of plugins we have crawled in the current plugin |
201 // loading run. | 207 // loading run. |
202 bool ShouldLoadPluginUsingPluginList( | 208 bool ShouldLoadPluginUsingPluginList( |
203 const webkit::WebPluginInfo& info, | 209 const webkit::WebPluginInfo& info, |
204 std::vector<webkit::WebPluginInfo>* plugins); | 210 std::vector<webkit::WebPluginInfo>* plugins); |
205 | 211 |
206 // Returns true if the plugin supports |mime_type|. |mime_type| should be all | |
207 // lower case. | |
208 bool SupportsType(const webkit::WebPluginInfo& plugin, | |
209 const std::string& mime_type, | |
210 bool allow_wildcard); | |
211 | |
212 // Returns true if the given plugin supports a given file extension. | 212 // Returns true if the given plugin supports a given file extension. |
213 // |extension| should be all lower case. If |mime_type| is not NULL, it will | 213 // |extension| should be all lower case. If |mime_type| is not NULL, it will |
214 // be set to the MIME type if found. The MIME type which corresponds to the | 214 // be set to the MIME type if found. The MIME type which corresponds to the |
215 // extension is optionally returned back. | 215 // extension is optionally returned back. |
216 bool SupportsExtension(const webkit::WebPluginInfo& plugin, | 216 bool SupportsExtension(const webkit::WebPluginInfo& plugin, |
217 const std::string& extension, | 217 const std::string& extension, |
218 std::string* actual_mime_type); | 218 std::string* actual_mime_type); |
219 | 219 |
220 // Removes a plug-in from |plugins_list_| by its path. | 220 // Removes a plug-in from |plugins_list_| by its path. |
221 static bool RemovePlugin(const FilePath& filename, | 221 static bool RemovePlugin(const FilePath& filename, |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 // accessed on multiple threads. | 269 // accessed on multiple threads. |
270 base::Lock lock_; | 270 base::Lock lock_; |
271 | 271 |
272 DISALLOW_COPY_AND_ASSIGN(PluginList); | 272 DISALLOW_COPY_AND_ASSIGN(PluginList); |
273 }; | 273 }; |
274 | 274 |
275 } // namespace npapi | 275 } // namespace npapi |
276 } // namespace webkit | 276 } // namespace webkit |
277 | 277 |
278 #endif // WEBKIT_PLUGINS_NPAPI_PLUGIN_LIST_H_ | 278 #endif // WEBKIT_PLUGINS_NPAPI_PLUGIN_LIST_H_ |
OLD | NEW |