forked from cztomczak/cef2go
-
Notifications
You must be signed in to change notification settings - Fork 7
/
cefResourceHandler.c
57 lines (43 loc) · 2.15 KB
/
cefResourceHandler.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Copyright (c) 2014 The cef2go authors. All rights reserved.
// License: BSD 3-clause.
// Website: https://github.com/fromkeith/cef2go
#include "_cgo_export.h"
#include "cefBase.h"
#include "include/capi/cef_resource_handler_capi.h"
int CEF_CALLBACK cef_resource_handler_t_process_request(struct _cef_resource_handler_t* self,
struct _cef_request_t* request, struct _cef_callback_t* callback) {
return go_ProcessRequest(self, request, callback);
}
void CEF_CALLBACK cef_resource_handler_t_get_response_headers(
struct _cef_resource_handler_t* self, struct _cef_response_t* response,
int64* response_length, cef_string_t* redirectUrl) {
// not supporting redirect right now
go_GetResponseHeaders(self, response, response_length);
}
int CEF_CALLBACK cef_resource_handler_t_read_response(struct _cef_resource_handler_t* self,
void* data_out, int bytes_to_read, int* bytes_read,
struct _cef_callback_t* callback) {
return go_ReadResponse(self, data_out, bytes_to_read, bytes_read, callback);
}
int CEF_CALLBACK cef_resource_handler_t_can_get_cookie(struct _cef_resource_handler_t* self,
const struct _cef_cookie_t* cookie) {
return go_GetCookie(self, (struct _cef_cookie_t*) cookie);
}
int CEF_CALLBACK cef_resource_handler_t_can_set_cookie(struct _cef_resource_handler_t* self,
const struct _cef_cookie_t* cookie) {
return go_SetCookie(self, (struct _cef_cookie_t*) cookie);
}
void CEF_CALLBACK cef_resource_handler_t_cancel(struct _cef_resource_handler_t* self) {
go_Cancel(self);
}
void intialize_cef_resource_handler(struct _cef_resource_handler_t* handler) {
goDebugLog("initializeResourceHandler\n");
handler->base.size = sizeof(cef_resource_handler_t);
initialize_cef_base((cef_base_t*) handler, "resource_handler");
handler->process_request = cef_resource_handler_t_process_request;
handler->get_response_headers = cef_resource_handler_t_get_response_headers;
handler->read_response = cef_resource_handler_t_read_response;
handler->can_get_cookie = cef_resource_handler_t_can_get_cookie;
handler->can_set_cookie = cef_resource_handler_t_can_set_cookie;
handler->cancel = cef_resource_handler_t_cancel;
}