forked from cztomczak/cef2go
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathclientHandler.c
162 lines (141 loc) · 4.92 KB
/
clientHandler.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
// Copyright (c) 2014 The cef2go authors. All rights reserved.
// License: BSD 3-clause.
// Website: https://github.com/CzarekTomczak/cef2go
// Website: https://github.com/fromkeith/cef2go
#include "_cgo_export.h"
#include "cefBase.h"
#include "include/capi/cef_client_capi.h"
// ----------------------------------------------------------------------------
// struct _cef_client_t
// ----------------------------------------------------------------------------
///
// Implement this structure to provide handler implementations.
///
///
// Return the handler for context menus. If no handler is provided the default
// implementation will be used.
///
struct _cef_context_menu_handler_t* CEF_CALLBACK get_context_menu_handler(
struct _cef_client_t* self) {
return go_GetContextMenuHandler(self);
}
///
// Return the handler for dialogs. If no handler is provided the default
// implementation will be used.
///
struct _cef_dialog_handler_t* CEF_CALLBACK get_dialog_handler(
struct _cef_client_t* self) {
return go_GetDialogHandler(self);
}
///
// Return the handler for browser display state events.
///
struct _cef_display_handler_t* CEF_CALLBACK get_display_handler(
struct _cef_client_t* self) {
return go_GetDisplayHandler(self);
}
///
// Return the handler for download events. If no handler is returned downloads
// will not be allowed.
///
struct _cef_download_handler_t* CEF_CALLBACK get_download_handler(
struct _cef_client_t* self) {
return go_GetDownloadHandler(self);
}
///
// Return the handler for drag events.
///
struct _cef_drag_handler_t* CEF_CALLBACK get_drag_handler(
struct _cef_client_t* self) {
return go_GetDragHandler(self);
}
///
// Return the handler for focus events.
///
struct _cef_focus_handler_t* CEF_CALLBACK get_focus_handler(
struct _cef_client_t* self) {
return go_GetFocusHandler(self);
}
///
// Return the handler for geolocation permissions requests. If no handler is
// provided geolocation access will be denied by default.
///
struct _cef_geolocation_handler_t* CEF_CALLBACK get_geolocation_handler(
struct _cef_client_t* self) {
return go_GetGeoLocationHandler(self);
}
///
// Return the handler for JavaScript dialogs. If no handler is provided the
// default implementation will be used.
///
struct _cef_jsdialog_handler_t* CEF_CALLBACK get_jsdialog_handler(
struct _cef_client_t* self) {
return go_GetJsDialogHandler(self);
}
///
// Return the handler for keyboard events.
///
struct _cef_keyboard_handler_t* CEF_CALLBACK get_keyboard_handler(
struct _cef_client_t* self) {
return go_GetKeyboardHandler(self);
}
///
// Return the handler for browser life span events.
///
struct _cef_life_span_handler_t* CEF_CALLBACK get_life_span_handler(
struct _cef_client_t* self) {
return go_GetLifespanHandler(self);
}
///
// Return the handler for browser load status events.
///
struct _cef_load_handler_t* CEF_CALLBACK get_load_handler(
struct _cef_client_t* self) {
return go_GetLoadHandler(self);
}
///
// Return the handler for off-screen rendering events.
///
struct _cef_render_handler_t* CEF_CALLBACK get_render_handler(
struct _cef_client_t* self) {
return go_GetRenderHandler(self);
}
///
// Return the handler for browser request events.
///
struct _cef_request_handler_t* CEF_CALLBACK get_request_handler(
struct _cef_client_t* self) {
return go_GetRequestHandler(self);
}
///
// Called when a new message is received from a different process. Return true
// (1) if the message was handled or false (0) otherwise. Do not keep a
// reference to or attempt to access the message outside of this callback.
///
int CEF_CALLBACK on_process_message_received(
struct _cef_client_t* self,
struct _cef_browser_t* browser, cef_process_id_t source_process,
struct _cef_process_message_t* message) {
goDebugLog("on_process_message_received\n");
return 0;
}
void initialize_client_handler(struct _cef_client_t* client) {
goDebugLog("initialize_client_handler\n");
client->base.size = sizeof(cef_client_t);
initialize_cef_base((cef_base_t*) client, "client_handler");
// callbacks
client->get_context_menu_handler = get_context_menu_handler;
client->get_dialog_handler = get_dialog_handler;
client->get_display_handler = get_display_handler;
client->get_download_handler = get_download_handler;
client->get_drag_handler = get_drag_handler;
client->get_focus_handler = get_focus_handler;
client->get_geolocation_handler = get_geolocation_handler;
client->get_jsdialog_handler = get_jsdialog_handler;
client->get_keyboard_handler = get_keyboard_handler;
client->get_life_span_handler = get_life_span_handler;
client->get_load_handler = get_load_handler;
client->get_render_handler = get_render_handler;
client->get_request_handler = get_request_handler;
client->on_process_message_received = on_process_message_received;
}