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 CONTENT_CHILD_NPAPI_PLUGIN_LIB_H_ | 5 #ifndef CONTENT_CHILD_NPAPI_PLUGIN_LIB_H_ |
6 #define CONTENT_CHILD_NPAPI_PLUGIN_LIB_H_ | 6 #define CONTENT_CHILD_NPAPI_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/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/native_library.h" | 13 #include "base/native_library.h" |
14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
15 #include "content/child/npapi/webplugin.h" | 15 #include "content/child/npapi/webplugin.h" |
16 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
| 17 #include "content/public/common/webplugininfo.h" |
17 #include "third_party/npapi/bindings/nphostapi.h" | 18 #include "third_party/npapi/bindings/nphostapi.h" |
18 #include "webkit/plugins/webplugininfo.h" | |
19 | 19 |
20 namespace base { | 20 namespace base { |
21 class FilePath; | 21 class FilePath; |
22 } | 22 } |
23 | 23 |
24 namespace content { | 24 namespace content { |
25 | 25 |
26 class PluginInstance; | 26 class PluginInstance; |
27 | 27 |
28 // This struct holds entry points into a plugin. The entry points are | 28 // This struct holds entry points into a plugin. The entry points are |
(...skipping 24 matching lines...) Expand all Loading... |
53 NPPluginFuncs* functions(); | 53 NPPluginFuncs* functions(); |
54 | 54 |
55 // Creates a new instance of this plugin. | 55 // Creates a new instance of this plugin. |
56 PluginInstance* CreateInstance(const std::string& mime_type); | 56 PluginInstance* CreateInstance(const std::string& mime_type); |
57 | 57 |
58 // Called by the instance when the instance is tearing down. | 58 // Called by the instance when the instance is tearing down. |
59 void CloseInstance(); | 59 void CloseInstance(); |
60 | 60 |
61 // Gets information about this plugin and the mime types that it | 61 // Gets information about this plugin and the mime types that it |
62 // supports. | 62 // supports. |
63 const webkit::WebPluginInfo& plugin_info() { return web_plugin_info_; } | 63 const WebPluginInfo& plugin_info() { return web_plugin_info_; } |
64 | 64 |
65 // | 65 // |
66 // NPAPI functions | 66 // NPAPI functions |
67 // | 67 // |
68 | 68 |
69 // NPAPI method to initialize a Plugin. | 69 // NPAPI method to initialize a Plugin. |
70 // Initialize can be safely called multiple times | 70 // Initialize can be safely called multiple times |
71 NPError NP_Initialize(); | 71 NPError NP_Initialize(); |
72 | 72 |
73 // NPAPI method to shutdown a Plugin. | 73 // NPAPI method to shutdown a Plugin. |
(...skipping 15 matching lines...) Expand all Loading... |
89 // Indicates whether plugin unload can be deferred. | 89 // Indicates whether plugin unload can be deferred. |
90 void set_defer_unload(bool defer_unload) { | 90 void set_defer_unload(bool defer_unload) { |
91 defer_unload_ = defer_unload; | 91 defer_unload_ = defer_unload; |
92 } | 92 } |
93 | 93 |
94 // protected for testability. | 94 // protected for testability. |
95 protected: | 95 protected: |
96 friend class base::RefCounted<PluginLib>; | 96 friend class base::RefCounted<PluginLib>; |
97 | 97 |
98 // Creates a new PluginLib. | 98 // Creates a new PluginLib. |
99 explicit PluginLib(const webkit::WebPluginInfo& info); | 99 explicit PluginLib(const WebPluginInfo& info); |
100 | 100 |
101 virtual ~PluginLib(); | 101 virtual ~PluginLib(); |
102 | 102 |
103 // Attempts to load the plugin from the library. | 103 // Attempts to load the plugin from the library. |
104 // Returns true if it is a legitimate plugin, false otherwise | 104 // Returns true if it is a legitimate plugin, false otherwise |
105 bool Load(); | 105 bool Load(); |
106 | 106 |
107 // Unloads the plugin library. | 107 // Unloads the plugin library. |
108 void Unload(); | 108 void Unload(); |
109 | 109 |
110 // Shutdown the plugin library. | 110 // Shutdown the plugin library. |
111 void Shutdown(); | 111 void Shutdown(); |
112 | 112 |
113 private: | 113 private: |
114 webkit::WebPluginInfo web_plugin_info_; // Supported mime types, description | 114 WebPluginInfo web_plugin_info_; // Supported mime types, description |
115 base::NativeLibrary library_; // The opened library reference. | 115 base::NativeLibrary library_; // The opened library reference. |
116 NPPluginFuncs plugin_funcs_; // The struct of plugin side functions. | 116 NPPluginFuncs plugin_funcs_; // The struct of plugin side functions. |
117 bool initialized_; // Is the plugin initialized? | 117 bool initialized_; // Is the plugin initialized? |
118 NPSavedData *saved_data_; // Persisted plugin info for NPAPI. | 118 NPSavedData *saved_data_; // Persisted plugin info for NPAPI. |
119 int instance_count_; // Count of plugins in use. | 119 int instance_count_; // Count of plugins in use. |
120 bool skip_unload_; // True if library_ should not be unloaded. | 120 bool skip_unload_; // True if library_ should not be unloaded. |
121 | 121 |
122 // Function pointers to entry points into the plugin. | 122 // Function pointers to entry points into the plugin. |
123 PluginEntryPoints entry_points_; | 123 PluginEntryPoints entry_points_; |
124 | 124 |
125 // Set to true if unloading of the plugin dll is to be deferred. | 125 // Set to true if unloading of the plugin dll is to be deferred. |
126 bool defer_unload_; | 126 bool defer_unload_; |
127 | 127 |
128 DISALLOW_COPY_AND_ASSIGN(PluginLib); | 128 DISALLOW_COPY_AND_ASSIGN(PluginLib); |
129 }; | 129 }; |
130 | 130 |
131 } // namespace content | 131 } // namespace content |
132 | 132 |
133 #endif // CONTENT_CHILD_NPAPI_PLUGIN_LIB_H_ | 133 #endif // CONTENT_CHILD_NPAPI_PLUGIN_LIB_H_ |
OLD | NEW |