1 // Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved.
3 // Redistribution and use in source and binary forms, with or without
4 // modification, are permitted provided that the following conditions are
7 // * Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer.
9 // * Redistributions in binary form must reproduce the above
10 // copyright notice, this list of conditions and the following disclaimer
11 // in the documentation and/or other materials provided with the
13 // * Neither the name of Google Inc. nor the name Chromium Embedded
14 // Framework nor the names of its contributors may be used to endorse
15 // or promote products derived from this software without specific prior
16 // written permission.
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 // ---------------------------------------------------------------------------
32 // The contents of this file must follow a specific format in order to
33 // support the CEF translator tool. See the translator.README.txt file in the
34 // tools directory for more information.
37 #ifndef CEF_INCLUDE_CEF_WEB_PLUGIN_H_
38 #define CEF_INCLUDE_CEF_WEB_PLUGIN_H_
40 #include "include/cef_base.h"
41 #include "include/cef_browser.h"
44 // Information about a specific web plugin.
46 /*--cef(source=library)--*/
47 class CefWebPluginInfo : public virtual CefBase {
50 // Returns the plugin name (i.e. Flash).
53 virtual CefString GetName() =0;
56 // Returns the plugin file path (DLL/bundle/library).
59 virtual CefString GetPath() =0;
62 // Returns the version of the plugin (may be OS-specific).
65 virtual CefString GetVersion() =0;
68 // Returns a description of the plugin from the version information.
71 virtual CefString GetDescription() =0;
75 // Interface to implement for visiting web plugin information. The methods of
76 // this class will be called on the browser process UI thread.
78 /*--cef(source=client)--*/
79 class CefWebPluginInfoVisitor : public virtual CefBase {
82 // Method that will be called once for each plugin. |count| is the 0-based
83 // index for the current plugin. |total| is the total number of plugins.
84 // Return false to stop visiting plugins. This method may never be called if
85 // no plugins are found.
88 virtual bool Visit(CefRefPtr<CefWebPluginInfo> info, int count, int total) =0;
92 // Visit web plugin information. Can be called on any thread in the browser
96 void CefVisitWebPluginInfo(CefRefPtr<CefWebPluginInfoVisitor> visitor);
99 // Cause the plugin list to refresh the next time it is accessed regardless
100 // of whether it has already been loaded. Can be called on any thread in the
104 void CefRefreshWebPlugins();
107 // Add a plugin path (directory + file). This change may not take affect until
108 // after CefRefreshWebPlugins() is called. Can be called on any thread in the
112 void CefAddWebPluginPath(const CefString& path);
115 // Add a plugin directory. This change may not take affect until after
116 // CefRefreshWebPlugins() is called. Can be called on any thread in the browser
120 void CefAddWebPluginDirectory(const CefString& dir);
123 // Remove a plugin path (directory + file). This change may not take affect
124 // until after CefRefreshWebPlugins() is called. Can be called on any thread in
125 // the browser process.
128 void CefRemoveWebPluginPath(const CefString& path);
131 // Unregister an internal plugin. This may be undone the next time
132 // CefRefreshWebPlugins() is called. Can be called on any thread in the browser
136 void CefUnregisterInternalWebPlugin(const CefString& path);
139 // Force a plugin to shutdown. Can be called on any thread in the browser
140 // process but will be executed on the IO thread.
143 void CefForceWebPluginShutdown(const CefString& path);
146 // Register a plugin crash. Can be called on any thread in the browser process
147 // but will be executed on the IO thread.
150 void CefRegisterWebPluginCrash(const CefString& path);
153 // Interface to implement for receiving unstable plugin information. The methods
154 // of this class will be called on the browser process IO thread.
156 /*--cef(source=client)--*/
157 class CefWebPluginUnstableCallback : public virtual CefBase {
160 // Method that will be called for the requested plugin. |unstable| will be
161 // true if the plugin has reached the crash count threshold of 3 times in 120
165 virtual void IsUnstable(const CefString& path,
170 // Query if a plugin is unstable. Can be called on any thread in the browser
174 void CefIsWebPluginUnstable(const CefString& path,
175 CefRefPtr<CefWebPluginUnstableCallback> callback);
178 #endif // CEF_INCLUDE_CEF_WEB_PLUGIN_H_