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