15#pragma GCC diagnostic ignored "-Wunused-parameter"
16#pragma GCC diagnostic ignored "-Wshadow"
39 CefDoMessageLoopWork();
55 void Visit(
const CefString &str)
override
87 auto handle = std::make_unique<RCefWebDisplayHandle>(args.
GetFullUrl());
90 fCefApp->SetNextHandle(handle.get());
92 CefRect rect((args.
GetX() > 0) ? args.
GetX() : 0, (args.
GetY() > 0) ? args.
GetY() : 0,
106 CefMainArgs main_args(GetModuleHandle(
nullptr));
111 const char *arg2 =
nullptr, *arg3 =
nullptr;
114 arg2 =
"--disable-web-security";
117 arg3 =
"--ozone-platform=headless";
121 char *cef_argv[] = {root_app->
Argv(0), (
char *) arg2, (
char *) arg3,
nullptr};
123 CefMainArgs main_args(cef_argc, cef_argv);
143 CefSettings settings;
146 cef_string_ascii_to_utf16(cef_main.
Data(), cef_main.
Length(), &settings.browser_subprocess_path);
151 cef_string_ascii_to_utf16(path2.
Data(), path2.
Length(), &settings.locales_dir_path);
153 cef_string_ascii_to_utf16(path3.
Data(), path3.
Length(), &settings.resources_dir_path);
159 cef_string_ascii_to_utf16(path2.
Data(), path2.
Length(), &settings.locales_dir_path);
161 cef_string_ascii_to_utf16(path3.
Data(), path3.
Length(), &settings.resources_dir_path);
167 cef_string_ascii_to_utf16(path.
Data(), path.
Length(), &settings.framework_dir_path);
170 settings.no_sandbox =
true;
179 std::string plog =
"cef.log";
180 cef_string_ascii_to_utf16(plog.c_str(), plog.length(), &settings.log_file);
182 settings.log_severity = LOGSEVERITY_ERROR;
200 CefInitialize(main_args, settings,
fCefApp.get(),
nullptr);
234 if (host) host->CloseBrowser(
true);
247 int expired = tmout_sec * 100;
248 bool did_try =
false, print_finished =
false;
250 if (!extra_args.empty() && (extra_args.find(
"--print-to-pdf=")==0))
251 pdffile = extra_args.substr(15);
253 while ((--expired > 0) &&
GetContent().empty() && !print_finished) {
257 CefDoMessageLoopWork();
261 if (pdffile.empty()) {
264 CefPdfPrintSettings settings;
275 CefDoMessageLoopWork();
285 GetMap().emplace(
"cef", std::make_unique<CefCreator>());
struct RCefCreatorReg newRCefCreatorReg
R__EXTERN TSystem * gSystem
DISALLOW_COPY_AND_ASSIGN(FrameSourceVisitor)
void Visit(const CefString &str) override
FrameSourceVisitor(RCefWebDisplayHandle *handle)
IMPLEMENT_REFCOUNTING(FrameSourceVisitor)
RCefWebDisplayHandle * fHandle
virtual ~FrameSourceVisitor()=default
static bool PlatformInit()
void OnPdfPrintFinished(const CefString &, bool ok) override
virtual ~HeadlessPrintCallback()=default
HeadlessPrintCallback(bool *flag)
IMPLEMENT_REFCOUNTING(HeadlessPrintCallback)
DISALLOW_COPY_AND_ASSIGN(HeadlessPrintCallback)
CefRefPtr< SimpleApp > fCefApp
std::unique_ptr< ROOT::Experimental::RWebDisplayHandle > Display(const ROOT::Experimental::RWebDisplayArgs &args) override
CefRefPtr< CefBrowser > fBrowser
associated browser
void CloseBrowser()
Closes associated browser window.
bool WaitForContent(int tmout_sec, const std::string &extra_args)
Process system events until browser content is available Used in headless mode for batch production l...
unsigned fValid
used to verify if instance valid or not
virtual ~RCefWebDisplayHandle()
Destructor Closes browser window if any.
Holds different arguments for starting browser with RWebDisplayHandle::Display() method.
bool IsHeadless() const
returns headless mode
int GetHeight() const
returns preferable web window height
const std::string & GetExtraArgs() const
get extra command line arguments for starting web browser command
std::string GetFullUrl() const
returns window url with append options
THttpServer * GetHttpServer() const
returns http server instance, used for window display
const std::string & GetPageContent() const
returns window url
int GetY() const
set preferable web window y position
int GetX() const
set preferable web window x position
int GetWidth() const
returns preferable web window width
static std::map< std::string, std::unique_ptr< Creator > > & GetMap()
Static holder of registered creators of web displays.
void SetContent(const std::string &cont)
set content
const std::string & GetContent() const
get content
static std::unique_ptr< Creator > & FindCreator(const std::string &name, const std::string &libname="")
Search for specific browser creator If not found, try to add one.
void SetNextHandle(RCefWebDisplayHandle *handle)
This class creates the ROOT Application Environment that interfaces to the windowing system eventloop...
TCefTimer(Long_t milliSec, Bool_t mode)
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
static const TString & GetBinDir()
Get the binary directory in the installation. Static utility function.
static const TString & GetLibDir()
Get the library directory in the installation. Static utility function.
static const TString & GetDataDir()
Get the data directory in the installation. Static utility function.
const char * Data() const
virtual void Sleep(UInt_t milliSec)
Sleep milliSec milli seconds.
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
Handles synchronous and a-synchronous timer events.
virtual void TurnOn()
Add the timer to the system timer list.