forked from cztomczak/cefpython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient_handler.h
More file actions
304 lines (233 loc) · 10 KB
/
client_handler.h
File metadata and controls
304 lines (233 loc) · 10 KB
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
// Copyright (c) 2012-2014 The CEF Python authors. All rights reserved.
// License: New BSD License.
// Website: http://code.google.com/p/cefpython/
#pragma once
#if defined(_WIN32)
#include "../windows/stdint.h"
#endif
#include "cefpython_public_api.h"
class ClientHandler : public CefClient,
public CefLoadHandler,
public CefKeyboardHandler,
public CefV8ContextHandler,
public CefRequestHandler,
public CefDisplayHandler,
public CefLifeSpanHandler,
public CefRenderHandler,
public CefDragHandler
/*
public CefFocusHandler,
public CefMenuHandler,
public CefPrintHandler,
public CefPermissionHandler,
public CefFindHandler,
public CefJSDialogHandler,
*/
{
public:
ClientHandler(){}
virtual ~ClientHandler(){}
// ---------------------------------------------------------------------------
// Handlers that are already implemented
// ---------------------------------------------------------------------------
virtual CefRefPtr<CefLoadHandler> GetLoadHandler() OVERRIDE
{ return this; }
virtual CefRefPtr<CefRequestHandler> GetRequestHandler() OVERRIDE
{ return this; }
virtual CefRefPtr<CefDisplayHandler> GetDisplayHandler() OVERRIDE
{ return this; }
virtual CefRefPtr<CefKeyboardHandler> GetKeyboardHandler() OVERRIDE
{ return this; }
virtual CefRefPtr<CefV8ContextHandler> GetV8ContextHandler() OVERRIDE
{ return this; }
virtual CefRefPtr<CefLifeSpanHandler> GetLifeSpanHandler() OVERRIDE
{ return this; }
virtual CefRefPtr<CefRenderHandler> GetRenderHandler() OVERRIDE
{ return this; }
virtual CefRefPtr<CefDragHandler> GetDragHandler() OVERRIDE
{ return this; }
// ---------------------------------------------------------------------------
// NOT yet implemented handlers
// ---------------------------------------------------------------------------
virtual CefRefPtr<CefFocusHandler> GetFocusHandler() OVERRIDE
{ return NULL; }
virtual CefRefPtr<CefMenuHandler> GetMenuHandler() OVERRIDE
{ return NULL; }
virtual CefRefPtr<CefPermissionHandler> GetPermissionHandler() OVERRIDE
{ return NULL; }
virtual CefRefPtr<CefPrintHandler> GetPrintHandler() OVERRIDE
{ return NULL; }
virtual CefRefPtr<CefFindHandler> GetFindHandler() OVERRIDE
{ return NULL; }
virtual CefRefPtr<CefJSDialogHandler> GetJSDialogHandler() OVERRIDE
{ return NULL; }
// ---------------------------------------------------------------------------
// CefLoadHandler methods.
// ---------------------------------------------------------------------------
virtual void OnLoadEnd(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
int httpStatusCode
) OVERRIDE;
virtual void OnLoadStart(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame
) OVERRIDE;
virtual bool OnLoadError(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
cef_handler_errorcode_t errorCode,
const CefString& failedUrl,
CefString& errorText
) OVERRIDE;
// ---------------------------------------------------------------------------
// CefKeyboardHandler methods.
// ---------------------------------------------------------------------------
virtual bool OnKeyEvent(
CefRefPtr<CefBrowser> browser,
cef_handler_keyevent_type_t eventType,
int keyCode,
int modifiers,
bool isSystemKey,
bool isAfterJavascript
) OVERRIDE;
// ---------------------------------------------------------------------------
// CefV8ContextHandler methods.
// ---------------------------------------------------------------------------
virtual void OnContextCreated(
CefRefPtr<CefBrowser> cefBrowser,
CefRefPtr<CefFrame> cefFrame,
CefRefPtr<CefV8Context> v8Context) OVERRIDE;
virtual void OnContextReleased(
CefRefPtr<CefBrowser> cefBrowser,
CefRefPtr<CefFrame> cefFrame,
CefRefPtr<CefV8Context> v8Context) OVERRIDE;
virtual void OnUncaughtException(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefV8Context> context,
CefRefPtr<CefV8Exception> exception,
CefRefPtr<CefV8StackTrace> stackTrace) OVERRIDE;
// ---------------------------------------------------------------------------
// CefRequestHandler methods.
// ---------------------------------------------------------------------------
virtual bool OnBeforeBrowse(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefRequest> request,
cef_handler_navtype_t navType,
bool isRedirect) OVERRIDE;
virtual bool OnBeforeResourceLoad(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefRequest> request,
CefString& redirectUrl,
CefRefPtr<CefStreamReader>& resourceStream,
CefRefPtr<CefResponse> response,
int loadFlags) OVERRIDE;
virtual void OnResourceRedirect(
CefRefPtr<CefBrowser> browser,
const CefString& old_url,
CefString& new_url) OVERRIDE;
virtual void OnResourceResponse(
CefRefPtr<CefBrowser> browser,
const CefString& url,
CefRefPtr<CefResponse> response,
CefRefPtr<CefContentFilter>& filter) OVERRIDE;
virtual bool OnProtocolExecution(
CefRefPtr<CefBrowser> browser,
const CefString& url,
bool& allowOSExecution) OVERRIDE;
virtual bool GetDownloadHandler(
CefRefPtr<CefBrowser> browser,
const CefString& mimeType,
const CefString& fileName,
int64 contentLength,
CefRefPtr<CefDownloadHandler>& handler) OVERRIDE;
virtual bool GetAuthCredentials(
CefRefPtr<CefBrowser> browser,
bool isProxy,
const CefString& host,
int port,
const CefString& realm,
const CefString& scheme,
CefString& username,
CefString& password) OVERRIDE;
virtual CefRefPtr<CefCookieManager> GetCookieManager(
CefRefPtr<CefBrowser> browser,
const CefString& main_url) OVERRIDE;
// ---------------------------------------------------------------------------
// CefDisplayHandler
// ---------------------------------------------------------------------------
virtual void OnAddressChange(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
const CefString& url) OVERRIDE;
virtual bool OnConsoleMessage(CefRefPtr<CefBrowser> browser,
const CefString& message,
const CefString& source,
int line) OVERRIDE;
virtual void OnContentsSizeChange(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
int width,
int height) OVERRIDE;
virtual void OnNavStateChange(CefRefPtr<CefBrowser> browser,
bool canGoBack,
bool canGoForward) OVERRIDE;
virtual void OnStatusMessage(CefRefPtr<CefBrowser> browser,
const CefString& value,
StatusType type) OVERRIDE;
virtual void OnTitleChange(CefRefPtr<CefBrowser> browser,
const CefString& title) OVERRIDE;
virtual bool OnTooltip(CefRefPtr<CefBrowser> browser,
CefString& text) OVERRIDE;
// ---------------------------------------------------------------------------
// CefLifeSpanHandler
// ---------------------------------------------------------------------------
virtual bool DoClose(CefRefPtr<CefBrowser> browser) OVERRIDE;
virtual void OnAfterCreated(CefRefPtr<CefBrowser> browser) OVERRIDE;
virtual void OnBeforeClose(CefRefPtr<CefBrowser> browser) OVERRIDE;
virtual bool OnBeforePopup(CefRefPtr<CefBrowser> parentBrowser,
const CefPopupFeatures& popupFeatures,
CefWindowInfo& windowInfo,
const CefString& url,
CefRefPtr<CefClient>& client,
CefBrowserSettings& settings) OVERRIDE;
virtual bool RunModal(CefRefPtr<CefBrowser> browser) OVERRIDE;
// ---------------------------------------------------------------------------
// CefRenderHandler
// ---------------------------------------------------------------------------
#if defined(OS_WIN)
virtual bool GetViewRect(CefRefPtr<CefBrowser> browser,
CefRect& rect) OVERRIDE;
virtual bool GetScreenRect(CefRefPtr<CefBrowser> browser,
CefRect& rect) OVERRIDE;
virtual bool GetScreenPoint(CefRefPtr<CefBrowser> browser,
int viewX,
int viewY,
int& screenX,
int& screenY) OVERRIDE;
virtual void OnPopupShow(CefRefPtr<CefBrowser> browser,
bool show) OVERRIDE;
virtual void OnPopupSize(CefRefPtr<CefBrowser> browser,
const CefRect& rect) OVERRIDE;
virtual void OnPaint(CefRefPtr<CefBrowser> browser,
PaintElementType type,
const RectList& dirtyRects,
const void* buffer) OVERRIDE;
virtual void OnCursorChange(CefRefPtr<CefBrowser> browser,
CefCursorHandle cursor) OVERRIDE;
#endif
// ---------------------------------------------------------------------------
// CefDragHandler
// ---------------------------------------------------------------------------
virtual bool OnDragStart(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefDragData> dragData,
DragOperationsMask mask) OVERRIDE;
virtual bool OnDragEnter(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefDragData> dragData,
DragOperationsMask mask) OVERRIDE;
protected:
// Include the default reference counting implementation.
IMPLEMENT_REFCOUNTING(ClientHandler);
// Include the default locking implementation.
IMPLEMENT_LOCKING(ClientHandler);
};