• 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=1d8b3f540a8305ce1738c5fe7c716434062c67b0$
37 //
38 
39 #ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_HANDLER_CAPI_H_
40 #define CEF_INCLUDE_CAPI_CEF_REQUEST_HANDLER_CAPI_H_
41 #pragma once
42 
43 #include "include/capi/cef_auth_callback_capi.h"
44 #include "include/capi/cef_base_capi.h"
45 #include "include/capi/cef_browser_capi.h"
46 #include "include/capi/cef_frame_capi.h"
47 #include "include/capi/cef_request_callback_capi.h"
48 #include "include/capi/cef_request_capi.h"
49 #include "include/capi/cef_resource_request_handler_capi.h"
50 #include "include/capi/cef_ssl_info_capi.h"
51 #include "include/capi/cef_x509_certificate_capi.h"
52 
53 #ifdef __cplusplus
54 extern "C" {
55 #endif
56 
57 ///
58 // Callback structure used to select a client certificate for authentication.
59 ///
60 typedef struct _cef_select_client_certificate_callback_t {
61   ///
62   // Base structure.
63   ///
64   cef_base_ref_counted_t base;
65 
66   ///
67   // Chooses the specified certificate for client certificate authentication.
68   // NULL value means that no client certificate should be used.
69   ///
70   void(CEF_CALLBACK* select)(
71       struct _cef_select_client_certificate_callback_t* self,
72       struct _cef_x509certificate_t* cert);
73 } cef_select_client_certificate_callback_t;
74 
75 ///
76 // Implement this structure to handle events related to browser requests. The
77 // functions of this structure will be called on the thread indicated.
78 ///
79 typedef struct _cef_request_handler_t {
80   ///
81   // Base structure.
82   ///
83   cef_base_ref_counted_t base;
84 
85   ///
86   // Called on the UI thread before browser navigation. Return true (1) to
87   // cancel the navigation or false (0) to allow the navigation to proceed. The
88   // |request| object cannot be modified in this callback.
89   // cef_load_handler_t::OnLoadingStateChange will be called twice in all cases.
90   // If the navigation is allowed cef_load_handler_t::OnLoadStart and
91   // cef_load_handler_t::OnLoadEnd will be called. If the navigation is canceled
92   // cef_load_handler_t::OnLoadError will be called with an |errorCode| value of
93   // ERR_ABORTED. The |user_gesture| value will be true (1) if the browser
94   // navigated via explicit user gesture (e.g. clicking a link) or false (0) if
95   // it navigated automatically (e.g. via the DomContentLoaded event).
96   ///
97   int(CEF_CALLBACK* on_before_browse)(struct _cef_request_handler_t* self,
98                                       struct _cef_browser_t* browser,
99                                       struct _cef_frame_t* frame,
100                                       struct _cef_request_t* request,
101                                       int user_gesture,
102                                       int is_redirect);
103 
104   ///
105   // Called on the UI thread before OnBeforeBrowse in certain limited cases
106   // where navigating a new or different browser might be desirable. This
107   // includes user-initiated navigation that might open in a special way (e.g.
108   // links clicked via middle-click or ctrl + left-click) and certain types of
109   // cross-origin navigation initiated from the renderer process (e.g.
110   // navigating the top-level frame to/from a file URL). The |browser| and
111   // |frame| values represent the source of the navigation. The
112   // |target_disposition| value indicates where the user intended to navigate
113   // the browser based on standard Chromium behaviors (e.g. current tab, new
114   // tab, etc). The |user_gesture| value will be true (1) if the browser
115   // navigated via explicit user gesture (e.g. clicking a link) or false (0) if
116   // it navigated automatically (e.g. via the DomContentLoaded event). Return
117   // true (1) to cancel the navigation or false (0) to allow the navigation to
118   // proceed in the source browser's top-level frame.
119   ///
120   int(CEF_CALLBACK* on_open_urlfrom_tab)(
121       struct _cef_request_handler_t* self,
122       struct _cef_browser_t* browser,
123       struct _cef_frame_t* frame,
124       const cef_string_t* target_url,
125       cef_window_open_disposition_t target_disposition,
126       int user_gesture);
127 
128   ///
129   // Called on the browser process IO thread before a resource request is
130   // initiated. The |browser| and |frame| values represent the source of the
131   // request. |request| represents the request contents and cannot be modified
132   // in this callback. |is_navigation| will be true (1) if the resource request
133   // is a navigation. |is_download| will be true (1) if the resource request is
134   // a download. |request_initiator| is the origin (scheme + domain) of the page
135   // that initiated the request. Set |disable_default_handling| to true (1) to
136   // disable default handling of the request, in which case it will need to be
137   // handled via cef_resource_request_handler_t::GetResourceHandler or it will
138   // be canceled. To allow the resource load to proceed with default handling
139   // return NULL. To specify a handler for the resource return a
140   // cef_resource_request_handler_t object. If this callback returns NULL the
141   // same function will be called on the associated
142   // cef_request_context_handler_t, if any.
143   ///
144   struct _cef_resource_request_handler_t*(
145       CEF_CALLBACK* get_resource_request_handler)(
146       struct _cef_request_handler_t* self,
147       struct _cef_browser_t* browser,
148       struct _cef_frame_t* frame,
149       struct _cef_request_t* request,
150       int is_navigation,
151       int is_download,
152       const cef_string_t* request_initiator,
153       int* disable_default_handling);
154 
155   ///
156   // Called on the IO thread when the browser needs credentials from the user.
157   // |origin_url| is the origin making this authentication request. |isProxy|
158   // indicates whether the host is a proxy server. |host| contains the hostname
159   // and |port| contains the port number. |realm| is the realm of the challenge
160   // and may be NULL. |scheme| is the authentication scheme used, such as
161   // "basic" or "digest", and will be NULL if the source of the request is an
162   // FTP server. Return true (1) to continue the request and call
163   // cef_auth_callback_t::cont() either in this function or at a later time when
164   // the authentication information is available. Return false (0) to cancel the
165   // request immediately.
166   ///
167   int(CEF_CALLBACK* get_auth_credentials)(
168       struct _cef_request_handler_t* self,
169       struct _cef_browser_t* browser,
170       const cef_string_t* origin_url,
171       int isProxy,
172       const cef_string_t* host,
173       int port,
174       const cef_string_t* realm,
175       const cef_string_t* scheme,
176       struct _cef_auth_callback_t* callback);
177 
178   ///
179   // Called on the IO thread when JavaScript requests a specific storage quota
180   // size via the webkitStorageInfo.requestQuota function. |origin_url| is the
181   // origin of the page making the request. |new_size| is the requested quota
182   // size in bytes. Return true (1) to continue the request and call
183   // cef_request_callback_t::cont() either in this function or at a later time
184   // to grant or deny the request. Return false (0) to cancel the request
185   // immediately.
186   ///
187   int(CEF_CALLBACK* on_quota_request)(struct _cef_request_handler_t* self,
188                                       struct _cef_browser_t* browser,
189                                       const cef_string_t* origin_url,
190                                       int64 new_size,
191                                       struct _cef_request_callback_t* callback);
192 
193   ///
194   // Called on the UI thread to handle requests for URLs with an invalid SSL
195   // certificate. Return true (1) and call cef_request_callback_t::cont() either
196   // in this function or at a later time to continue or cancel the request.
197   // Return false (0) to cancel the request immediately. If
198   // CefSettings.ignore_certificate_errors is set all invalid certificates will
199   // be accepted without calling this function.
200   ///
201   int(CEF_CALLBACK* on_certificate_error)(
202       struct _cef_request_handler_t* self,
203       struct _cef_browser_t* browser,
204       cef_errorcode_t cert_error,
205       const cef_string_t* request_url,
206       struct _cef_sslinfo_t* ssl_info,
207       struct _cef_request_callback_t* callback);
208 
209   ///
210   // Called on the UI thread when a client certificate is being requested for
211   // authentication. Return false (0) to use the default behavior and
212   // automatically select the first certificate available. Return true (1) and
213   // call cef_select_client_certificate_callback_t::Select either in this
214   // function or at a later time to select a certificate. Do not call Select or
215   // call it with NULL to continue without using any certificate. |isProxy|
216   // indicates whether the host is an HTTPS proxy or the origin server. |host|
217   // and |port| contains the hostname and port of the SSL server. |certificates|
218   // is the list of certificates to choose from; this list has already been
219   // pruned by Chromium so that it only contains certificates from issuers that
220   // the server trusts.
221   ///
222   int(CEF_CALLBACK* on_select_client_certificate)(
223       struct _cef_request_handler_t* self,
224       struct _cef_browser_t* browser,
225       int isProxy,
226       const cef_string_t* host,
227       int port,
228       size_t certificatesCount,
229       struct _cef_x509certificate_t* const* certificates,
230       struct _cef_select_client_certificate_callback_t* callback);
231 
232   ///
233   // Called on the browser process UI thread when a plugin has crashed.
234   // |plugin_path| is the path of the plugin that crashed.
235   ///
236   void(CEF_CALLBACK* on_plugin_crashed)(struct _cef_request_handler_t* self,
237                                         struct _cef_browser_t* browser,
238                                         const cef_string_t* plugin_path);
239 
240   ///
241   // Called on the browser process UI thread when the render view associated
242   // with |browser| is ready to receive/handle IPC messages in the render
243   // process.
244   ///
245   void(CEF_CALLBACK* on_render_view_ready)(struct _cef_request_handler_t* self,
246                                            struct _cef_browser_t* browser);
247 
248   ///
249   // Called on the browser process UI thread when the render process terminates
250   // unexpectedly. |status| indicates how the process terminated.
251   ///
252   void(CEF_CALLBACK* on_render_process_terminated)(
253       struct _cef_request_handler_t* self,
254       struct _cef_browser_t* browser,
255       cef_termination_status_t status);
256 
257   ///
258   // Called on the browser process UI thread when the window.document object of
259   // the main frame has been created.
260   ///
261   void(CEF_CALLBACK* on_document_available_in_main_frame)(
262       struct _cef_request_handler_t* self,
263       struct _cef_browser_t* browser);
264 } cef_request_handler_t;
265 
266 #ifdef __cplusplus
267 }
268 #endif
269 
270 #endif  // CEF_INCLUDE_CAPI_CEF_REQUEST_HANDLER_CAPI_H_
271