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// Warning: This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
4
5// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
6// reserved. Use of this source code is governed by a BSD-style license that
7// can be found in the LICENSE file.
8
9/*************************************************************************
10 * Copyright (C) 1995-2023, Rene Brun and Fons Rademakers. *
11 * All rights reserved. *
12 * *
13 * For the licensing terms see $ROOTSYS/LICENSE. *
14 * For the list of contributors see $ROOTSYS/README/CREDITS. *
15 *************************************************************************/
16
17#ifndef ROOT_cef_simple_app
18#define ROOT_cef_simple_app
19
20#include "include/cef_app.h"
21
22#include <string>
23
24#include "gui_handler.h"
25
26class THttpServer;
27
29
30// Implement application-level callbacks for the browser process.
31class SimpleApp : public CefApp,
32#if defined(OS_LINUX)
33 public CefPrintHandler,
34#endif
35 /*, public CefRenderProcessHandler */
37protected:
38 bool fUseViewes = false; ///<! is views framework used
39 bool fSupressLog = false; ///<! supress log output when possible
40 THttpServer *fFirstServer; ///<! first server
41 std::string fFirstUrl; ///<! first URL to open
42 std::string fFirstContent; ///<! first page content open
43 CefRect fFirstRect; ///<! original width
44 bool fFirstHeadless{false}; ///<! is first window is headless
45 RCefWebDisplayHandle *fNextHandle{nullptr}; ///< next handle where browser will be created
46 bool fNextHeadless = false; ///< if next handle display is headless
47
48 CefRefPtr<GuiHandler> fGuiHandler; ///<! normal handler
49
50public:
52 THttpServer *serv = nullptr, const std::string &url = "", const std::string &cont = "",
53 int width = 0, int height = 0, bool headless = false);
54
56
57 // CefApp methods:
59
60 // only on Linux special print handler is required to return PDF size
61 // CefRefPtr<CefPrintHandler> GetPrintHandler() override { return this; }
62 // virtual CefRefPtr<CefRenderProcessHandler> GetRenderProcessHandler() override { return this; }
63
65
66 // CefBrowserProcessHandler methods:
67 void OnContextInitialized() override;
68
70
72
73#if defined(OS_LINUX)
74 // CefPrintHandler methods
76 bool OnPrintDialog( CefRefPtr< CefBrowser > browser, bool has_selection, CefRefPtr< CefPrintDialogCallback > callback ) override { return false; }
77 bool OnPrintJob( CefRefPtr< CefBrowser > browser, const CefString& document_name, const CefString& pdf_file_path, CefRefPtr< CefPrintJobCallback > callback ) override { return false; }
78 void OnPrintReset( CefRefPtr< CefBrowser > browser ) override {}
79 void OnPrintSettings( CefRefPtr< CefBrowser > browser, CefRefPtr< CefPrintSettings > settings, bool get_defaults ) override {}
80 void OnPrintStart( CefRefPtr< CefBrowser > browser ) override {}
81#endif
82
83
84 void StartWindow(THttpServer *serv, const std::string &url, const std::string &cont, CefRect &rect);
85
86 // CefRenderProcessHandler methods
87 // void OnContextCreated(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame,
88 // CefRefPtr<CefV8Context> context) override;
89
90private:
91 // Include the default reference counting implementation.
94};
95
96#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:45
CefRefPtr< CefBrowserProcessHandler > GetBrowserProcessHandler() override
Definition simple_app.h:58
bool fNextHeadless
if next handle display is headless
Definition simple_app.h:46
std::string fFirstUrl
! first URL to open
Definition simple_app.h:41
void SetNextHandle(RCefWebDisplayHandle *handle, bool headless)
bool fUseViewes
! is views framework used
Definition simple_app.h:38
void OnContextInitialized() override
THttpServer * fFirstServer
! first server
Definition simple_app.h:40
void StartWindow(THttpServer *serv, const std::string &url, const std::string &cont, CefRect &rect)
bool fFirstHeadless
! is first window is headless
Definition simple_app.h:44
bool fSupressLog
! supress log output when possible
Definition simple_app.h:39
void OnBeforeChildProcessLaunch(CefRefPtr< CefCommandLine > command_line) override
CefRect fFirstRect
! original width
Definition simple_app.h:43
void OnRegisterCustomSchemes(CefRawPtr< CefSchemeRegistrar > registrar) override
CefRefPtr< GuiHandler > fGuiHandler
! normal handler
Definition simple_app.h:48
std::string fFirstContent
! first page content open
Definition simple_app.h:42
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)
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