• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2021 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 // This file was generated by the CEF translator tool and should not edited
33 // by hand. See the translator.README.txt file in the tools directory for
34 // more information.
35 //
36 // $hash=f74bf4d33914d56d760f1bf5aadcf2651740c711$
37 //
38 
39 #ifndef CEF_INCLUDE_CAPI_CEF_WEB_PLUGIN_CAPI_H_
40 #define CEF_INCLUDE_CAPI_CEF_WEB_PLUGIN_CAPI_H_
41 #pragma once
42 
43 #include "include/capi/cef_base_capi.h"
44 
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48 
49 struct _cef_browser_t;
50 
51 ///
52 // Information about a specific web plugin.
53 ///
54 typedef struct _cef_web_plugin_info_t {
55   ///
56   // Base structure.
57   ///
58   cef_base_ref_counted_t base;
59 
60   ///
61   // Returns the plugin name.
62   ///
63   // The resulting string must be freed by calling cef_string_userfree_free().
64   cef_string_userfree_t(CEF_CALLBACK* get_name)(
65       struct _cef_web_plugin_info_t* self);
66 
67   ///
68   // Returns the plugin file path (DLL/bundle/library).
69   ///
70   // The resulting string must be freed by calling cef_string_userfree_free().
71   cef_string_userfree_t(CEF_CALLBACK* get_path)(
72       struct _cef_web_plugin_info_t* self);
73 
74   ///
75   // Returns the version of the plugin (may be OS-specific).
76   ///
77   // The resulting string must be freed by calling cef_string_userfree_free().
78   cef_string_userfree_t(CEF_CALLBACK* get_version)(
79       struct _cef_web_plugin_info_t* self);
80 
81   ///
82   // Returns a description of the plugin from the version information.
83   ///
84   // The resulting string must be freed by calling cef_string_userfree_free().
85   cef_string_userfree_t(CEF_CALLBACK* get_description)(
86       struct _cef_web_plugin_info_t* self);
87 } cef_web_plugin_info_t;
88 
89 ///
90 // Structure to implement for visiting web plugin information. The functions of
91 // this structure will be called on the browser process UI thread.
92 ///
93 typedef struct _cef_web_plugin_info_visitor_t {
94   ///
95   // Base structure.
96   ///
97   cef_base_ref_counted_t base;
98 
99   ///
100   // Method that will be called once for each plugin. |count| is the 0-based
101   // index for the current plugin. |total| is the total number of plugins.
102   // Return false (0) to stop visiting plugins. This function may never be
103   // called if no plugins are found.
104   ///
105   int(CEF_CALLBACK* visit)(struct _cef_web_plugin_info_visitor_t* self,
106                            struct _cef_web_plugin_info_t* info,
107                            int count,
108                            int total);
109 } cef_web_plugin_info_visitor_t;
110 
111 ///
112 // Structure to implement for receiving unstable plugin information. The
113 // functions of this structure will be called on the browser process IO thread.
114 ///
115 typedef struct _cef_web_plugin_unstable_callback_t {
116   ///
117   // Base structure.
118   ///
119   cef_base_ref_counted_t base;
120 
121   ///
122   // Method that will be called for the requested plugin. |unstable| will be
123   // true (1) if the plugin has reached the crash count threshold of 3 times in
124   // 120 seconds.
125   ///
126   void(CEF_CALLBACK* is_unstable)(
127       struct _cef_web_plugin_unstable_callback_t* self,
128       const cef_string_t* path,
129       int unstable);
130 } cef_web_plugin_unstable_callback_t;
131 
132 ///
133 // Implement this structure to receive notification when CDM registration is
134 // complete. The functions of this structure will be called on the browser
135 // process UI thread.
136 ///
137 typedef struct _cef_register_cdm_callback_t {
138   ///
139   // Base structure.
140   ///
141   cef_base_ref_counted_t base;
142 
143   ///
144   // Method that will be called when CDM registration is complete. |result| will
145   // be CEF_CDM_REGISTRATION_ERROR_NONE if registration completed successfully.
146   // Otherwise, |result| and |error_message| will contain additional information
147   // about why registration failed.
148   ///
149   void(CEF_CALLBACK* on_cdm_registration_complete)(
150       struct _cef_register_cdm_callback_t* self,
151       cef_cdm_registration_error_t result,
152       const cef_string_t* error_message);
153 } cef_register_cdm_callback_t;
154 
155 ///
156 // Visit web plugin information. Can be called on any thread in the browser
157 // process.
158 ///
159 CEF_EXPORT void cef_visit_web_plugin_info(
160     cef_web_plugin_info_visitor_t* visitor);
161 
162 ///
163 // Cause the plugin list to refresh the next time it is accessed regardless of
164 // whether it has already been loaded. Can be called on any thread in the
165 // browser process.
166 ///
167 CEF_EXPORT void cef_refresh_web_plugins();
168 
169 ///
170 // Unregister an internal plugin. This may be undone the next time
171 // cef_refresh_web_plugins() is called. Can be called on any thread in the
172 // browser process.
173 ///
174 CEF_EXPORT void cef_unregister_internal_web_plugin(const cef_string_t* path);
175 
176 ///
177 // Register a plugin crash. Can be called on any thread in the browser process
178 // but will be executed on the IO thread.
179 ///
180 CEF_EXPORT void cef_register_web_plugin_crash(const cef_string_t* path);
181 
182 ///
183 // Query if a plugin is unstable. Can be called on any thread in the browser
184 // process.
185 ///
186 CEF_EXPORT void cef_is_web_plugin_unstable(
187     const cef_string_t* path,
188     cef_web_plugin_unstable_callback_t* callback);
189 
190 ///
191 // Register the Widevine CDM plugin.
192 //
193 // The client application is responsible for downloading an appropriate
194 // platform-specific CDM binary distribution from Google, extracting the
195 // contents, and building the required directory structure on the local machine.
196 // The cef_browser_host_t::StartDownload function and CefZipArchive structure
197 // can be used to implement this functionality in CEF. Contact Google via
198 // https://www.widevine.com/contact.html for details on CDM download.
199 //
200 // |path| is a directory that must contain the following files:
201 //   1. manifest.json file from the CDM binary distribution (see below).
202 //   2. widevinecdm file from the CDM binary distribution (e.g.
203 //      widevinecdm.dll on on Windows, libwidevinecdm.dylib on OS X,
204 //      libwidevinecdm.so on Linux).
205 //
206 // If any of these files are missing or if the manifest file has incorrect
207 // contents the registration will fail and |callback| will receive a |result|
208 // value of CEF_CDM_REGISTRATION_ERROR_INCORRECT_CONTENTS.
209 //
210 // The manifest.json file must contain the following keys:
211 //   A. "os": Supported OS (e.g. "mac", "win" or "linux").
212 //   B. "arch": Supported architecture (e.g. "ia32" or "x64").
213 //   C. "x-cdm-module-versions": Module API version (e.g. "4").
214 //   D. "x-cdm-interface-versions": Interface API version (e.g. "8").
215 //   E. "x-cdm-host-versions": Host API version (e.g. "8").
216 //   F. "version": CDM version (e.g. "1.4.8.903").
217 //   G. "x-cdm-codecs": List of supported codecs (e.g. "vp8,vp09,avc1").
218 //
219 // A through E are used to verify compatibility with the current Chromium
220 // version. If the CDM is not compatible the registration will fail and
221 // |callback| will receive a |result| value of
222 // CEF_CDM_REGISTRATION_ERROR_INCOMPATIBLE.
223 //
224 // |callback| will be executed asynchronously once registration is complete.
225 //
226 // On Linux this function must be called before cef_initialize() and the
227 // registration cannot be changed during runtime. If registration is not
228 // supported at the time that cef_register_widevine_cdm() is called then
229 // |callback| will receive a |result| value of
230 // CEF_CDM_REGISTRATION_ERROR_NOT_SUPPORTED.
231 ///
232 CEF_EXPORT void cef_register_widevine_cdm(
233     const cef_string_t* path,
234     cef_register_cdm_callback_t* callback);
235 
236 #ifdef __cplusplus
237 }
238 #endif
239 
240 #endif  // CEF_INCLUDE_CAPI_CEF_WEB_PLUGIN_CAPI_H_
241