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 18 matching lines...) Expand all Loading... |
29 } // namespace base | 29 } // namespace base |
30 | 30 |
31 namespace webkit { | 31 namespace webkit { |
32 namespace npapi { | 32 namespace npapi { |
33 | 33 |
34 extern FilePath::CharType kDefaultPluginLibraryName[]; | 34 extern FilePath::CharType kDefaultPluginLibraryName[]; |
35 | 35 |
36 class PluginInstance; | 36 class PluginInstance; |
37 | 37 |
38 // This struct holds entry points into a plugin. The entry points are | 38 // This struct holds entry points into a plugin. The entry points are |
39 // slightly different between Win/Mac and Unixes. | 39 // slightly different between Win/Mac and Unixes. Note that the interface for |
| 40 // querying plugins is synchronous and it is preferable to use a higher-level |
| 41 // asynchronous information to query information. |
40 struct PluginEntryPoints { | 42 struct PluginEntryPoints { |
41 #if !defined(OS_POSIX) || defined(OS_MACOSX) | 43 #if !defined(OS_POSIX) || defined(OS_MACOSX) |
42 NP_GetEntryPointsFunc np_getentrypoints; | 44 NP_GetEntryPointsFunc np_getentrypoints; |
43 #endif | 45 #endif |
44 NP_InitializeFunc np_initialize; | 46 NP_InitializeFunc np_initialize; |
45 NP_ShutdownFunc np_shutdown; | 47 NP_ShutdownFunc np_shutdown; |
46 }; | 48 }; |
47 | 49 |
48 // The PluginList is responsible for loading our NPAPI based plugins. It does | 50 // The PluginList is responsible for loading our NPAPI based plugins. It does |
49 // so in whatever manner is appropriate for the platform. On Windows, it loads | 51 // so in whatever manner is appropriate for the platform. On Windows, it loads |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 // In Windows plugins, the mime types are passed as a specially formatted list | 113 // In Windows plugins, the mime types are passed as a specially formatted list |
112 // of strings. This function parses those strings into a WebPluginMimeType | 114 // of strings. This function parses those strings into a WebPluginMimeType |
113 // vector. | 115 // vector. |
114 // TODO(evan): move this code into plugin_list_win. | 116 // TODO(evan): move this code into plugin_list_win. |
115 static bool ParseMimeTypes( | 117 static bool ParseMimeTypes( |
116 const std::string& mime_types, | 118 const std::string& mime_types, |
117 const std::string& file_extensions, | 119 const std::string& file_extensions, |
118 const string16& mime_type_descriptions, | 120 const string16& mime_type_descriptions, |
119 std::vector<webkit::WebPluginMimeType>* parsed_mime_types); | 121 std::vector<webkit::WebPluginMimeType>* parsed_mime_types); |
120 | 122 |
121 // Get all the plugins. | 123 // Get all the plugins synchronously. |
122 void GetPlugins(std::vector<webkit::WebPluginInfo>* plugins); | 124 void GetPlugins(std::vector<webkit::WebPluginInfo>* plugins); |
123 | 125 |
124 // Returns a list in |info| containing plugins that are found for | 126 // Returns a list in |info| containing plugins that are found for |
125 // the given url and mime type (including disabled plugins, for | 127 // the given url and mime type (including disabled plugins, for |
126 // which |info->enabled| is false). The mime type which corresponds | 128 // which |info->enabled| is false). The mime type which corresponds |
127 // to the URL is optionally returned back in |actual_mime_types| (if | 129 // to the URL is optionally returned back in |actual_mime_types| (if |
128 // it is non-NULL), one for each of the plugin info objects found. | 130 // it is non-NULL), one for each of the plugin info objects found. |
129 // The |allow_wildcard| parameter controls whether this function | 131 // The |allow_wildcard| parameter controls whether this function |
130 // returns plugins which support wildcard mime types (* as the mime | 132 // returns plugins which support wildcard mime types (* as the mime |
131 // type). The |info| parameter is required to be non-NULL. The | 133 // type). The |info| parameter is required to be non-NULL. The |
132 // list is in order of "most desirable" to "least desirable", | 134 // list is in order of "most desirable" to "least desirable", |
133 // meaning that the default plugin is at the end of the list. | 135 // meaning that the default plugin is at the end of the list. |
134 // If |use_stale| is NULL, this will load the plug-in list if necessary. | 136 // If |use_stale| is NULL, this will load the plug-in list if necessary. |
135 // If it is not NULL, the plug-in list will not be loaded, and |*use_stale| | 137 // If it is not NULL, the plug-in list will not be loaded, and |*use_stale| |
136 // will be true iff the plug-in list was stale. | 138 // will be true iff the plug-in list was stale. |
137 void GetPluginInfoArray(const GURL& url, | 139 void GetPluginInfoArray(const GURL& url, |
138 const std::string& mime_type, | 140 const std::string& mime_type, |
139 bool allow_wildcard, | 141 bool allow_wildcard, |
140 bool* use_stale, | 142 bool* use_stale, |
141 std::vector<webkit::WebPluginInfo>* info, | 143 std::vector<webkit::WebPluginInfo>* info, |
142 std::vector<std::string>* actual_mime_types); | 144 std::vector<std::string>* actual_mime_types); |
143 | 145 |
144 // Get plugin info by plugin path (including disabled plugins). Returns true | 146 // Get plugin info by plugin path (including disabled plugins). Returns true |
145 // if the plugin is found and WebPluginInfo has been filled in |info|. | 147 // if the plugin is found and WebPluginInfo has been filled in |info|. |
146 bool GetPluginInfoByPath(const FilePath& plugin_path, | 148 bool GetPluginInfoByPath(const FilePath& plugin_path, |
147 webkit::WebPluginInfo* info); | 149 webkit::WebPluginInfo* info); |
148 | 150 |
149 // Populates the given vector with all available plugin groups. | 151 // Populates the given vector with all available plugin groups. If |
| 152 // |load_if_necessary| is true, this will potentially load the plugin list |
| 153 // synchronously. |
150 void GetPluginGroups(bool load_if_necessary, | 154 void GetPluginGroups(bool load_if_necessary, |
151 std::vector<PluginGroup>* plugin_groups); | 155 std::vector<PluginGroup>* plugin_groups); |
152 | 156 |
153 // Returns a copy of the PluginGroup corresponding to the given WebPluginInfo. | 157 // Returns a copy of the PluginGroup corresponding to the given WebPluginInfo. |
154 // If no such group exists, it is created and added to the cache. | 158 // If no such group exists, it is created and added to the cache. |
155 // The caller takes ownership of the returned PluginGroup. | 159 // The caller takes ownership of the returned PluginGroup. |
156 PluginGroup* GetPluginGroup(const webkit::WebPluginInfo& web_plugin_info); | 160 PluginGroup* GetPluginGroup(const webkit::WebPluginInfo& web_plugin_info); |
157 | 161 |
158 // Returns the name of the PluginGroup with the given identifier. | 162 // Returns the name of the PluginGroup with the given identifier. |
159 // If no such group exists, an empty string is returned. | 163 // If no such group exists, an empty string is returned. |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 // Set to true if the default plugin is enabled. | 289 // Set to true if the default plugin is enabled. |
286 bool default_plugin_enabled_; | 290 bool default_plugin_enabled_; |
287 | 291 |
288 DISALLOW_COPY_AND_ASSIGN(PluginList); | 292 DISALLOW_COPY_AND_ASSIGN(PluginList); |
289 }; | 293 }; |
290 | 294 |
291 } // namespace npapi | 295 } // namespace npapi |
292 } // namespace webkit | 296 } // namespace webkit |
293 | 297 |
294 #endif // WEBKIT_PLUGINS_NPAPI_PLUGIN_LIST_H_ | 298 #endif // WEBKIT_PLUGINS_NPAPI_PLUGIN_LIST_H_ |
OLD | NEW |