Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
ROOT::RWebBrowserHandle Class Reference

Specialized handle to hold information about running browser process Used to correctly cleanup all processes and temporary directories.

Definition at line 115 of file RWebDisplayHandle.cxx.

Public Member Functions

 RWebBrowserHandle (const std::string &url, const std::string &tmpdir, const std::string &tmpfile, browser_process_id pid)
 RWebBrowserHandle (const std::string &url, const std::string &tmpdir, const std::string &tmpfile, const std::string &dump)
 ~RWebBrowserHandle () override
const std::string & GetContent () const
 get content
const std::string & GetUrl () const
 returns url of start web display
void RemoveStartupFiles () override
 remove file which was used to startup widget - if possible
virtual bool Resize (int, int)
 resize web window - if possible
void SetContent (const std::string &cont)
 set content

Static Public Member Functions

static bool CanProduceImages (const std::string &browser="")
 Returns true if image production for specified browser kind is supported If browser not specified - use currently configured browser or try to test existing web browsers.
static std::unique_ptr< RWebDisplayHandleDisplay (const RWebDisplayArgs &args)
 Create web display.
static bool DisplayUrl (const std::string &url)
 Display provided url in configured web browser.
static std::string GetImageFormat (const std::string &fname)
 Detect image format There is special handling of ".screenshot.pdf" and ".screenshot.png" extensions Creation of such files relies on headless browser functionality and fully supported only by Chrome browser.
static bool NeedHttpServer (const RWebDisplayArgs &args)
 Check if http server required for display.
static bool ProduceImage (const std::string &fname, const std::string &json, int width=800, int height=600, const char *batch_file=nullptr)
 Produce image file using JSON data as source Invokes JSROOT drawing functionality in headless browser - Google Chrome or Mozilla Firefox.
static bool ProduceImages (const std::string &fname, const std::vector< std::string > &jsons, const std::vector< int > &widths, const std::vector< int > &heights, const char *batch_file=nullptr)
 Produce image file(s) using JSON data as source Invokes JSROOT drawing functionality in headless browser - Google Chrome or Mozilla Firefox.
static bool ProduceImages (const std::vector< std::string > &fnames, const std::vector< std::string > &jsons, const std::vector< int > &widths, const std::vector< int > &heights, const char *batch_file=nullptr)
 Produce image file(s) using JSON data as source Invokes JSROOT drawing functionality in headless browser - Google Chrome or Mozilla Firefox.
static std::vector< std::string > ProduceImagesNames (const std::string &fname, unsigned nfiles=1)
 Produce vector of file names for specified file pattern Depending from supported file forma.

Static Protected Member Functions

static bool CheckIfCanProduceImages (RWebDisplayArgs &args)
 Checks if configured browser can be used for image production.
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.
static std::map< std::string, std::unique_ptr< Creator > > & GetMap ()
 Static holder of registered creators of web displays.

Private Types

typedef pid_t browser_process_id

Private Attributes

std::string fContent
 !< URL used to launch display
bool fHasPid {false}
browser_process_id fPid
std::string fTmpDir
 temporary directory to delete at the end
std::string fTmpFile
 temporary file to remove
std::string fUrl
Inheritance diagram for ROOT::RWebBrowserHandle:
ROOT::RWebDisplayHandle

Member Typedef Documentation

◆ browser_process_id

Definition at line 120 of file RWebDisplayHandle.cxx.

Constructor & Destructor Documentation

◆ RWebBrowserHandle() [1/2]

ROOT::RWebBrowserHandle::RWebBrowserHandle ( const std::string & url,
const std::string & tmpdir,
const std::string & tmpfile,
const std::string & dump )
inline

Definition at line 128 of file RWebDisplayHandle.cxx.

◆ RWebBrowserHandle() [2/2]

ROOT::RWebBrowserHandle::RWebBrowserHandle ( const std::string & url,
const std::string & tmpdir,
const std::string & tmpfile,
browser_process_id pid )
inline

Definition at line 135 of file RWebDisplayHandle.cxx.

◆ ~RWebBrowserHandle()

ROOT::RWebBrowserHandle::~RWebBrowserHandle ( )
inlineoverride

Definition at line 141 of file RWebDisplayHandle.cxx.

Member Function Documentation

◆ CanProduceImages()

bool RWebDisplayHandle::CanProduceImages ( const std::string & browser = "")
staticinherited

Returns true if image production for specified browser kind is supported If browser not specified - use currently configured browser or try to test existing web browsers.

Definition at line 1070 of file RWebDisplayHandle.cxx.

◆ CheckIfCanProduceImages()

bool RWebDisplayHandle::CheckIfCanProduceImages ( RWebDisplayArgs & args)
staticprotectedinherited

Checks if configured browser can be used for image production.

Definition at line 1022 of file RWebDisplayHandle.cxx.

◆ Display()

std::unique_ptr< RWebDisplayHandle > RWebDisplayHandle::Display ( const RWebDisplayArgs & args)
staticinherited

Create web display.

Parameters
args- defines where and how to display web window Returns RWebDisplayHandle, which holds information of running browser application Can be used fully independent from RWebWindow classes just to show any web page

Definition at line 912 of file RWebDisplayHandle.cxx.

◆ DisplayUrl()

bool RWebDisplayHandle::DisplayUrl ( const std::string & url)
staticinherited

Display provided url in configured web browser.

