1 // Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. 2 // 3 // Redistribution and use in source and binary forms, with or without 4 // modification, are permitted provided that the following conditions are 5 // met: 6 // 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 12 // distribution. 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. 17 // 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. 29 // 30 // --------------------------------------------------------------------------- 31 // 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. 35 // 36 37 #ifndef CEF_INCLUDE_CEF_WEB_PLUGIN_H_ 38 #define CEF_INCLUDE_CEF_WEB_PLUGIN_H_ 39 40 #include "include/cef_base.h" 41 42 class CefBrowser; 43 44 /// 45 // Information about a specific web plugin. 46 /// 47 /*--cef(source=library)--*/ 48 class CefWebPluginInfo : public virtual CefBaseRefCounted { 49 public: 50 /// 51 // Returns the plugin name. 52 /// 53 /*--cef()--*/ 54 virtual CefString GetName() = 0; 55 56 /// 57 // Returns the plugin file path (DLL/bundle/library). 58 /// 59 /*--cef()--*/ 60 virtual CefString GetPath() = 0; 61 62 /// 63 // Returns the version of the plugin (may be OS-specific). 64 /// 65 /*--cef()--*/ 66 virtual CefString GetVersion() = 0; 67 68 /// 69 // Returns a description of the plugin from the version information. 70 /// 71 /*--cef()--*/ 72 virtual CefString GetDescription() = 0; 73 }; 74 75 /// 76 // Interface to implement for visiting web plugin information. The methods of 77 // this class will be called on the browser process UI thread. 78 /// 79 /*--cef(source=client)--*/ 80 class CefWebPluginInfoVisitor : public virtual CefBaseRefCounted { 81 public: 82 /// 83 // Method that will be called once for each plugin. |count| is the 0-based 84 // index for the current plugin. |total| is the total number of plugins. 85 // Return false to stop visiting plugins. This method may never be called if 86 // no plugins are found. 87 /// 88 /*--cef()--*/ 89 virtual bool Visit(CefRefPtr<CefWebPluginInfo> info, 90 int count, 91 int total) = 0; 92 }; 93 94 /// 95 // Visit web plugin information. Can be called on any thread in the browser 96 // process. 97 /// 98 /*--cef()--*/ 99 void CefVisitWebPluginInfo(CefRefPtr<CefWebPluginInfoVisitor> visitor); 100 101 /// 102 // Cause the plugin list to refresh the next time it is accessed regardless 103 // of whether it has already been loaded. Can be called on any thread in the 104 // browser process. 105 /// 106 /*--cef()--*/ 107 void CefRefreshWebPlugins(); 108 109 /// 110 // Unregister an internal plugin. This may be undone the next time 111 // CefRefreshWebPlugins() is called. Can be called on any thread in the browser 112 // process. 113 /// 114 /*--cef()--*/ 115 void CefUnregisterInternalWebPlugin(const CefString& path); 116 117 /// 118 // Register a plugin crash. Can be called on any thread in the browser process 119 // but will be executed on the IO thread. 120 /// 121 /*--cef()--*/ 122 void CefRegisterWebPluginCrash(const CefString& path); 123 124 /// 125 // Interface to implement for receiving unstable plugin information. The methods 126 // of this class will be called on the browser process IO thread. 127 /// 128 /*--cef(source=client)--*/ 129 class CefWebPluginUnstableCallback : public virtual CefBaseRefCounted { 130 public: 131 /// 132 // Method that will be called for the requested plugin. |unstable| will be 133 // true if the plugin has reached the crash count threshold of 3 times in 120 134 // seconds. 135 /// 136 /*--cef()--*/ 137 virtual void IsUnstable(const CefString& path, bool unstable) = 0; 138 }; 139 140 /// 141 // Query if a plugin is unstable. Can be called on any thread in the browser 142 // process. 143 /// 144 /*--cef()--*/ 145 void CefIsWebPluginUnstable(const CefString& path, 146 CefRefPtr<CefWebPluginUnstableCallback> callback); 147 148 #endif // CEF_INCLUDE_CEF_WEB_PLUGIN_H_ 149