51 lines
1.4 KiB
C
51 lines
1.4 KiB
C
|
#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);
|
||
|
};
|
||
|
|