Skip to content

Commit

Permalink
Activate OnBeforeCommandLineProcessing() to allow passing extra comma…
Browse files Browse the repository at this point in the history
…nd line #49
  • Loading branch information
Lecrapouille committed Apr 5, 2024
1 parent f3b6481 commit 33f7120
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 6 deletions.
21 changes: 16 additions & 5 deletions addons/gdcef/gdcef/src/gdcef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,13 @@ bool GDCef::initialize(godot::Dictionary config)
configureCEF(folder, m_cef_settings, m_window_info, config);

// This function should be called on the main application thread to
// initialize the CEF browser process. The |application| parameter may be
// empty. A return value of true indicates that it succeeded and false
// indicates that it failed. The |windows_sandbox_info| parameter is only
// used on Windows and may be NULL (see cef_sandbox_win.h for details).
// initialize the CEF browser process. A return value of true indicates
// that it succeeded and false indicates that it failed.
// Note: passed m_impl as 3th argument (as CefApp) because this is needed
// to call OnBeforeCommandLineProcessing().
CefMainArgs args;
GDCEF_DEBUG_VAL("[GDCEF][GDCef::_init] CefInitialize");
if (!CefInitialize(args, m_cef_settings, nullptr, nullptr))
if (!CefInitialize(args, m_cef_settings, m_impl, nullptr))
{
GDCEF_ERROR("CefInitialize failed");
m_impl = nullptr;
Expand Down Expand Up @@ -531,3 +531,14 @@ void GDCef::Impl::OnBeforeClose(CefRefPtr<CefBrowser> browser)
}
}
}

//------------------------------------------------------------------------------
void GDCef::Impl::OnBeforeCommandLineProcessing(const CefString& ProcessType,
CefRefPtr<CefCommandLine> command_line)
{
CEF_REQUIRE_UI_THREAD();
GDCEF_DEBUG();

if (command_line == nullptr)
return ;
}
20 changes: 19 additions & 1 deletion addons/gdcef/gdcef/src/gdcef.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ class GDCef : public godot::Node
//! called. To avoid this crash, we have to create this intermediate class.
// *************************************************************************
class Impl: public CefLifeSpanHandler,
public CefClient
public CefClient,
public CefApp, CefBrowserProcessHandler
{
public:

Expand Down Expand Up @@ -189,12 +190,29 @@ class GDCef : public godot::Node
return this;
}

// ---------------------------------------------------------------------
//! \brief Return the handler for browser process callbacks.
// ---------------------------------------------------------------------
virtual CefRefPtr<CefBrowserProcessHandler> GetBrowserProcessHandler() override
{
return this;
}

private: // CefLifeSpanHandler interfaces

virtual void OnAfterCreated(CefRefPtr<CefBrowser> browser) override;
virtual bool DoClose(CefRefPtr<CefBrowser> browser) override;
virtual void OnBeforeClose(CefRefPtr<CefBrowser> browser) override;

private: // CefApp

// ---------------------------------------------------------------------
//! \brief Called before a child process is launched. Provides an
//! opportunity to modify the child process command line.
// ---------------------------------------------------------------------
virtual void OnBeforeCommandLineProcessing(const CefString& ProcessType,
CefRefPtr<CefCommandLine> command_line) override;

private:

GDCef& m_owner;
Expand Down

0 comments on commit 33f7120

Please sign in to comment.