Inexor
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
InexorCefSubprocessApp.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <list>
4 #include <map> // for map
5 #include <string> // for string
6 
7 #include "include/cef_app.h" // for CefApp
8 #include "include/cef_base.h" // for CefRefPtr, CefString
9 #include "include/cef_browser.h"
10 #include "include/cef_command_line.h"
11 #include "include/cef_process_message.h" // for CefProcessId, CefPro...
12 #include "include/cef_render_process_handler.h" // for CefRenderProcessHandler
13 #include "include/cef_v8.h" // for CefV8Value (ptr only)
14 #include "include/wrapper/cef_helpers.h"
15 #include "inexor/io/Logging.hpp"
16 
17 class CefBrowser;
18 class CefFrame;
19 
20 namespace inexor {
21 namespace ui {
22 
23 class InexorCefSubprocessApp : public CefApp,
24  public CefRenderProcessHandler,
25  public CefV8Handler,
26  public CefV8Accessor
27 {
28 
29  public:
31 
32  // Getters for handlers
33  CefRefPtr<CefRenderProcessHandler> GetRenderProcessHandler() override { return this; }
34 
35  // CefV8Handler
36  bool Execute(const CefString& name, CefRefPtr<CefV8Value> object, const CefV8ValueList& arguments, CefRefPtr<CefV8Value>& retval, CefString& exception) override;
37 
38  // CefV8Accessor
39  bool Get(const CefString& name, const CefRefPtr<CefV8Value> object, CefRefPtr<CefV8Value>& retval, CefString& exception) override;
40  bool Set(const CefString& name, const CefRefPtr<CefV8Value> object, const CefRefPtr<CefV8Value> value, CefString& exception) override;
41 
42  // CefRenderProcessHandler
43  void OnContextCreated(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, CefRefPtr<CefV8Context> context) override;
44 
45  // Event Handling
46  bool OnProcessMessageReceived(CefRefPtr<CefBrowser> browser, CefProcessId source_process, CefRefPtr<CefProcessMessage> message) override;
47  void FireUiEvent(std::string name, const CefV8ValueList& arguments);
48 
49 
50  // void OnRenderThreadCreated(CefRefPtr<CefApp> app, CefRefPtr extra_info) {
51  // std::cerr << "OnRenderThreadCreated()\n";
52  // }
53  // void OnWebKitInitialized(CefRefPtr app) {
54  // std::cerr << "OnRenderThreadCreated()\n";
55  // }
56  // void OnBrowserCreated(CefRefPtr app, CefRefPtr browser) {}
57  // void OnBrowserDestroyed(CefRefPtr app, CefRefPtr browser) {}
58  // bool OnBeforeNavigation(CefRefPtr app, CefRefPtr browser, CefRefPtr frame, CefRefPtr request, cef_navigation_type_t navigation_type, bool is_redirect) { return false; }
59  // void OnContextReleased(CefRefPtr app, CefRefPtr browser, CefRefPtr frame, CefRefPtr context) {}
60  // void OnUncaughtException(CefRefPtr app, CefRefPtr browser, CefRefPtr frame, CefRefPtr context, CefRefPtr exception, CefRefPtr stackTrace) {}
61  // void OnFocusedNodeChanged(CefRefPtr app, CefRefPtr browser, CefRefPtr frame, CefRefPtr node) {}
62 
63  private:
64 
66 
67  std::map<CefRefPtr<CefV8Value>, CefRefPtr<CefV8Context> > event_handlers;
68 
70 };
71 
72 }
73 }
InexorCefSubprocessApp()
Definition: InexorCefSubprocessApp.cpp:14
std::string _blah
Definition: InexorCefSubprocessApp.hpp:65
bool Get(const CefString &name, const CefRefPtr< CefV8Value > object, CefRefPtr< CefV8Value > &retval, CefString &exception) override
Definition: InexorCefSubprocessApp.cpp:40
bool OnProcessMessageReceived(CefRefPtr< CefBrowser > browser, CefProcessId source_process, CefRefPtr< CefProcessMessage > message) override
Definition: InexorCefSubprocessApp.cpp:71
CACHE INTERN message(STATUS"CMAKE_VERSION = ${CMAKE_VERSION}") message(STATUS"CMAKE_GENERATOR
std::map< CefRefPtr< CefV8Value >, CefRefPtr< CefV8Context > > event_handlers
Definition: InexorCefSubprocessApp.hpp:67
void OnContextCreated(CefRefPtr< CefBrowser > browser, CefRefPtr< CefFrame > frame, CefRefPtr< CefV8Context > context) override
Definition: InexorCefSubprocessApp.cpp:19
bool Set(const CefString &name, const CefRefPtr< CefV8Value > object, const CefRefPtr< CefV8Value > value, CefString &exception) override
Definition: InexorCefSubprocessApp.cpp:50
Definition: InexorCefSubprocessApp.hpp:23
bool Execute(const CefString &name, CefRefPtr< CefV8Value > object, const CefV8ValueList &arguments, CefRefPtr< CefV8Value > &retval, CefString &exception) override
Definition: InexorCefSubprocessApp.cpp:29
Logging stuff including the ingame console logging functionality.
IMPLEMENT_REFCOUNTING(InexorCefSubprocessApp)
char string[MAXSTRLEN]
cube-strings (char arrays of fixed size).
Definition: cube_types.hpp:18
GLsizei GLboolean const GLfloat * value
Definition: glexts.hpp:57
void FireUiEvent(std::string name, const CefV8ValueList &arguments)
Definition: InexorCefSubprocessApp.cpp:63
CefRefPtr< CefRenderProcessHandler > GetRenderProcessHandler() override
Definition: InexorCefSubprocessApp.hpp:33