]> git.sesse.net Git - casparcg/blob - dependencies64/cef/include/capi/cef_request_handler_capi.h
* Merged html producer and updated to latest CEF version (does not have satisfactory...
[casparcg] / dependencies64 / cef / include / capi / cef_request_handler_capi.h
1 // Copyright (c) 2015 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
37 #ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_HANDLER_CAPI_H_
38 #define CEF_INCLUDE_CAPI_CEF_REQUEST_HANDLER_CAPI_H_
39 #pragma once
40
41 #include "include/capi/cef_auth_callback_capi.h"
42 #include "include/capi/cef_base_capi.h"
43 #include "include/capi/cef_browser_capi.h"
44 #include "include/capi/cef_frame_capi.h"
45 #include "include/capi/cef_request_capi.h"
46 #include "include/capi/cef_resource_handler_capi.h"
47 #include "include/capi/cef_response_capi.h"
48 #include "include/capi/cef_ssl_info_capi.h"
49 #include "include/capi/cef_web_plugin_capi.h"
50
51 #ifdef __cplusplus
52 extern "C" {
53 #endif
54
55
56 ///
57 // Callback structure used for asynchronous continuation of url requests.
58 ///
59 typedef struct _cef_request_callback_t {
60   ///
61   // Base structure.
62   ///
63   cef_base_t base;
64
65   ///
66   // Continue the url request. If |allow| is true (1) the request will be
67   // continued. Otherwise, the request will be canceled.
68   ///
69   void (CEF_CALLBACK *cont)(struct _cef_request_callback_t* self, int allow);
70
71   ///
72   // Cancel the url request.
73   ///
74   void (CEF_CALLBACK *cancel)(struct _cef_request_callback_t* self);
75 } cef_request_callback_t;
76
77
78 ///
79 // Implement this structure to handle events related to browser requests. The
80 // functions of this structure will be called on the thread indicated.
81 ///
82 typedef struct _cef_request_handler_t {
83   ///
84   // Base structure.
85   ///
86   cef_base_t base;
87
88   ///
89   // Called on the UI thread before browser navigation. Return true (1) to
90   // cancel the navigation or false (0) to allow the navigation to proceed. The
91   // |request| object cannot be modified in this callback.
92   // cef_load_handler_t::OnLoadingStateChange will be called twice in all cases.
93   // If the navigation is allowed cef_load_handler_t::OnLoadStart and
94   // cef_load_handler_t::OnLoadEnd will be called. If the navigation is canceled
95   // cef_load_handler_t::OnLoadError will be called with an |errorCode| value of
96   // ERR_ABORTED.
97   ///
98   int (CEF_CALLBACK *on_before_browse)(struct _cef_request_handler_t* self,
99       struct _cef_browser_t* browser, struct _cef_frame_t* frame,
100       struct _cef_request_t* request, int is_redirect);
101
102   ///
103   // Called on the UI thread before OnBeforeBrowse in certain limited cases
104   // where navigating a new or different browser might be desirable. This
105   // includes user-initiated navigation that might open in a special way (e.g.
106   // links clicked via middle-click or ctrl + left-click) and certain types of
107   // cross-origin navigation initiated from the renderer process (e.g.
108   // navigating the top-level frame to/from a file URL). The |browser| and
109   // |frame| values represent the source of the navigation. The
110   // |target_disposition| value indicates where the user intended to navigate
111   // the browser based on standard Chromium behaviors (e.g. current tab, new
112   // tab, etc). The |user_gesture| value will be true (1) if the browser
113   // navigated via explicit user gesture (e.g. clicking a link) or false (0) if
114   // it navigated automatically (e.g. via the DomContentLoaded event). Return
115   // true (1) to cancel the navigation or false (0) to allow the navigation to
116   // proceed in the source browser's top-level frame.
117   ///
118   int (CEF_CALLBACK *on_open_urlfrom_tab)(struct _cef_request_handler_t* self,
119       struct _cef_browser_t* browser, struct _cef_frame_t* frame,
120       const cef_string_t* target_url,
121       cef_window_open_disposition_t target_disposition, int user_gesture);
122
123   ///
124   // Called on the IO thread before a resource request is loaded. The |request|
125   // object may be modified. Return RV_CONTINUE to continue the request
126   // immediately. Return RV_CONTINUE_ASYNC and call cef_request_tCallback::
127   // cont() at a later time to continue or cancel the request asynchronously.
128   // Return RV_CANCEL to cancel the request immediately.
129   //
130   ///
131   cef_return_value_t (CEF_CALLBACK *on_before_resource_load)(
132       struct _cef_request_handler_t* self, struct _cef_browser_t* browser,
133       struct _cef_frame_t* frame, struct _cef_request_t* request,
134       struct _cef_request_callback_t* callback);
135
136   ///
137   // Called on the IO thread before a resource is loaded. To allow the resource
138   // to load normally return NULL. To specify a handler for the resource return
139   // a cef_resource_handler_t object. The |request| object should not be
140   // modified in this callback.
141   ///
142   struct _cef_resource_handler_t* (CEF_CALLBACK *get_resource_handler)(
143       struct _cef_request_handler_t* self, struct _cef_browser_t* browser,
144       struct _cef_frame_t* frame, struct _cef_request_t* request);
145
146   ///
147   // Called on the IO thread when a resource load is redirected. The |request|
148   // parameter will contain the old URL and other request-related information.
149   // The |new_url| parameter will contain the new URL and can be changed if
150   // desired. The |request| object cannot be modified in this callback.
151   ///
152   void (CEF_CALLBACK *on_resource_redirect)(struct _cef_request_handler_t* self,
153       struct _cef_browser_t* browser, struct _cef_frame_t* frame,
154       struct _cef_request_t* request, cef_string_t* new_url);
155
156   ///
157   // Called on the IO thread when a resource response is received. To allow the
158   // resource to load normally return false (0). To redirect or retry the
159   // resource modify |request| (url, headers or post body) and return true (1).
160   // The |response| object cannot be modified in this callback.
161   ///
162   int (CEF_CALLBACK *on_resource_response)(struct _cef_request_handler_t* self,
163       struct _cef_browser_t* browser, struct _cef_frame_t* frame,
164       struct _cef_request_t* request, struct _cef_response_t* response);
165
166   ///
167   // Called on the IO thread when the browser needs credentials from the user.
168   // |isProxy| indicates whether the host is a proxy server. |host| contains the
169   // hostname and |port| contains the port number. Return true (1) to continue
170   // the request and call cef_auth_callback_t::cont() either in this function or
171   // at a later time when the authentication information is available. Return
172   // false (0) to cancel the request immediately.
173   ///
174   int (CEF_CALLBACK *get_auth_credentials)(struct _cef_request_handler_t* self,
175       struct _cef_browser_t* browser, struct _cef_frame_t* frame, int isProxy,
176       const cef_string_t* host, int port, const cef_string_t* realm,
177       const cef_string_t* scheme, struct _cef_auth_callback_t* callback);
178
179   ///
180   // Called on the IO thread when JavaScript requests a specific storage quota
181   // size via the webkitStorageInfo.requestQuota function. |origin_url| is the
182   // origin of the page making the request. |new_size| is the requested quota
183   // size in bytes. Return true (1) to continue the request and call
184   // cef_request_tCallback::cont() either in this function or at a later time to
185   // grant or deny the request. Return false (0) to cancel the request
186   // immediately.
187   ///
188   int (CEF_CALLBACK *on_quota_request)(struct _cef_request_handler_t* self,
189       struct _cef_browser_t* browser, const cef_string_t* origin_url,
190       int64 new_size, struct _cef_request_callback_t* callback);
191
192   ///
193   // Called on the UI thread to handle requests for URLs with an unknown
194   // protocol component. Set |allow_os_execution| to true (1) to attempt
195   // execution via the registered OS protocol handler, if any. SECURITY WARNING:
196   // YOU SHOULD USE THIS METHOD TO ENFORCE RESTRICTIONS BASED ON SCHEME, HOST OR
197   // OTHER URL ANALYSIS BEFORE ALLOWING OS EXECUTION.
198   ///
199   void (CEF_CALLBACK *on_protocol_execution)(
200       struct _cef_request_handler_t* self, struct _cef_browser_t* browser,
201       const cef_string_t* url, int* allow_os_execution);
202
203   ///
204   // Called on the UI thread to handle requests for URLs with an invalid SSL
205   // certificate. Return true (1) and call cef_request_tCallback::cont() either
206   // in this function or at a later time to continue or cancel the request.
207   // Return false (0) to cancel the request immediately. If |callback| is NULL
208   // the error cannot be recovered from and the request will be canceled
209   // automatically. If CefSettings.ignore_certificate_errors is set all invalid
210   // certificates will be accepted without calling this function.
211   ///
212   int (CEF_CALLBACK *on_certificate_error)(struct _cef_request_handler_t* self,
213       struct _cef_browser_t* browser, cef_errorcode_t cert_error,
214       const cef_string_t* request_url, struct _cef_sslinfo_t* ssl_info,
215       struct _cef_request_callback_t* callback);
216
217   ///
218   // Called on the browser process IO thread before a plugin is loaded. Return
219   // true (1) to block loading of the plugin.
220   ///
221   int (CEF_CALLBACK *on_before_plugin_load)(struct _cef_request_handler_t* self,
222       struct _cef_browser_t* browser, const cef_string_t* url,
223       const cef_string_t* policy_url, struct _cef_web_plugin_info_t* info);
224
225   ///
226   // Called on the browser process UI thread when a plugin has crashed.
227   // |plugin_path| is the path of the plugin that crashed.
228   ///
229   void (CEF_CALLBACK *on_plugin_crashed)(struct _cef_request_handler_t* self,
230       struct _cef_browser_t* browser, const cef_string_t* plugin_path);
231
232   ///
233   // Called on the browser process UI thread when the render view associated
234   // with |browser| is ready to receive/handle IPC messages in the render
235   // process.
236   ///
237   void (CEF_CALLBACK *on_render_view_ready)(struct _cef_request_handler_t* self,
238       struct _cef_browser_t* browser);
239
240   ///
241   // Called on the browser process UI thread when the render process terminates
242   // unexpectedly. |status| indicates how the process terminated.
243   ///
244   void (CEF_CALLBACK *on_render_process_terminated)(
245       struct _cef_request_handler_t* self, struct _cef_browser_t* browser,
246       cef_termination_status_t status);
247 } cef_request_handler_t;
248
249
250 #ifdef __cplusplus
251 }
252 #endif
253
254 #endif  // CEF_INCLUDE_CAPI_CEF_REQUEST_HANDLER_CAPI_H_