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=fa148db8a0ecd79966814086fb92e439687be701$ 37 // 38 39 #ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_CONTEXT_HANDLER_CAPI_H_ 40 #define CEF_INCLUDE_CAPI_CEF_REQUEST_CONTEXT_HANDLER_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_request_handler_capi.h" 48 #include "include/capi/cef_web_plugin_capi.h" 49 50 #ifdef __cplusplus 51 extern "C" { 52 #endif 53 54 /// 55 // Implement this structure to provide handler implementations. The handler 56 // instance will not be released until all objects related to the context have 57 // been destroyed. 58 /// 59 typedef struct _cef_request_context_handler_t { 60 /// 61 // Base structure. 62 /// 63 cef_base_ref_counted_t base; 64 65 /// 66 // Called on the browser process UI thread immediately after the request 67 // context has been initialized. 68 /// 69 void(CEF_CALLBACK* on_request_context_initialized)( 70 struct _cef_request_context_handler_t* self, 71 struct _cef_request_context_t* request_context); 72 73 /// 74 // Called on multiple browser process threads before a plugin instance is 75 // loaded. |mime_type| is the mime type of the plugin that will be loaded. 76 // |plugin_url| is the content URL that the plugin will load and may be NULL. 77 // |is_main_frame| will be true (1) if the plugin is being loaded in the main 78 // (top-level) frame, |top_origin_url| is the URL for the top-level frame that 79 // contains the plugin when loading a specific plugin instance or NULL when 80 // building the initial list of enabled plugins for 'navigator.plugins' 81 // JavaScript state. |plugin_info| includes additional information about the 82 // plugin that will be loaded. |plugin_policy| is the recommended policy. 83 // Modify |plugin_policy| and return true (1) to change the policy. Return 84 // false (0) to use the recommended policy. The default plugin policy can be 85 // set at runtime using the `--plugin-policy=[allow|detect|block]` command- 86 // line flag. Decisions to mark a plugin as disabled by setting 87 // |plugin_policy| to PLUGIN_POLICY_DISABLED may be cached when 88 // |top_origin_url| is NULL. To purge the plugin list cache and potentially 89 // trigger new calls to this function call 90 // cef_request_context_t::PurgePluginListCache. 91 /// 92 int(CEF_CALLBACK* on_before_plugin_load)( 93 struct _cef_request_context_handler_t* self, 94 const cef_string_t* mime_type, 95 const cef_string_t* plugin_url, 96 int is_main_frame, 97 const cef_string_t* top_origin_url, 98 struct _cef_web_plugin_info_t* plugin_info, 99 cef_plugin_policy_t* plugin_policy); 100 101 /// 102 // Called on the browser process IO thread before a resource request is 103 // initiated. The |browser| and |frame| values represent the source of the 104 // request, and may be NULL for requests originating from service workers or 105 // cef_urlrequest_t. |request| represents the request contents and cannot be 106 // modified in this callback. |is_navigation| will be true (1) if the resource 107 // request is a navigation. |is_download| will be true (1) if the resource 108 // request is a download. |request_initiator| is the origin (scheme + domain) 109 // of the page that initiated the request. Set |disable_default_handling| to 110 // true (1) to disable default handling of the request, in which case it will 111 // need to be handled via cef_resource_request_handler_t::GetResourceHandler 112 // or it will be canceled. To allow the resource load to proceed with default 113 // handling return NULL. To specify a handler for the resource return a 114 // cef_resource_request_handler_t object. This function will not be called if 115 // the client associated with |browser| returns a non-NULL value from 116 // cef_request_handler_t::GetResourceRequestHandler for the same request 117 // (identified by cef_request_t::GetIdentifier). 118 /// 119 struct _cef_resource_request_handler_t*( 120 CEF_CALLBACK* get_resource_request_handler)( 121 struct _cef_request_context_handler_t* self, 122 struct _cef_browser_t* browser, 123 struct _cef_frame_t* frame, 124 struct _cef_request_t* request, 125 int is_navigation, 126 int is_download, 127 const cef_string_t* request_initiator, 128 int* disable_default_handling); 129 } cef_request_context_handler_t; 130 131 #ifdef __cplusplus 132 } 133 #endif 134 135 #endif // CEF_INCLUDE_CAPI_CEF_REQUEST_CONTEXT_HANDLER_CAPI_H_ 136