HumanRender/human_render/CEF/HumanAppBrowser.h

51 lines
1.4 KiB
C
Raw Permalink Normal View History

2024-12-19 17:46:41 +00:00
#pragma once
#include <set>
#include "CEF/HumanApp.h"
// Implement application-level callbacks for the browser process.
class HumanAppBrowser : public HumanApp, public CefBrowserProcessHandler {
public:
class Delegate : public virtual CefBaseRefCounted {
public:
virtual void OnBeforeCommandLineProcessing(
CefRefPtr<HumanAppBrowser> app,
CefRefPtr<CefCommandLine> command_line) {}
virtual void OnContextInitialized(CefRefPtr<HumanAppBrowser> app) {}
virtual void OnBeforeChildProcessLaunch(
CefRefPtr<HumanAppBrowser> app,
CefRefPtr<CefCommandLine> command_line) {}
};
using DelegateSet = std::set<CefRefPtr<Delegate>>;
HumanAppBrowser();
static void PopulateSettings(CefRefPtr<CefCommandLine> command_line,
CefSettings& settings);
private:
void OnBeforeCommandLineProcessing(
const CefString& process_type,
CefRefPtr<CefCommandLine> command_line) override;
CefRefPtr<CefBrowserProcessHandler> GetBrowserProcessHandler() override {
return this;
}
// CefBrowserProcessHandler methods.
void OnContextInitialized() override;
void OnBeforeChildProcessLaunch(
CefRefPtr<CefCommandLine> command_line) override;
void OnScheduleMessagePumpWork(int64 delay) override;
DelegateSet delegates_;
IMPLEMENT_REFCOUNTING(HumanAppBrowser);
DISALLOW_COPY_AND_ASSIGN(HumanAppBrowser);
};