Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions gdcef/browser/src/gdbrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,8 @@ void GdBrowserView::_bind_methods()
PropertyInfo(Variant::OBJECT, "browser")));
ADD_SIGNAL(
MethodInfo("on_page_loaded", PropertyInfo(Variant::OBJECT, "browser")));
ADD_SIGNAL(MethodInfo("on_page_start_loading",
PropertyInfo(Variant::OBJECT, "browser")));
ADD_SIGNAL(MethodInfo("on_page_failed_loading",
PropertyInfo(Variant::INT, "err_code"),
PropertyInfo(Variant::STRING, "err_msg"),
Expand Down Expand Up @@ -537,6 +539,20 @@ void GdBrowserView::onPaint(CefRefPtr<CefBrowser> /*browser*/,
emit_signal("on_browser_paint", this);
}

//------------------------------------------------------------------------------
void GdBrowserView::onLoadStart(CefRefPtr<CefBrowser> /*browser*/,
CefRefPtr<CefFrame> frame)
{
// Emit signal only when top-level frame is loading.
if (frame->IsMain())
{
BROWSER_DEBUG("has started loading " << frame->GetURL());

// Emit signal for Godot script
emit_signal("on_page_start_loading", this);
}
}

//------------------------------------------------------------------------------
void GdBrowserView::onLoadEnd(CefRefPtr<CefBrowser> /*browser*/,
CefRefPtr<CefFrame> frame,
Expand Down
21 changes: 21 additions & 0 deletions gdcef/browser/src/gdbrowser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,21 @@ class GdBrowserView: public godot::Node

private: // CefLoadHandler interfaces

// ---------------------------------------------------------------------
//! \brief Called when the browser begins loading a frame. The |frame|
//! value will never be empty -- call the IsMain() method to check if
//! this frame is the main frame. Multiple frames may be loading at the
//! same time. Sub-frames may start or continue loading after the main
//! frame load has ended. This method may not be called for a particular
//! frame if the load request for that frame fails.
// ---------------------------------------------------------------------
virtual void OnLoadStart(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
TransitionType transition_type) override
{
m_owner.onLoadStart(browser, frame);
}

// ---------------------------------------------------------------------
//! \brief Called when the browser is done loading a frame. The |frame|
//! value will never be empty -- call the IsMain() method to check if
Expand Down Expand Up @@ -1025,6 +1040,12 @@ class GdBrowserView: public godot::Node
int width,
int height);

// -------------------------------------------------------------------------
//! \brief Called by GdBrowserView::Impl::OnLoadStart
// -------------------------------------------------------------------------
void onLoadStart(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame);

// -------------------------------------------------------------------------
//! \brief Called by GdBrowserView::Impl::OnLoadEnd
// -------------------------------------------------------------------------
Expand Down
Loading