1 // Copyright (c) 2022 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=4a05a0a7cd4a279ccf8455a3cb2f77de581b597a$ 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_callback_capi.h" 47 #include "include/capi/cef_frame_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_callback_t functions either in this function or at a later time to 184 // 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_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_callback_t functions either in 196 // this function or at a later time to continue or cancel the request. Return 197 // 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)(struct _cef_request_handler_t* self, 202 struct _cef_browser_t* browser, 203 cef_errorcode_t cert_error, 204 const cef_string_t* request_url, 205 struct _cef_sslinfo_t* ssl_info, 206 struct _cef_callback_t* callback); 207 208 /// 209 // Called on the UI thread when a client certificate is being requested for 210 // authentication. Return false (0) to use the default behavior and 211 // automatically select the first certificate available. Return true (1) and 212 // call cef_select_client_certificate_callback_t::Select either in this 213 // function or at a later time to select a certificate. Do not call Select or 214 // call it with NULL to continue without using any certificate. |isProxy| 215 // indicates whether the host is an HTTPS proxy or the origin server. |host| 216 // and |port| contains the hostname and port of the SSL server. |certificates| 217 // is the list of certificates to choose from; this list has already been 218 // pruned by Chromium so that it only contains certificates from issuers that 219 // the server trusts. 220 /// 221 int(CEF_CALLBACK* on_select_client_certificate)( 222 struct _cef_request_handler_t* self, 223 struct _cef_browser_t* browser, 224 int isProxy, 225 const cef_string_t* host, 226 int port, 227 size_t certificatesCount, 228 struct _cef_x509certificate_t* const* certificates, 229 struct _cef_select_client_certificate_callback_t* callback); 230 231 /// 232 // Called on the browser process UI thread when a plugin has crashed. 233 // |plugin_path| is the path of the plugin that crashed. 234 /// 235 void(CEF_CALLBACK* on_plugin_crashed)(struct _cef_request_handler_t* self, 236 struct _cef_browser_t* browser, 237 const cef_string_t* plugin_path); 238 239 /// 240 // Called on the browser process UI thread when the render view associated 241 // with |browser| is ready to receive/handle IPC messages in the render 242 // process. 243 /// 244 void(CEF_CALLBACK* on_render_view_ready)(struct _cef_request_handler_t* self, 245 struct _cef_browser_t* browser); 246 247 /// 248 // Called on the browser process UI thread when the render process terminates 249 // unexpectedly. |status| indicates how the process terminated. 250 /// 251 void(CEF_CALLBACK* on_render_process_terminated)( 252 struct _cef_request_handler_t* self, 253 struct _cef_browser_t* browser, 254 cef_termination_status_t status); 255 256 /// 257 // Called on the browser process UI thread when the window.document object of 258 // the main frame has been created. 259 /// 260 void(CEF_CALLBACK* on_document_available_in_main_frame)( 261 struct _cef_request_handler_t* self, 262 struct _cef_browser_t* browser); 263 } cef_request_handler_t; 264 265 #ifdef __cplusplus 266 } 267 #endif 268 269 #endif // CEF_INCLUDE_CAPI_CEF_REQUEST_HANDLER_CAPI_H_ 270