Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
gui_handler.h
Go to the documentation of this file.
1// Author: Sergey Linev <S.Linev@gsi.de>
2// Date: 2017-06-29
3
4/*************************************************************************
5 * Copyright (C) 1995-2023, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_cef_gui_handler_h
13#define ROOT_cef_gui_handler_h
14
15#include "include/cef_client.h"
16#include "include/base/cef_ref_counted.h"
17#include "include/cef_version.h"
18#include "include/wrapper/cef_resource_manager.h"
19#include <list>
20#include <vector>
21
22namespace ROOT {
23class RLogChannel;
24}
25
27
28class THttpServer;
29
30/** \class GuiHandler
31\ingroup cefwebdisplay
32*/
33
34class GuiHandler : public CefClient,
35 public CefLifeSpanHandler,
36 public CefLoadHandler,
37 public CefDisplayHandler,
38 public CefRequestHandler,
40protected:
41
42 bool fUseViews{false}; ///<! if view framework is used, required for true headless mode
43 int fConsole{0}; ///<! console parameter, assigned via WebGui.Console rootrc parameter
44 typedef std::list<CefRefPtr<CefBrowser>> BrowserList; ///<! List of existing browser windows. Only accessed on the CEF UI thread.
46
47 std::vector<THttpServer *> fServers;
48
49 bool is_closing_{false};
50
51public:
52 explicit GuiHandler(bool use_views = false);
53
54 // Provide access to the single global instance of this object.
55 // static BaseHandler *GetInstance();
56
57 // CefClient methods:
59 CefRefPtr<CefLoadHandler> GetLoadHandler() override { return this; }
62
63 // CefLifeSpanHandler methods:
67
68 // CefLoadHandler methods:
70 const CefString &errorText, const CefString &failedUrl) override;
71
72 // CefDisplayHandler methods:
73 void OnTitleChange(CefRefPtr<CefBrowser> browser, const CefString &title) override;
74
77 const CefString &message, const CefString &source,
78 int line) override;
79
80 // Request that all existing browser windows close.
82
83 bool IsClosing() const { return is_closing_; }
84
85 // CefRequestHandler methods:
94
95 // CefResourceRequestHandler methods:
100 CefRefPtr<CefCallback> callback) override;
101
105 CefRefPtr<CefRequest> request) override;
106
107 std::string AddBatchPage(const std::string &cont);
108
109 std::string MakePageUrl(THttpServer *serv, const std::string &addr);
110
111 static void PlatformInit();
112
113 static std::string GetDataURI(const std::string& data, const std::string& mime_type);
114
116
117private:
118
119 // Platform-specific implementation.
121
124
125 // Include the default reference counting implementation.
128};
129
130
131#endif // ROOT_cef_gui_handler_h
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t width
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
const char * mime_type
Definition civetweb.c:8517
CefRefPtr< CefResourceManager > fResourceManager
bool is_closing_
Definition gui_handler.h:49
int fConsole
! console parameter, assigned via WebGui.Console rootrc parameter
Definition gui_handler.h:43
GuiHandler(bool use_views=false)
std::vector< THttpServer * > fServers
Definition gui_handler.h:47
void OnBeforeClose(CefRefPtr< CefBrowser > browser) override
CefRefPtr< CefResourceHandler > GetResourceHandler(CefRefPtr< CefBrowser > browser, CefRefPtr< CefFrame > frame, CefRefPtr< CefRequest > request) override
bool DoClose(CefRefPtr< CefBrowser > browser) override
CefRefPtr< CefLifeSpanHandler > GetLifeSpanHandler() override
Definition gui_handler.h:58
BrowserList fBrowserList
Definition gui_handler.h:45
static bool PlatformResize(CefRefPtr< CefBrowser > browser, int width, int height)
void CloseAllBrowsers(bool force_close)
CefRefPtr< CefRequestHandler > GetRequestHandler() override
Definition gui_handler.h:61
IMPLEMENT_REFCOUNTING(GuiHandler)
int fBatchPageCount
CefRefPtr< CefResourceRequestHandler > GetResourceRequestHandler(CefRefPtr< CefBrowser > browser, CefRefPtr< CefFrame > frame, CefRefPtr< CefRequest > request, bool is_navigation, bool is_download, const CefString &request_initiator, bool &disable_default_handling) override
Definition gui_handler.h:86
void PlatformTitleChange(CefRefPtr< CefBrowser > browser, const CefString &title)
CefRefPtr< CefDisplayHandler > GetDisplayHandler() override
Definition gui_handler.h:60
cef_return_value_t OnBeforeResourceLoad(CefRefPtr< CefBrowser > browser, CefRefPtr< CefFrame > frame, CefRefPtr< CefRequest > request, CefRefPtr< CefCallback > callback) override
static void PlatformInit()
bool IsClosing() const
Definition gui_handler.h:83
void OnLoadError(CefRefPtr< CefBrowser > browser, CefRefPtr< CefFrame > frame, ErrorCode errorCode, const CefString &errorText, const CefString &failedUrl) override
static std::string GetDataURI(const std::string &data, const std::string &mime_type)
bool fUseViews
! if view framework is used, required for true headless mode
Definition gui_handler.h:42
std::string AddBatchPage(const std::string &cont)
Generate URL for batch page Uses file:/// prefix to let access JSROOT scripts placed on file system R...
std::string MakePageUrl(THttpServer *serv, const std::string &addr)
Generate URL for RWebWindow page Register server instance and assign it with the index Produced URL o...
bool OnConsoleMessage(CefRefPtr< CefBrowser > browser, cef_log_severity_t level, const CefString &message, const CefString &source, int line) override
CefRefPtr< CefLoadHandler > GetLoadHandler() override
Definition gui_handler.h:59
DISALLOW_COPY_AND_ASSIGN(GuiHandler)
std::list< CefRefPtr< CefBrowser > > BrowserList
! List of existing browser windows. Only accessed on the CEF UI thread.
Definition gui_handler.h:44
void OnTitleChange(CefRefPtr< CefBrowser > browser, const CefString &title) override
void OnAfterCreated(CefRefPtr< CefBrowser > browser) override
A log configuration for a channel, e.g.
Definition RLogger.hxx:97
Online http server for arbitrary ROOT application.
Definition THttpServer.h:31
TLine * line
ROOT::RLogChannel & CefWebDisplayLog()