Parameters
url- specified URL address like https://root.cern Browser can specified when starting root --web=firefox Returns true when browser started It is convenience method, equivalent to:
args.SetUrl(url);
args.SetStandalone(false);
auto handle = RWebDisplayHandle::Display(args);
Holds different arguments for starting browser with RWebDisplayHandle::Display() method.
void SetStandalone(bool on=true)
Set standalone mode for running browser, default on When disabled, normal browser window (or just tab...
RWebDisplayArgs & SetUrl(const std::string &url)
set window url
static std::unique_ptr< RWebDisplayHandle > Display(const RWebDisplayArgs &args)
Create web display.

Definition at line 1008 of file RWebDisplayHandle.cxx.

◆ FindCreator()

std::unique_ptr< RWebDisplayHandle::Creator > & RWebDisplayHandle::FindCreator ( const std::string & name,
const std::string & libname = "" )
staticprotectedinherited

Search for specific browser creator If not found, try to add one.

Parameters
name- creator name like ChromeCreator
libname- shared library name where creator could be provided

Definition at line 81 of file RWebDisplayHandle.cxx.

◆ GetContent()

const std::string & ROOT::RWebDisplayHandle::GetContent ( ) const
inlineinherited

get content

Definition at line 108 of file RWebDisplayHandle.hxx.

◆ GetImageFormat()

std::string RWebDisplayHandle::GetImageFormat ( const std::string & fname)
staticinherited

Detect image format There is special handling of ".screenshot.pdf" and ".screenshot.png" extensions Creation of such files relies on headless browser functionality and fully supported only by Chrome browser.

Definition at line 1082 of file RWebDisplayHandle.cxx.

◆ GetMap()

std::map< std::string, std::unique_ptr< RWebDisplayHandle::Creator > > & RWebDisplayHandle::GetMap ( )
staticprotectedinherited

Static holder of registered creators of web displays.

Definition at line 69 of file RWebDisplayHandle.cxx.

◆ GetUrl()

const std::string & ROOT::RWebDisplayHandle::GetUrl ( ) const
inlineinherited

returns url of start web display

Definition at line 103 of file RWebDisplayHandle.hxx.

◆ NeedHttpServer()

bool RWebDisplayHandle::NeedHttpServer ( const RWebDisplayArgs & args)
staticinherited

Check if http server required for display.

Parameters
args- defines where and how to display web window

Definition at line 882 of file RWebDisplayHandle.cxx.

◆ ProduceImage()

bool RWebDisplayHandle::ProduceImage ( const std::string & fname,
const std::string & json,
int width = 800,
int height = 600,
const char * batch_file = nullptr )
staticinherited

Produce image file using JSON data as source Invokes JSROOT drawing functionality in headless browser - Google Chrome or Mozilla Firefox.

Definition at line 1115 of file RWebDisplayHandle.cxx.

◆ ProduceImages() [1/2]

bool RWebDisplayHandle::ProduceImages ( const std::string & fname,
const std::vector< std::string > & jsons,
const std::vector< int > & widths,
const std::vector< int > & heights,
const char * batch_file = nullptr )
staticinherited

Produce image file(s) using JSON data as source Invokes JSROOT drawing functionality in headless browser - Google Chrome or Mozilla Firefox.

Definition at line 1162 of file RWebDisplayHandle.cxx.

◆ ProduceImages() [2/2]

bool RWebDisplayHandle::ProduceImages ( const std::vector< std::string > & fnames,
const std::vector< std::string > & jsons,
const std::vector< int > & widths,
const std::vector< int > & heights,
const char * batch_file = nullptr )
staticinherited

Produce image file(s) using JSON data as source Invokes JSROOT drawing functionality in headless browser - Google Chrome or Mozilla Firefox.

Definition at line 1171 of file RWebDisplayHandle.cxx.

◆ ProduceImagesNames()

std::vector< std::string > RWebDisplayHandle::ProduceImagesNames ( const std::string & fname,
unsigned nfiles = 1 )
staticinherited

Produce vector of file names for specified file pattern Depending from supported file forma.

Definition at line 1125 of file RWebDisplayHandle.cxx.

◆ RemoveStartupFiles()

void ROOT::RWebBrowserHandle::RemoveStartupFiles ( )
inlineoverridevirtual

remove file which was used to startup widget - if possible

Reimplemented from ROOT::RWebDisplayHandle.

Definition at line 157 of file RWebDisplayHandle.cxx.

◆ Resize()

virtual bool ROOT::RWebDisplayHandle::Resize ( int ,
int  )
inlinevirtualinherited

resize web window - if possible

Definition at line 111 of file RWebDisplayHandle.hxx.

◆ SetContent()

void ROOT::RWebDisplayHandle::SetContent ( const std::string & cont)
inlineinherited

set content

Definition at line 106 of file RWebDisplayHandle.hxx.

Member Data Documentation

◆ fContent

std::string ROOT::RWebDisplayHandle::fContent
privateinherited

!< URL used to launch display

Definition at line 30 of file RWebDisplayHandle.hxx.

◆ fHasPid

bool ROOT::RWebBrowserHandle::fHasPid {false}
private

Definition at line 124 of file RWebDisplayHandle.cxx.

◆ fPid

browser_process_id ROOT::RWebBrowserHandle::fPid
private

Definition at line 125 of file RWebDisplayHandle.cxx.

◆ fTmpDir

std::string ROOT::RWebBrowserHandle::fTmpDir
private

temporary directory to delete at the end

Definition at line 122 of file RWebDisplayHandle.cxx.

◆ fTmpFile

std::string ROOT::RWebBrowserHandle::fTmpFile
private

temporary file to remove

Definition at line 123 of file RWebDisplayHandle.cxx.

◆ fUrl

std::string ROOT::RWebDisplayHandle::fUrl
privateinherited

Definition at line 28 of file RWebDisplayHandle.hxx.


The documentation for this class was generated from the following file: