forked from cztomczak/cefpython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcefpython_app.h
More file actions
132 lines (101 loc) · 4.9 KB
/
cefpython_app.h
File metadata and controls
132 lines (101 loc) · 4.9 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
// Copyright (c) 2012-2014 The CEF Python authors. All rights reserved.
// License: New BSD License.
// Website: http://code.google.com/p/cefpython/
#pragma once
#include "include/cef_app.h"
#include <map>
// CefPythonApp class is instantiated in subprocess and in
// cefpython.pyx for the browser process, so the code is shared.
// Using printf() in CefRenderProcessHandler won't work, use
// the DebugLog() function instead, it will write the message
// to the "debug.log" file.
///
// Implement this interface to provide handler implementations. Methods will be
// called by the process and/or thread indicated.
///
/*--cef(source=client,no_debugct_check)--*/
class CefPythonApp :
public CefApp,
public CefBrowserProcessHandler,
public CefRenderProcessHandler {
public:
CefPythonApp();
virtual void OnBeforeCommandLineProcessing(
const CefString& process_type,
CefRefPtr<CefCommandLine> command_line) OVERRIDE;
virtual void OnRegisterCustomSchemes(
CefRefPtr<CefSchemeRegistrar> registrar) OVERRIDE;
virtual CefRefPtr<CefResourceBundleHandler> GetResourceBundleHandler()
OVERRIDE;
virtual CefRefPtr<CefBrowserProcessHandler> GetBrowserProcessHandler()
OVERRIDE;
virtual CefRefPtr<CefRenderProcessHandler> GetRenderProcessHandler()
OVERRIDE;
// ---------------------------------------------------------------------------
// CefBrowserProcessHandler
// ---------------------------------------------------------------------------
virtual void OnContextInitialized() OVERRIDE;
virtual void OnBeforeChildProcessLaunch(
CefRefPtr<CefCommandLine> command_line) OVERRIDE;
virtual void OnRenderProcessThreadCreated(
CefRefPtr<CefListValue> extra_info) OVERRIDE;
// ---------------------------------------------------------------------------
// CefRenderProcessHandler
// ---------------------------------------------------------------------------
virtual void OnRenderThreadCreated(CefRefPtr<CefListValue> extra_info)
OVERRIDE;
virtual void OnWebKitInitialized()
OVERRIDE;
virtual void OnBrowserCreated(CefRefPtr<CefBrowser> browser)
OVERRIDE;
virtual void OnBrowserDestroyed(CefRefPtr<CefBrowser> browser)
OVERRIDE;
virtual bool OnBeforeNavigation(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefRequest> request,
cef_navigation_type_t navigation_type,
bool is_redirect)
OVERRIDE;
virtual void OnContextCreated(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefV8Context> context)
OVERRIDE;
virtual void OnContextReleased(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefV8Context> context)
OVERRIDE;
virtual void OnUncaughtException(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefV8Context> context,
CefRefPtr<CefV8Exception> exception,
CefRefPtr<CefV8StackTrace> stackTrace)
OVERRIDE;
virtual void OnFocusedNodeChanged(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefDOMNode> node)
OVERRIDE;
virtual bool OnProcessMessageReceived(CefRefPtr<CefBrowser> browser,
CefProcessId source_process,
CefRefPtr<CefProcessMessage> message)
OVERRIDE;
// ---------------------------------------------------------------------------
// Javascript bindings
// ---------------------------------------------------------------------------
virtual void SetJavascriptBindings(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefDictionaryValue> data);
virtual CefRefPtr<CefDictionaryValue> GetJavascriptBindings(
CefRefPtr<CefBrowser> browser);
virtual void RemoveJavascriptBindings(CefRefPtr<CefBrowser> browser);
virtual bool BindedFunctionExists(CefRefPtr<CefBrowser> browser,
const CefString& funcName);
virtual void DoJavascriptBindingsForBrowser(CefRefPtr<CefBrowser> browser);
virtual void DoJavascriptBindingsForFrame(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefV8Context> context);
protected:
std::map<int, CefRefPtr<CefDictionaryValue> > javascriptBindings_;
std::string commandLineString_;
private:
// Include the default reference counting implementation.
IMPLEMENT_REFCOUNTING(CefPythonApp);
};