// Author: Sergey Linev // Date: 2017-06-29 // Warning: This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome! // Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights // reserved. Use of this source code is governed by a BSD-style license that // can be found in the LICENSE file. /************************************************************************* * Copyright (C) 1995-2023, Rene Brun and Fons Rademakers. * * All rights reserved. * * * * For the licensing terms see $ROOTSYS/LICENSE. * * For the list of contributors see $ROOTSYS/README/CREDITS. * *************************************************************************/ #ifndef ROOT_cef_simple_app #define ROOT_cef_simple_app #include "include/cef_app.h" #include #include "gui_handler.h" class THttpServer; class RCefWebDisplayHandle; // Implement application-level callbacks for the browser process. class SimpleApp : public CefApp, #if defined(OS_LINUX) public CefPrintHandler, #endif /*, public CefRenderProcessHandler */ public CefBrowserProcessHandler { protected: bool fUseViewes{false}; /// fGuiHandler; /// GetBrowserProcessHandler() override { return this; } // only on Linux special print handler is required to return PDF size // CefRefPtr GetPrintHandler() override { return this; } // virtual CefRefPtr GetRenderProcessHandler() override { return this; } void OnRegisterCustomSchemes(CefRawPtr registrar) override; // CefBrowserProcessHandler methods: void OnContextInitialized() override; void OnBeforeCommandLineProcessing(const CefString &process_type, CefRefPtr command_line) override; void OnBeforeChildProcessLaunch(CefRefPtr command_line) override; #if defined(OS_LINUX) // CefPrintHandler methods CefSize GetPdfPaperSize(CefRefPtr, int device_units_per_inch) override { return CefSize(device_units_per_inch*8.25, device_units_per_inch*11.75); } bool OnPrintDialog( CefRefPtr< CefBrowser > browser, bool has_selection, CefRefPtr< CefPrintDialogCallback > callback ) override { return false; } bool OnPrintJob( CefRefPtr< CefBrowser > browser, const CefString& document_name, const CefString& pdf_file_path, CefRefPtr< CefPrintJobCallback > callback ) override { return false; } void OnPrintReset( CefRefPtr< CefBrowser > browser ) override {} void OnPrintSettings( CefRefPtr< CefBrowser > browser, CefRefPtr< CefPrintSettings > settings, bool get_defaults ) override {} void OnPrintStart( CefRefPtr< CefBrowser > browser ) override {} #endif void StartWindow(THttpServer *serv, const std::string &url, const std::string &cont, CefRect &rect); // CefRenderProcessHandler methods // void OnContextCreated(CefRefPtr browser, CefRefPtr frame, // CefRefPtr context) override; private: // Include the default reference counting implementation. IMPLEMENT_REFCOUNTING(SimpleApp); DISALLOW_COPY_AND_ASSIGN(SimpleApp); }; #endif // ROOT_cef_simple_app