Chromium Embedded Framework (CEF)
131.3.1+gcb062df+chromium-131.0.6778.109
|
Implement this interface to handle events related to CefFrame life span. More...
#include "include/cef_frame_handler.h"
Public Member Functions | |
virtual void | OnFrameCreated (CefRefPtr< CefBrowser > browser, CefRefPtr< CefFrame > frame) |
Called when a new frame is created. More... | |
virtual void | OnFrameDestroyed (CefRefPtr< CefBrowser > browser, CefRefPtr< CefFrame > frame) |
Called when an existing frame is destroyed. More... | |
virtual void | OnFrameAttached (CefRefPtr< CefBrowser > browser, CefRefPtr< CefFrame > frame, bool reattached) |
Called when a frame can begin routing commands to/from the associated renderer process. More... | |
virtual void | OnFrameDetached (CefRefPtr< CefBrowser > browser, CefRefPtr< CefFrame > frame) |
Called when a frame loses its connection to the renderer process. More... | |
virtual void | OnMainFrameChanged (CefRefPtr< CefBrowser > browser, CefRefPtr< CefFrame > old_frame, CefRefPtr< CefFrame > new_frame) |
Called when the main frame changes due to (a) initial browser creation, (b) final browser destruction, (c) cross-origin navigation or (d) re-navigation after renderer process termination (due to crashes, etc). More... | |
![]() | |
virtual void | AddRef () const =0 |
Called to increment the reference count for the object. More... | |
virtual bool | Release () const =0 |
Called to decrement the reference count for the object. More... | |
virtual bool | HasOneRef () const =0 |
Returns true if the reference count is 1. More... | |
virtual bool | HasAtLeastOneRef () const =0 |
Returns true if the reference count is at least 1. More... | |
Additional Inherited Members | |
![]() | |
virtual | ~CefBaseRefCounted () |
Implement this interface to handle events related to CefFrame life span.
The order of callbacks is:
(1) During initial CefBrowserHost creation and navigation of the main frame:
(2) During further CefBrowserHost navigation/loading of the main frame and/or sub-frames:
(3) During final CefBrowserHost destruction of the main frame:
Special handling applies for cross-origin loading on creation/navigation of sub-frames, and cross-origin loading on creation of new popup browsers. A temporary frame will first be created in the parent frame's renderer process. This temporary frame will never attach and will be discarded after the real cross-origin frame is created in the new/target renderer process. The client will receive creation callbacks for the temporary frame, followed by cross-origin navigation callbacks (2) for the transition from the temporary frame to the real frame. The temporary frame will not receive or execute commands during this transitional period (any sent commands will be discarded).
When the main frame navigates to a different origin the OnMainFrameChanged callback (2) will be executed with the old and new main frame objects.
Callbacks will not be executed for placeholders that may be created during pre-commit navigation for sub-frames that do not yet exist in the renderer process. Placeholders will have CefFrame::GetIdentifier() == -4.
The methods of this class will be called on the UI thread unless otherwise indicated.
|
inlinevirtual |
Called when a frame can begin routing commands to/from the associated renderer process.
|reattached| will be true if the frame was re-attached after exiting the BackForwardCache or after encountering a recoverable connection error. Any queued commands will now have been dispatched. This method will not be called for temporary frames created during cross-origin navigation.
|
inlinevirtual |
Called when a new frame is created.
This will be the first notification that references |frame|. Any commands that require transport to the associated renderer process (LoadRequest, SendProcessMessage, GetSource, etc.) will be queued. The queued commands will be sent before OnFrameAttached or discarded before OnFrameDestroyed if the frame never attaches.
|
inlinevirtual |
Called when an existing frame is destroyed.
This will be the last notification that references |frame| and CefFrame::IsValid() will return false for |frame|. If called during browser destruction and after CefLifeSpanHandler::OnBeforeClose() then CefBrowser::IsValid() will return false for |browser|. Any queued commands that have not been sent will be discarded before this callback.
|
inlinevirtual |
Called when a frame loses its connection to the renderer process.
This may occur when a frame is destroyed, enters the BackForwardCache, or encounters a rare connection error. In the case of frame destruction this call will be followed by a (potentially async) call to OnFrameDestroyed. If frame destruction is occuring synchronously then CefFrame::IsValid() will return false for |frame|. If called during browser destruction and after CefLifeSpanHandler::OnBeforeClose() then CefBrowser::IsValid() will return false for |browser|. If, in the non-destruction case, the same frame later exits the BackForwardCache or recovers from a connection error then there will be a follow-up call to OnFrameAttached. This method will not be called for temporary frames created during cross-origin navigation.
|
inlinevirtual |
Called when the main frame changes due to (a) initial browser creation, (b) final browser destruction, (c) cross-origin navigation or (d) re-navigation after renderer process termination (due to crashes, etc).
|old_frame| will be NULL and |new_frame| will be non-NULL when a main frame is assigned to |browser| for the first time. |old_frame| will be non-NULL and |new_frame| will be NULL when a main frame is removed from |browser| for the last time. Both |old_frame| and |new_frame| will be non-NULL for cross-origin navigations or re-navigation after renderer process termination. This method will be called after OnFrameCreated() for |new_frame| and/or after OnFrameDestroyed() for |old_frame|. If called during browser destruction and after CefLifeSpanHandler::OnBeforeClose() then CefBrowser::IsValid() will return false for |browser|.