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_LIB_H__ | 5 #ifndef WEBKIT_GLUE_PLUGIN_PLUGIN_LIB_H__ |
6 #define WEBKIT_GLUE_PLUGIN_PLUGIN_LIB_H__ | 6 #define WEBKIT_GLUE_PLUGIN_PLUGIN_LIB_H__ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
13 #include "base/native_library.h" | 13 #include "base/native_library.h" |
14 #include "base/ref_counted.h" | 14 #include "base/ref_counted.h" |
| 15 #include "build/build_config.h" |
15 #include "webkit/glue/plugins/plugin_list.h" | 16 #include "webkit/glue/plugins/plugin_list.h" |
16 #include "webkit/glue/webplugin.h" | 17 #include "webkit/glue/webplugin.h" |
17 | 18 |
18 struct WebPluginInfo; | 19 struct WebPluginInfo; |
19 | 20 |
20 namespace NPAPI | 21 namespace NPAPI |
21 { | 22 { |
22 | 23 |
23 class PluginInstance; | 24 class PluginInstance; |
24 | 25 |
25 // A PluginLib is a single NPAPI Plugin Library, and is the lifecycle | 26 // A PluginLib is a single NPAPI Plugin Library, and is the lifecycle |
26 // manager for new PluginInstances. | 27 // manager for new PluginInstances. |
27 class PluginLib : public base::RefCounted<PluginLib> { | 28 class PluginLib : public base::RefCounted<PluginLib> { |
28 public: | 29 public: |
29 static PluginLib* CreatePluginLib(const FilePath& filename); | 30 static PluginLib* CreatePluginLib(const FilePath& filename); |
30 virtual ~PluginLib(); | 31 virtual ~PluginLib(); |
31 | 32 |
32 // Creates a WebPluginInfo structure given a plugin's path. On success | 33 // Creates a WebPluginInfo structure given a plugin's path. On success |
33 // returns true, with the information being put into "info". | 34 // returns true, with the information being put into "info". |
34 // Returns false if the library couldn't be found, or if it's not a plugin. | 35 // Returns false if the library couldn't be found, or if it's not a plugin. |
35 static bool ReadWebPluginInfo(const FilePath& filename, WebPluginInfo* info); | 36 static bool ReadWebPluginInfo(const FilePath& filename, WebPluginInfo* info); |
36 | 37 |
| 38 #if defined(OS_LINUX) |
| 39 // Parse the result of an NP_GetMIMEDescription() call, returning |
| 40 // false on parse error. This API is only used on Linux, and is |
| 41 // exposed here for testing. |
| 42 static bool ParseMIMEDescription(const char* description, |
| 43 std::vector<WebPluginMimeType>* mime_types); |
| 44 #endif |
| 45 |
37 // Unloads all the loaded plugin libraries and cleans up the plugin map. | 46 // Unloads all the loaded plugin libraries and cleans up the plugin map. |
38 static void UnloadAllPlugins(); | 47 static void UnloadAllPlugins(); |
39 | 48 |
40 // Shuts down all loaded plugin instances. | 49 // Shuts down all loaded plugin instances. |
41 static void ShutdownAllPlugins(); | 50 static void ShutdownAllPlugins(); |
42 | 51 |
43 // Get the Plugin's function pointer table. | 52 // Get the Plugin's function pointer table. |
44 NPPluginFuncs* functions(); | 53 NPPluginFuncs* functions(); |
45 | 54 |
46 // Creates a new instance of this plugin. | 55 // Creates a new instance of this plugin. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 | 102 |
94 // Function pointers to entry points into the plugin. | 103 // Function pointers to entry points into the plugin. |
95 PluginEntryPoints entry_points_; | 104 PluginEntryPoints entry_points_; |
96 | 105 |
97 DISALLOW_EVIL_CONSTRUCTORS(PluginLib); | 106 DISALLOW_EVIL_CONSTRUCTORS(PluginLib); |
98 }; | 107 }; |
99 | 108 |
100 } // namespace NPAPI | 109 } // namespace NPAPI |
101 | 110 |
102 #endif // WEBKIT_GLUE_PLUGIN_PLUGIN_LIB_H__ | 111 #endif // WEBKIT_GLUE_PLUGIN_PLUGIN_LIB_H__ |
OLD | NEW |