| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_PLUGIN_PLUGIN_LIST_H__ | 5 #ifndef WEBKIT_GLUE_PLUGIN_PLUGIN_LIST_H__ |
| 6 #define WEBKIT_GLUE_PLUGIN_PLUGIN_LIST_H__ | 6 #define WEBKIT_GLUE_PLUGIN_PLUGIN_LIST_H__ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 template <typename T> | 22 template <typename T> |
| 23 struct DefaultLazyInstanceTraits; | 23 struct DefaultLazyInstanceTraits; |
| 24 | 24 |
| 25 } // namespace base | 25 } // namespace base |
| 26 | 26 |
| 27 namespace NPAPI | 27 namespace NPAPI |
| 28 { | 28 { |
| 29 | 29 |
| 30 #define kDefaultPluginLibraryName FILE_PATH_LITERAL("default_plugin") | 30 #define kDefaultPluginLibraryName FILE_PATH_LITERAL("default_plugin") |
| 31 #define kGearsPluginLibraryName FILE_PATH_LITERAL("gears") | 31 #define kGearsPluginLibraryName FILE_PATH_LITERAL("gears") |
| 32 #define kNaClPluginLibraryName FILE_PATH_LITERAL("internal_nacl") | |
| 33 | 32 |
| 34 class PluginInstance; | 33 class PluginInstance; |
| 35 | 34 |
| 36 // This struct holds entry points into a plugin. The entry points are | 35 // This struct holds entry points into a plugin. The entry points are |
| 37 // slightly different between Linux and other platforms. | 36 // slightly different between Linux and other platforms. |
| 38 struct PluginEntryPoints { | 37 struct PluginEntryPoints { |
| 39 #if !defined(OS_LINUX) && !defined(OS_FREEBSD) | 38 #if !defined(OS_LINUX) && !defined(OS_FREEBSD) |
| 40 NP_GetEntryPointsFunc np_getentrypoints; | 39 NP_GetEntryPointsFunc np_getentrypoints; |
| 41 #endif | 40 #endif |
| 42 NP_InitializeFunc np_initialize; | 41 NP_InitializeFunc np_initialize; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 // internally-owned PluginEntryPoints pointer. | 98 // internally-owned PluginEntryPoints pointer. |
| 100 // Returns false if the library couldn't be found, or if it's not a plugin. | 99 // Returns false if the library couldn't be found, or if it's not a plugin. |
| 101 bool ReadPluginInfo(const FilePath& filename, | 100 bool ReadPluginInfo(const FilePath& filename, |
| 102 WebPluginInfo* info, | 101 WebPluginInfo* info, |
| 103 const PluginEntryPoints** entry_points); | 102 const PluginEntryPoints** entry_points); |
| 104 | 103 |
| 105 // Populate a WebPluginInfo from a PluginVersionInfo. | 104 // Populate a WebPluginInfo from a PluginVersionInfo. |
| 106 static bool CreateWebPluginInfo(const PluginVersionInfo& pvi, | 105 static bool CreateWebPluginInfo(const PluginVersionInfo& pvi, |
| 107 WebPluginInfo* info); | 106 WebPluginInfo* info); |
| 108 | 107 |
| 109 // Set NativeClient plugin mode (avoid loading both the built-in and | |
| 110 // the external version of the plugin). The arguments provide pointers | |
| 111 // to NaCl plugin entry points - the functions are not referenced directly | |
| 112 // from this class to avoid introducing dependency between Webkit glue | |
| 113 // library and NaCl code. | |
| 114 static void UseInternalNaCl(PluginEntryPoints* entry_points); | |
| 115 | |
| 116 // Shutdown all plugins. Should be called at process teardown. | 108 // Shutdown all plugins. Should be called at process teardown. |
| 117 void Shutdown(); | 109 void Shutdown(); |
| 118 | 110 |
| 119 // Get all the plugins | 111 // Get all the plugins |
| 120 void GetPlugins(bool refresh, std::vector<WebPluginInfo>* plugins); | 112 void GetPlugins(bool refresh, std::vector<WebPluginInfo>* plugins); |
| 121 | 113 |
| 122 // Returns true if a plugin is found for the given url and mime type. | 114 // Returns true if a plugin is found for the given url and mime type. |
| 123 // The mime type which corresponds to the URL is optionally returned | 115 // The mime type which corresponds to the URL is optionally returned |
| 124 // back. | 116 // back. |
| 125 // The allow_wildcard parameter controls whether this function returns | 117 // The allow_wildcard parameter controls whether this function returns |
| (...skipping 23 matching lines...) Expand all Loading... |
| 149 // Load all plugins from a specific directory | 141 // Load all plugins from a specific directory |
| 150 void LoadPluginsFromDir(const FilePath& path, | 142 void LoadPluginsFromDir(const FilePath& path, |
| 151 std::vector<WebPluginInfo>* plugins); | 143 std::vector<WebPluginInfo>* plugins); |
| 152 | 144 |
| 153 // Returns true if we should load the given plugin, or false otherwise. | 145 // Returns true if we should load the given plugin, or false otherwise. |
| 154 // plugins is the list of plugins we have crawled in the current plugin | 146 // plugins is the list of plugins we have crawled in the current plugin |
| 155 // loading run. | 147 // loading run. |
| 156 bool ShouldLoadPlugin(const WebPluginInfo& info, | 148 bool ShouldLoadPlugin(const WebPluginInfo& info, |
| 157 std::vector<WebPluginInfo>* plugins); | 149 std::vector<WebPluginInfo>* plugins); |
| 158 | 150 |
| 159 // Returns true if we should load the given plugin, or false otherwise. | |
| 160 // This function is platform-specific and is called from ShouldLoadPlugin. | |
| 161 bool PlatformShouldLoadPlugin(const WebPluginInfo& info, | |
| 162 std::vector<WebPluginInfo>* plugins); | |
| 163 | |
| 164 // Find a plugin by mime type. | 151 // Find a plugin by mime type. |
| 165 // The allow_wildcard parameter controls whether this function returns | 152 // The allow_wildcard parameter controls whether this function returns |
| 166 // plugins which support wildcard mime types (* as the mime type) | 153 // plugins which support wildcard mime types (* as the mime type) |
| 167 bool FindPlugin(const std::string &mime_type, | 154 bool FindPlugin(const std::string &mime_type, |
| 168 bool allow_wildcard, | 155 bool allow_wildcard, |
| 169 WebPluginInfo* info); | 156 WebPluginInfo* info); |
| 170 | 157 |
| 171 // Find a plugin by extension. Returns the corresponding mime type. | 158 // Find a plugin by extension. Returns the corresponding mime type. |
| 172 bool FindPlugin(const GURL &url, | 159 bool FindPlugin(const GURL &url, |
| 173 std::string* actual_mime_type, | 160 std::string* actual_mime_type, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 | 205 |
| 219 // Extra plugin paths that we want to search when loading. | 206 // Extra plugin paths that we want to search when loading. |
| 220 std::vector<FilePath> extra_plugin_paths_; | 207 std::vector<FilePath> extra_plugin_paths_; |
| 221 | 208 |
| 222 // Extra plugin directories that we want to search when loading. | 209 // Extra plugin directories that we want to search when loading. |
| 223 std::vector<FilePath> extra_plugin_dirs_; | 210 std::vector<FilePath> extra_plugin_dirs_; |
| 224 | 211 |
| 225 // Holds information about internal plugins. | 212 // Holds information about internal plugins. |
| 226 std::vector<PluginVersionInfo> internal_plugins_; | 213 std::vector<PluginVersionInfo> internal_plugins_; |
| 227 | 214 |
| 228 // true if we should use our internal Native Client plugin | |
| 229 bool use_internal_nacl_; | |
| 230 | |
| 231 // Need synchronization for the above members since this object can be | 215 // Need synchronization for the above members since this object can be |
| 232 // accessed on multiple threads. | 216 // accessed on multiple threads. |
| 233 Lock lock_; | 217 Lock lock_; |
| 234 | 218 |
| 235 friend struct base::DefaultLazyInstanceTraits<PluginList>; | 219 friend struct base::DefaultLazyInstanceTraits<PluginList>; |
| 236 | 220 |
| 237 DISALLOW_COPY_AND_ASSIGN(PluginList); | 221 DISALLOW_COPY_AND_ASSIGN(PluginList); |
| 238 }; | 222 }; |
| 239 | 223 |
| 240 } // namespace NPAPI | 224 } // namespace NPAPI |
| 241 | 225 |
| 242 #endif // WEBKIT_GLUE_PLUGIN_PLUGIN_LIST_H__ | 226 #endif // WEBKIT_GLUE_PLUGIN_PLUGIN_LIST_H__ |
| OLD | NEW |