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 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
46 CefRefPtr<GuiHandler> fGuiHandler; ///<! normal handler
47
48public:
49 SimpleApp(bool use_viewes,
50 THttpServer *serv = nullptr, const std::string &url = "", const std::string &cont = "",
51 int width = 0, int height = 0, bool headless = false);
52
54
55 // CefApp methods:
56 CefRefPtr<CefBrowserProcessHandler> GetBrowserProcessHandler() override { return this; }
57
58 // only on Linux special print handler is required to return PDF size
59 // CefRefPtr<CefPrintHandler> GetPrintHandler() override { return this; }
60 // virtual CefRefPtr<CefRenderProcessHandler> GetRenderProcessHandler() override { return this; }
61
62 void OnRegisterCustomSchemes(CefRawPtr<CefSchemeRegistrar> registrar) override;
63
64 // CefBrowserProcessHandler methods:
65 void OnContextInitialized() override;
66
67 void OnBeforeCommandLineProcessing(const CefString &process_type, CefRefPtr<CefCommandLine> command_line) override;
68
69 void OnBeforeChildProcessLaunch(CefRefPtr<CefCommandLine> command_line) override;
70
71#if defined(OS_LINUX)
72 // CefPrintHandler methods
73 CefSize GetPdfPaperSize(CefRefPtr<CefBrowser>, int device_units_per_inch) override { return CefSize(device_units_per_inch*8.25, device_units_per_inch*11.75); }
74 bool OnPrintDialog( CefRefPtr< CefBrowser > browser, bool has_selection, CefRefPtr< CefPrintDialogCallback > callback ) override { return false; }
75 bool OnPrintJob( CefRefPtr< CefBrowser > browser, const CefString& document_name, const CefString& pdf_file_path, CefRefPtr< CefPrintJobCallback > callback ) override { return false; }
76 void OnPrintReset( CefRefPtr< CefBrowser > browser ) override {}
77 void OnPrintSettings( CefRefPtr< CefBrowser > browser, CefRefPtr< CefPrintSettings > settings, bool get_defaults ) override {}
78 void OnPrintStart( CefRefPtr< CefBrowser > browser ) override {}
79#endif
80
81
82 void StartWindow(THttpServer *serv, const std::string &url, const std::string &cont, CefRect &rect);
83
84 // CefRenderProcessHandler methods
85 // void OnContextCreated(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame,
86 // CefRefPtr<CefV8Context> context) override;
87
88private:
89 // Include the default reference counting implementation.
92};
93
94#endif // ROOT_cef_simple_app
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:56
std::string fFirstUrl
! first URL to open
Definition simple_app.h:40
bool fUseViewes
! is views framework used
Definition simple_app.h:38
void OnContextInitialized() override
THttpServer * fFirstServer
! first server
Definition simple_app.h:39
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:43
void OnBeforeChildProcessLaunch(CefRefPtr< CefCommandLine > command_line) override
CefRect fFirstRect
! original width
Definition simple_app.h:42
void SetNextHandle(RCefWebDisplayHandle *handle)
void OnRegisterCustomSchemes(CefRawPtr< CefSchemeRegistrar > registrar) override
CefRefPtr< GuiHandler > fGuiHandler
! normal handler
Definition simple_app.h:46
std::string fFirstContent
! first page content open
Definition simple_app.h:41
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