Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
simple_app.h
Go to the documentation of this file.
1// Author: Sergey Linev <S.Linev@gsi.de>
2// Date: 2017-06-29
3
4// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
5// reserved. Use of this source code is governed by a BSD-style license that
6// can be found in the LICENSE file.
7
8/*************************************************************************
9 * Copyright (C) 1995-2023, Rene Brun and Fons Rademakers. *
10 * All rights reserved. *
11 * *
12 * For the licensing terms see $ROOTSYS/LICENSE. *
13 * For the list of contributors see $ROOTSYS/README/CREDITS. *
14 *************************************************************************/
15
16#ifndef ROOT_cef_simple_app
17#define ROOT_cef_simple_app
18
19#include "include/cef_app.h"
20
21#include <string>
22
23#include "gui_handler.h"
24
25class THttpServer;
26
28
29// Implement application-level callbacks for the browser process.
30class SimpleApp : public CefApp,
31#if defined(OS_LINUX)
32 public CefPrintHandler,
33#endif
34 /*, public CefRenderProcessHandler */
36protected:
37 bool fUseViewes = false; ///<! is views framework used
38 bool fSupressLog = false; ///<! supress log output when possible
39 THttpServer *fFirstServer; ///<! first server
40 std::string fFirstUrl; ///<! first URL to open
41 std::string fFirstContent; ///<! first page content open
42 CefRect fFirstRect; ///<! original width
43 bool fFirstHeadless{false}; ///<! is first window is headless
44 RCefWebDisplayHandle *fNextHandle{nullptr}; ///< next handle where browser will be created
45 bool fNextHeadless = false; ///< if next handle display is headless
46
47 CefRefPtr<GuiHandler> fGuiHandler; ///<! normal handler
48
49public:
51 THttpServer *serv = nullptr, const std::string &url = "", const std::string &cont = "",
52 int width = 0, int height = 0, bool headless = false);
53
55
56 // CefApp methods:
58
59 // only on Linux special print handler is required to return PDF size
60 // CefRefPtr<CefPrintHandler> GetPrintHandler() override { return this; }
61 // virtual CefRefPtr<CefRenderProcessHandler> GetRenderProcessHandler() override { return this; }
62
64
65 // CefBrowserProcessHandler methods:
66 void OnContextInitialized() override;
67
69
71
72#if defined(OS_LINUX)
73 // CefPrintHandler methods
75 bool OnPrintDialog( CefRefPtr< CefBrowser > browser, bool has_selection, CefRefPtr< CefPrintDialogCallback > callback ) override { return false; }
76 bool OnPrintJob( CefRefPtr< CefBrowser > browser, const CefString& document_name, const CefString& pdf_file_path, CefRefPtr< CefPrintJobCallback > callback ) override { return false; }
77 void OnPrintReset( CefRefPtr< CefBrowser > browser ) override {}
78 void OnPrintSettings( CefRefPtr< CefBrowser > browser, CefRefPtr< CefPrintSettings > settings, bool get_defaults ) override {}
79 void OnPrintStart( CefRefPtr< CefBrowser > browser ) override {}
80#endif
81
82
83 void StartWindow(THttpServer *serv, const std::string &url, const std::string &cont, CefRect &rect, bool is_headless = false);
84
85 // CefRenderProcessHandler methods
86 // void OnContextCreated(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame,
87 // CefRefPtr<CefV8Context> context) override;
88
89private:
90 // Include the default reference counting implementation.
93};
94
95#endif // ROOT_cef_simple_app
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t rect
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
RCefWebDisplayHandle * fNextHandle
next handle where browser will be created
Definition simple_app.h:44
CefRefPtr< CefBrowserProcessHandler > GetBrowserProcessHandler() override
Definition simple_app.h:57
bool fNextHeadless
if next handle display is headless
Definition simple_app.h:45
std::string fFirstUrl
! first URL to open
Definition simple_app.h:40
void SetNextHandle(RCefWebDisplayHandle *handle, bool headless)
bool fUseViewes
! is views framework used
Definition simple_app.h:37
void OnContextInitialized() override
THttpServer * fFirstServer
! first server
Definition simple_app.h:39
bool fFirstHeadless
! is first window is headless
Definition simple_app.h:43
bool fSupressLog
! supress log output when possible
Definition simple_app.h:38
void OnBeforeChildProcessLaunch(CefRefPtr< CefCommandLine > command_line) override
CefRect fFirstRect
! original width
Definition simple_app.h:42
void OnRegisterCustomSchemes(CefRawPtr< CefSchemeRegistrar > registrar) override
CefRefPtr< GuiHandler > fGuiHandler
! normal handler
Definition simple_app.h:47
std::string fFirstContent
! first page content open
Definition simple_app.h:41
SimpleApp(bool use_viewes, bool supress_log, THttpServer *serv=nullptr, const std::string &url="", const std::string &cont="", int width=0, int height=0, bool headless=false)
void StartWindow(THttpServer *serv, const std::string &url, const std::string &cont, CefRect &rect, bool is_headless=false)
DISALLOW_COPY_AND_ASSIGN(SimpleApp)
IMPLEMENT_REFCOUNTING(SimpleApp)
void OnBeforeCommandLineProcessing(const CefString &process_type, CefRefPtr< CefCommandLine > command_line) override
Online http server for arbitrary ROOT application.
Definition THttpServer.h:31