forked from cztomczak/cefpython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathv8function_handler.h
More file actions
66 lines (54 loc) · 1.32 KB
/
Copy pathv8function_handler.h
File metadata and controls
66 lines (54 loc) · 1.32 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
// 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"
typedef void (*RemovePythonCallback_type)(
int callbackID
);
class V8FunctionHandler : public CefV8Handler
{
public:
V8FunctionHandler()
{
this->removePythonCallback = NULL;
this->pythonCallbackID = 0;
}
virtual ~V8FunctionHandler()
{
if (this->removePythonCallback) {
this->removePythonCallback(this->pythonCallbackID);
}
}
CefRefPtr<CefV8Context> __context;
void SetContext(CefRefPtr<CefV8Context> context)
{
this->__context = context;
}
CefRefPtr<CefV8Context> GetContext()
{
return this->__context;
}
// CefV8Handler methods.
RemovePythonCallback_type removePythonCallback;
int pythonCallbackID;
void SetCallback_RemovePythonCallback(RemovePythonCallback_type callback)
{
this->removePythonCallback = callback;
}
void SetPythonCallbackID(int callbackID)
{
this->pythonCallbackID = callbackID;
}
virtual bool Execute(
const CefString& name,
CefRefPtr<CefV8Value> object,
const CefV8ValueList& arguments,
CefRefPtr<CefV8Value>& retval,
CefString& exception) OVERRIDE;
protected:
IMPLEMENT_REFCOUNTING(V8FunctionHandler);
};