// Copyright © 2021 The CefSharp Authors. All rights reserved. // // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. namespace CefSharp { /// /// Implement this interface to handle frame events /// All methods will be called on the CEF UI thread /// public interface IFrameHandler { /// /// Called when a frame can begin routing commands to/from the associated /// renderer process. Any commands that were queued have now been dispatched. /// /// the ChromiumWebBrowser control /// the browser object /// the frame object /// will be true if the frame was re-attached after exiting the BackForwardCache. void OnFrameAttached(IWebBrowser chromiumWebBrowser, IBrowser browser, IFrame frame, bool reattached); /// /// Called when a new frame is created. This will be the first notification /// that references . Any commands that require transport to the /// associated renderer process (LoadRequest, SendProcessMessage, GetSource, /// etc.) will be queued until OnFrameAttached is called for . /// /// the ChromiumWebBrowser control /// the browser object /// the frame object void OnFrameCreated(IWebBrowser chromiumWebBrowser, IBrowser browser, IFrame frame); /// /// Called when a frame loses its connection to the renderer process and will /// be destroyed. Any pending or future commands will be discarded and /// will now return false for . If called after /// during browser destruction then /// will return false for . /// /// the ChromiumWebBrowser control /// the browser object /// the frame object void OnFrameDetached(IWebBrowser chromiumWebBrowser, IBrowser browser, IFrame frame); /// /// Called when the main frame changes due to one of the following: /// - (a) initial browser creation /// - (b) final browser destruction /// - (c) cross-origin navigation /// - (d) re-navigation after renderer process termination (due to crashes, etc). /// /// will be null and will be non-null when a main frame is assigned /// to for the first time. /// will be non-null and will be null when a main frame is /// removed from for the last time. /// Both and will be non-nullfor cross-origin /// navigations or re-navigation after renderer process termination. /// This method will be called after for and/or after /// for . If called after /// during browser destruction then /// will return false for . /// /// the ChromiumWebBrowser control /// the browser object /// the old frame object /// the new frame object void OnMainFrameChanged(IWebBrowser chromiumWebBrowser, IBrowser browser, IFrame oldFrame, IFrame newFrame); } }