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=df8c46dd19ef6a3964c49d79e770de6e4245e208$ 37 // 38 39 #ifndef CEF_INCLUDE_CAPI_CEF_SCHEME_CAPI_H_ 40 #define CEF_INCLUDE_CAPI_CEF_SCHEME_CAPI_H_ 41 #pragma once 42 43 #include "include/capi/cef_base_capi.h" 44 #include "include/capi/cef_browser_capi.h" 45 #include "include/capi/cef_frame_capi.h" 46 #include "include/capi/cef_request_capi.h" 47 #include "include/capi/cef_resource_handler_capi.h" 48 #include "include/capi/cef_response_capi.h" 49 50 #ifdef __cplusplus 51 extern "C" { 52 #endif 53 54 struct _cef_scheme_handler_factory_t; 55 56 /// 57 // Structure that manages custom scheme registrations. 58 /// 59 typedef struct _cef_scheme_registrar_t { 60 /// 61 // Base structure. 62 /// 63 cef_base_scoped_t base; 64 65 /// 66 // Register a custom scheme. This function should not be called for the built- 67 // in HTTP, HTTPS, FILE, FTP, ABOUT and DATA schemes. 68 // 69 // See cef_scheme_options_t for possible values for |options|. 70 // 71 // This function may be called on any thread. It should only be called once 72 // per unique |scheme_name| value. If |scheme_name| is already registered or 73 // if an error occurs this function will return false (0). 74 /// 75 int(CEF_CALLBACK* add_custom_scheme)(struct _cef_scheme_registrar_t* self, 76 const cef_string_t* scheme_name, 77 int options); 78 } cef_scheme_registrar_t; 79 80 /// 81 // Structure that creates cef_resource_handler_t instances for handling scheme 82 // requests. The functions of this structure will always be called on the IO 83 // thread. 84 /// 85 typedef struct _cef_scheme_handler_factory_t { 86 /// 87 // Base structure. 88 /// 89 cef_base_ref_counted_t base; 90 91 /// 92 // Return a new resource handler instance to handle the request or an NULL 93 // reference to allow default handling of the request. |browser| and |frame| 94 // will be the browser window and frame respectively that originated the 95 // request or NULL if the request did not originate from a browser window (for 96 // example, if the request came from cef_urlrequest_t). The |request| object 97 // passed to this function cannot be modified. 98 /// 99 struct _cef_resource_handler_t*(CEF_CALLBACK* create)( 100 struct _cef_scheme_handler_factory_t* self, 101 struct _cef_browser_t* browser, 102 struct _cef_frame_t* frame, 103 const cef_string_t* scheme_name, 104 struct _cef_request_t* request); 105 } cef_scheme_handler_factory_t; 106 107 /// 108 // Register a scheme handler factory with the global request context. An NULL 109 // |domain_name| value for a standard scheme will cause the factory to match all 110 // domain names. The |domain_name| value will be ignored for non-standard 111 // schemes. If |scheme_name| is a built-in scheme and no handler is returned by 112 // |factory| then the built-in scheme handler factory will be called. If 113 // |scheme_name| is a custom scheme then you must also implement the 114 // cef_app_t::on_register_custom_schemes() function in all processes. This 115 // function may be called multiple times to change or remove the factory that 116 // matches the specified |scheme_name| and optional |domain_name|. Returns false 117 // (0) if an error occurs. This function may be called on any thread in the 118 // browser process. Using this function is equivalent to calling cef_request_con 119 // text_t::cef_request_context_get_global_context()->register_scheme_handler_fac 120 // tory(). 121 /// 122 CEF_EXPORT int cef_register_scheme_handler_factory( 123 const cef_string_t* scheme_name, 124 const cef_string_t* domain_name, 125 cef_scheme_handler_factory_t* factory); 126 127 /// 128 // Clear all scheme handler factories registered with the global request 129 // context. Returns false (0) on error. This function may be called on any 130 // thread in the browser process. Using this function is equivalent to calling c 131 // ef_request_context_t::cef_request_context_get_global_context()->clear_scheme_ 132 // handler_factories(). 133 /// 134 CEF_EXPORT int cef_clear_scheme_handler_factories(); 135 136 #ifdef __cplusplus 137 } 138 #endif 139 140 #endif // CEF_INCLUDE_CAPI_CEF_SCHEME_CAPI_H_ 141