OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_GLUE_PLUGINS_PLUGIN_LIST_H_ | 5 #ifndef WEBKIT_GLUE_PLUGINS_PLUGIN_LIST_H_ |
6 #define WEBKIT_GLUE_PLUGINS_PLUGIN_LIST_H_ | 6 #define WEBKIT_GLUE_PLUGINS_PLUGIN_LIST_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 | 126 |
127 // Shutdown all plugins. Should be called at process teardown. | 127 // Shutdown all plugins. Should be called at process teardown. |
128 void Shutdown(); | 128 void Shutdown(); |
129 | 129 |
130 // Get all the plugins. | 130 // Get all the plugins. |
131 void GetPlugins(bool refresh, std::vector<WebPluginInfo>* plugins); | 131 void GetPlugins(bool refresh, std::vector<WebPluginInfo>* plugins); |
132 | 132 |
133 // Get all the enabled plugins. | 133 // Get all the enabled plugins. |
134 void GetEnabledPlugins(bool refresh, std::vector<WebPluginInfo>* plugins); | 134 void GetEnabledPlugins(bool refresh, std::vector<WebPluginInfo>* plugins); |
135 | 135 |
136 // Returns true if a plugin is found for the given url and mime type | 136 // Returns a list in |info| containing plugins that are found for |
137 // (including disabled plugins, for which |info->enabled| is false). | 137 // the given url and mime type (including disabled plugins, for |
138 // The mime type which corresponds to the URL is optionally returned | 138 // which |info->enabled| is false). The mime type which corresponds |
139 // back. | 139 // to the URL is optionally returned back in |actual_mime_types| (if |
140 // The allow_wildcard parameter controls whether this function returns | 140 // it is non-NULL), one for each of the plugin info objects found. |
141 // plugins which support wildcard mime types (* as the mime type). | 141 // The |allow_wildcard| parameter controls whether this function |
| 142 // returns plugins which support wildcard mime types (* as the mime |
| 143 // type). The |info| parameter is required to be non-NULL. The |
| 144 // list is in order of "most desirable" to "least desirable", |
| 145 // meaning that the default plugin is at the end of the list. |
| 146 void GetPluginInfoArray(const GURL& url, |
| 147 const std::string& mime_type, |
| 148 bool allow_wildcard, |
| 149 std::vector<WebPluginInfo>* info, |
| 150 std::vector<std::string>* actual_mime_types); |
| 151 |
| 152 // Returns the first item from the list returned in GetPluginInfo in |info|. |
| 153 // Returns true if it found a match. |actual_mime_type| may be NULL. |
142 bool GetPluginInfo(const GURL& url, | 154 bool GetPluginInfo(const GURL& url, |
143 const std::string& mime_type, | 155 const std::string& mime_type, |
144 bool allow_wildcard, | 156 bool allow_wildcard, |
145 WebPluginInfo* info, | 157 WebPluginInfo* info, |
146 std::string* actual_mime_type); | 158 std::string* actual_mime_type); |
147 | 159 |
148 // Get plugin info by plugin path (including disabled plugins). Returns true | 160 // Get plugin info by plugin path (including disabled plugins). Returns true |
149 // if the plugin is found and WebPluginInfo has been filled in |info|. | 161 // if the plugin is found and WebPluginInfo has been filled in |info|. |
150 bool GetPluginInfoByPath(const FilePath& plugin_path, | 162 bool GetPluginInfoByPath(const FilePath& plugin_path, |
151 WebPluginInfo* info); | 163 WebPluginInfo* info); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 // loading run. | 222 // loading run. |
211 bool ShouldLoadPlugin(const WebPluginInfo& info, | 223 bool ShouldLoadPlugin(const WebPluginInfo& info, |
212 std::vector<WebPluginInfo>* plugins); | 224 std::vector<WebPluginInfo>* plugins); |
213 | 225 |
214 // Return whether a plug-in group with the given name should be disabled, | 226 // Return whether a plug-in group with the given name should be disabled, |
215 // either because it already is on the list of disabled groups, or because it | 227 // either because it already is on the list of disabled groups, or because it |
216 // is blacklisted by a policy. In the latter case, add the plugin group to the | 228 // is blacklisted by a policy. In the latter case, add the plugin group to the |
217 // list of disabled groups as well. | 229 // list of disabled groups as well. |
218 bool ShouldDisableGroup(const string16& group_name); | 230 bool ShouldDisableGroup(const string16& group_name); |
219 | 231 |
220 // Find a plugin by mime type; only searches enabled plugins. | |
221 // The allow_wildcard parameter controls whether this function returns | |
222 // plugins which support wildcard mime types (* as the mime type) | |
223 bool FindPlugin(const std::string &mime_type, | |
224 bool allow_wildcard, | |
225 WebPluginInfo* info); | |
226 | |
227 // Just like |FindPlugin| but it only looks at the disabled plug-ins. | |
228 bool FindDisabledPlugin(const std::string &mime_type, | |
229 bool allow_wildcard, | |
230 WebPluginInfo* info); | |
231 | |
232 // Find a plugin by extension; only searches enabled plugins. Returns the | |
233 // corresponding mime type. | |
234 bool FindPlugin(const GURL &url, | |
235 std::string* actual_mime_type, | |
236 WebPluginInfo* info); | |
237 | |
238 // Like GetPluginGroups above, but works on a given vector of plugins. | 232 // Like GetPluginGroups above, but works on a given vector of plugins. |
239 static void GetPluginGroups(const std::vector<WebPluginInfo>* plugins, | 233 static void GetPluginGroups(const std::vector<WebPluginInfo>* plugins, |
240 PluginMap* plugin_groups); | 234 PluginMap* plugin_groups); |
241 | 235 |
242 // Returns true if the given WebPluginInfo supports "mime-type". | 236 // Returns true if the given WebPluginInfo supports "mime-type". |
243 // mime_type should be all lower case. | 237 // mime_type should be all lower case. |
244 static bool SupportsType(const WebPluginInfo& info, | 238 static bool SupportsType(const WebPluginInfo& info, |
245 const std::string &mime_type, | 239 const std::string &mime_type, |
246 bool allow_wildcard); | 240 bool allow_wildcard); |
247 | 241 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 Lock lock_; | 306 Lock lock_; |
313 | 307 |
314 friend struct base::DefaultLazyInstanceTraits<PluginList>; | 308 friend struct base::DefaultLazyInstanceTraits<PluginList>; |
315 | 309 |
316 DISALLOW_COPY_AND_ASSIGN(PluginList); | 310 DISALLOW_COPY_AND_ASSIGN(PluginList); |
317 }; | 311 }; |
318 | 312 |
319 } // namespace NPAPI | 313 } // namespace NPAPI |
320 | 314 |
321 #endif // WEBKIT_GLUE_PLUGINS_PLUGIN_LIST_H_ | 315 #endif // WEBKIT_GLUE_PLUGINS_PLUGIN_LIST_H_ |
OLD | NEW |