From 79f13de13b217eb49080b68ec9fd1ac2b7ef2ada Mon Sep 17 00:00:00 2001 From: Sergey Linev <S.Linev@gsi.de> Date: Thu, 4 Jul 2019 12:40:48 +0200 Subject: [PATCH] [webgui] provide "standalone" flag for RWebDisplayArgs It indicates if started browser should run in "standalone" mode - isolated from all others browser instances. Firefox in this case requires separate profile, Chrome uses --app mode to hide all decorations. To show normal browser, such "standalone" mode has to be disabled --- gui/webdisplay/inc/ROOT/RWebDisplayArgs.hxx | 7 +++++++ gui/webdisplay/inc/ROOT/RWebDisplayHandle.hxx | 2 -- gui/webdisplay/src/RWebDisplayHandle.cxx | 9 ++++++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/gui/webdisplay/inc/ROOT/RWebDisplayArgs.hxx b/gui/webdisplay/inc/ROOT/RWebDisplayArgs.hxx index 395c3167178..dbf1ac546a1 100644 --- a/gui/webdisplay/inc/ROOT/RWebDisplayArgs.hxx +++ b/gui/webdisplay/inc/ROOT/RWebDisplayArgs.hxx @@ -41,6 +41,7 @@ protected: EBrowserKind fKind{kNative}; ///<! id of web browser used for display std::string fUrl; ///<! URL to display bool fHeadless{false}; ///<! is browser runs in headless mode + bool fStandalone{true}; ///<! indicates if browser should run isolated from other browser instances THttpServer *fServer{nullptr}; ///<! http server which handle all requests int fWidth{0}; ///<! custom window width, when not specified - used RWebWindow geometry int fHeight{0}; ///<! custom window height, when not specified - used RWebWindow geometry @@ -79,6 +80,12 @@ public: /// returns window url std::string GetUrl() const { return fUrl; } + /// Set standalone mode for running browser, default on + /// When disabled, normal browser window (or just tab) will be started + void SetStandalone(bool on = true) { fStandalone = on; } + /// Return true if browser should runs in standalone mode + bool IsStandalone() const { return fStandalone; } + /// set window url options void SetUrlOpt(const std::string &opt) { fUrlOpt = opt; } /// returns window url options diff --git a/gui/webdisplay/inc/ROOT/RWebDisplayHandle.hxx b/gui/webdisplay/inc/ROOT/RWebDisplayHandle.hxx index 20d1a94ee36..4aab9da2d22 100644 --- a/gui/webdisplay/inc/ROOT/RWebDisplayHandle.hxx +++ b/gui/webdisplay/inc/ROOT/RWebDisplayHandle.hxx @@ -99,6 +99,4 @@ public: } } - - #endif diff --git a/gui/webdisplay/src/RWebDisplayHandle.cxx b/gui/webdisplay/src/RWebDisplayHandle.cxx index eba65359658..ab657d0b857 100644 --- a/gui/webdisplay/src/RWebDisplayHandle.cxx +++ b/gui/webdisplay/src/RWebDisplayHandle.cxx @@ -192,7 +192,14 @@ ROOT::Experimental::RWebDisplayHandle::BrowserCreator::Display(const RWebDisplay if (url.empty()) return nullptr; - TString exec = args.IsHeadless() ? fBatchExec.c_str() : fExec.c_str(); + TString exec; + if (args.IsHeadless()) + exec = fBatchExec.c_str(); + else if (args.IsStandalone()) + exec = fExec.c_str(); + else + exec = "$prog $url"; + if (exec.Length() == 0) return nullptr; -- GitLab