1 // Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
3 // Redistribution and use in source and binary forms, with or without
4 // modification, are permitted provided that the following conditions are
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
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.
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.
30 // ---------------------------------------------------------------------------
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
37 #ifndef CEF_INCLUDE_CAPI_CEF_RESOURCE_HANDLER_CAPI_H_
38 #define CEF_INCLUDE_CAPI_CEF_RESOURCE_HANDLER_CAPI_H_
41 #include "include/capi/cef_base_capi.h"
42 #include "include/capi/cef_browser_capi.h"
43 #include "include/capi/cef_callback_capi.h"
44 #include "include/capi/cef_cookie_capi.h"
45 #include "include/capi/cef_request_capi.h"
46 #include "include/capi/cef_response_capi.h"
54 // Structure used to implement a custom request handler structure. The functions
55 // of this structure will always be called on the IO thread.
57 typedef struct _cef_resource_handler_t {
64 // Begin processing the request. To handle the request return true (1) and
65 // call cef_callback_t::cont() once the response header information is
66 // available (cef_callback_t::cont() can also be called from inside this
67 // function if header information is available immediately). To cancel the
68 // request return false (0).
70 int (CEF_CALLBACK *process_request)(struct _cef_resource_handler_t* self,
71 struct _cef_request_t* request, struct _cef_callback_t* callback);
74 // Retrieve response header information. If the response length is not known
75 // set |response_length| to -1 and read_response() will be called until it
76 // returns false (0). If the response length is known set |response_length| to
77 // a positive value and read_response() will be called until it returns false
78 // (0) or the specified number of bytes have been read. Use the |response|
79 // object to set the mime type, http status code and other optional header
80 // values. To redirect the request to a new URL set |redirectUrl| to the new
83 void (CEF_CALLBACK *get_response_headers)(
84 struct _cef_resource_handler_t* self, struct _cef_response_t* response,
85 int64* response_length, cef_string_t* redirectUrl);
88 // Read response data. If data is available immediately copy up to
89 // |bytes_to_read| bytes into |data_out|, set |bytes_read| to the number of
90 // bytes copied, and return true (1). To read the data at a later time set
91 // |bytes_read| to 0, return true (1) and call cef_callback_t::cont() when the
92 // data is available. To indicate response completion return false (0).
94 int (CEF_CALLBACK *read_response)(struct _cef_resource_handler_t* self,
95 void* data_out, int bytes_to_read, int* bytes_read,
96 struct _cef_callback_t* callback);
99 // Return true (1) if the specified cookie can be sent with the request or
100 // false (0) otherwise. If false (0) is returned for any cookie then no
101 // cookies will be sent with the request.
103 int (CEF_CALLBACK *can_get_cookie)(struct _cef_resource_handler_t* self,
104 const struct _cef_cookie_t* cookie);
107 // Return true (1) if the specified cookie returned with the response can be
108 // set or false (0) otherwise.
110 int (CEF_CALLBACK *can_set_cookie)(struct _cef_resource_handler_t* self,
111 const struct _cef_cookie_t* cookie);
114 // Request processing has been canceled.
116 void (CEF_CALLBACK *cancel)(struct _cef_resource_handler_t* self);
117 } cef_resource_handler_t;
124 #endif // CEF_INCLUDE_CAPI_CEF_RESOURCE_HANDLER_CAPI_H_