| 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 "build/build_config.h" | |
| 9 | |
| 10 #include <string> | 8 #include <string> |
| 11 #include <vector> | 9 #include <vector> |
| 12 | 10 |
| 13 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 14 #include "base/file_path.h" | 12 #include "base/file_path.h" |
| 13 #include "base/native_library.h" |
| 15 #include "base/ref_counted.h" | 14 #include "base/ref_counted.h" |
| 16 #include "webkit/glue/plugins/plugin_list.h" | 15 #include "webkit/glue/plugins/plugin_list.h" |
| 17 #include "webkit/glue/webplugin.h" | 16 #include "webkit/glue/webplugin.h" |
| 18 | 17 |
| 19 struct WebPluginInfo; | 18 struct WebPluginInfo; |
| 20 | 19 |
| 21 namespace NPAPI | 20 namespace NPAPI |
| 22 { | 21 { |
| 23 | 22 |
| 24 class PluginInstance; | 23 class PluginInstance; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 // Attempts to load the plugin from the library. | 75 // Attempts to load the plugin from the library. |
| 77 // Returns true if it is a legitimate plugin, false otherwise | 76 // Returns true if it is a legitimate plugin, false otherwise |
| 78 bool Load(); | 77 bool Load(); |
| 79 | 78 |
| 80 // Unloads the plugin library. | 79 // Unloads the plugin library. |
| 81 void Unload(); | 80 void Unload(); |
| 82 | 81 |
| 83 // Shutdown the plugin library. | 82 // Shutdown the plugin library. |
| 84 void Shutdown(); | 83 void Shutdown(); |
| 85 | 84 |
| 86 public: | |
| 87 #if defined(OS_WIN) | |
| 88 typedef HMODULE NativeLibrary; | |
| 89 typedef char* NativeLibraryFunctionNameType; | |
| 90 #define FUNCTION_NAME(x) x | |
| 91 #elif defined(OS_MACOSX) | |
| 92 typedef CFBundleRef NativeLibrary; | |
| 93 typedef CFStringRef NativeLibraryFunctionNameType; | |
| 94 #define FUNCTION_NAME(x) CFSTR(x) | |
| 95 #elif defined(OS_LINUX) | |
| 96 typedef void* NativeLibrary; | |
| 97 typedef const char* NativeLibraryFunctionNameType; | |
| 98 #define FUNCTION_NAME(x) x | |
| 99 #endif // OS_* | |
| 100 | |
| 101 // Loads a native library from disk. NOTE: You must release it with | |
| 102 // UnloadNativeLibrary when you're done. | |
| 103 static NativeLibrary LoadNativeLibrary(const FilePath& library_path); | |
| 104 | |
| 105 // Unloads a native library. | |
| 106 static void UnloadNativeLibrary(NativeLibrary library); | |
| 107 | |
| 108 private: | 85 private: |
| 109 // Gets a function pointer from a native library. | |
| 110 static void* GetFunctionPointerFromNativeLibrary( | |
| 111 NativeLibrary library, | |
| 112 NativeLibraryFunctionNameType name); | |
| 113 | |
| 114 bool internal_; // Whether this an internal plugin. | 86 bool internal_; // Whether this an internal plugin. |
| 115 WebPluginInfo web_plugin_info_; // supported mime types, description | 87 WebPluginInfo web_plugin_info_; // supported mime types, description |
| 116 NativeLibrary library_; // the opened library reference | 88 base::NativeLibrary library_; // the opened library reference |
| 117 NPPluginFuncs plugin_funcs_; // the struct of plugin side functions | 89 NPPluginFuncs plugin_funcs_; // the struct of plugin side functions |
| 118 bool initialized_; // is the plugin initialized | 90 bool initialized_; // is the plugin initialized |
| 119 NPSavedData *saved_data_; // persisted plugin info for NPAPI | 91 NPSavedData *saved_data_; // persisted plugin info for NPAPI |
| 120 int instance_count_; // count of plugins in use | 92 int instance_count_; // count of plugins in use |
| 121 | 93 |
| 122 // Function pointers to entry points into the plugin. | 94 // Function pointers to entry points into the plugin. |
| 123 PluginEntryPoints entry_points_; | 95 PluginEntryPoints entry_points_; |
| 124 | 96 |
| 125 DISALLOW_EVIL_CONSTRUCTORS(PluginLib); | 97 DISALLOW_EVIL_CONSTRUCTORS(PluginLib); |
| 126 }; | 98 }; |
| 127 | 99 |
| 128 } // namespace NPAPI | 100 } // namespace NPAPI |
| 129 | 101 |
| 130 #endif // WEBKIT_GLUE_PLUGIN_PLUGIN_LIB_H__ | 102 #endif // WEBKIT_GLUE_PLUGIN_PLUGIN_LIB_H__ |
| OLD | NEW |