/// <summary> /// Called to allow custom display of the context menu. |params| provides /// information about the context menu state. |model| contains the context menu /// model resulting from OnBeforeContextMenu. For custom display return true /// and execute |callback| either synchronously or asynchronously with the /// selected command ID. For default display return false. Do not keep /// references to |params| or |model| outside of this callback. /// </summary> protected virtual bool RunContextMenu(CefBrowser browser, CefFrame frame, CefContextMenuParams parameters, CefMenuModel model, CefRunContextMenuCallback callback) { return(false); }
/// <summary> /// Called to execute a command selected from the context menu. Return true if /// the command was handled or false for the default implementation. See /// cef_menu_id_t for the command ids that have default implementations. All /// user-defined command ids should be between MENU_ID_USER_FIRST and /// MENU_ID_USER_LAST. |params| will have the same values as what was passed to /// OnBeforeContextMenu(). Do not keep a reference to |params| outside of this /// callback. /// </summary> protected virtual bool OnContextMenuCommand(CefBrowser browser, CefFrame frame, CefContextMenuParams state, int commandId, CefEventFlags eventFlags) { return(false); }
/// <summary> /// Called when the context menu is dismissed irregardless of whether the menu /// was empty or a command was selected. /// </summary> protected virtual void OnContextMenuDismissed(CefBrowser browser, CefFrame frame) { }
/// <summary> /// Called before a context menu is displayed. |params| provides information /// about the context menu state. |model| initially contains the default /// context menu. The |model| can be cleared to show no context menu or /// modified to show a custom menu. Do not keep references to |params| or /// |model| outside of this callback. /// </summary> protected virtual void OnBeforeContextMenu(CefBrowser browser, CefFrame frame, CefContextMenuParams state, CefMenuModel model) { }
/// <summary> /// Called on the IO thread before a resource is loaded. To allow the resource /// to load normally return NULL. To specify a handler for the resource return /// a CefResourceHandler object. The |request| object should not be modified in /// this callback. /// </summary> protected virtual CefResourceHandler GetResourceHandler(CefBrowser browser, CefFrame frame, CefRequest request) { return(null); }
/// <summary> /// Return a new resource handler instance to handle the request or an empty /// reference to allow default handling of the request. |browser| and |frame| /// will be the browser window and frame respectively that originated the /// request or NULL if the request did not originate from a browser window /// (for example, if the request came from CefURLRequest). The |request| object /// passed to this method will not contain cookie data. /// </summary> protected abstract CefResourceHandler Create(CefBrowser browser, CefFrame frame, string schemeName, CefRequest request);
/// <summary> /// Called on the UI thread before browser navigation. Return true to cancel /// the navigation or false to allow the navigation to proceed. The |request| /// object cannot be modified in this callback. /// CefLoadHandler::OnLoadingStateChange will be called twice in all cases. /// If the navigation is allowed CefLoadHandler::OnLoadStart and /// CefLoadHandler::OnLoadEnd will be called. If the navigation is canceled /// CefLoadHandler::OnLoadError will be called with an |errorCode| value of /// ERR_ABORTED. /// </summary> protected virtual bool OnBeforeBrowse(CefBrowser browser, CefFrame frame, CefRequest request, bool isRedirect) { return(false); }
/// <summary> /// Returns the focused frame for the browser window. /// </summary> public CefFrame GetFocusedFrame() { return(CefFrame.FromNative( cef_browser_t.get_focused_frame(_self) )); }
/// <summary> /// Called on the IO thread when a resource load has completed. |request| and /// |response| represent the request and response respectively and cannot be /// modified in this callback. |status| indicates the load completion status. /// |received_content_length| is the number of response bytes actually read. /// </summary> protected virtual void OnResourceLoadComplete(CefBrowser browser, CefFrame frame, CefRequest request, CefResponse response, CefUrlRequestStatus status, long receivedContentLength) { }
/// <summary> /// Called on the IO thread when the browser needs credentials from the user. /// |isProxy| indicates whether the host is a proxy server. |host| contains the /// hostname and |port| contains the port number. |realm| is the realm of the /// challenge and may be empty. |scheme| is the authentication scheme used, /// such as "basic" or "digest", and will be empty if the source of the request /// is an FTP server. Return true to continue the request and call /// CefAuthCallback::Continue() either in this method or at a later time when /// the authentication information is available. Return false to cancel the /// request immediately. /// </summary> protected virtual bool GetAuthCredentials(CefBrowser browser, CefFrame frame, bool isProxy, string host, int port, string realm, string scheme, CefAuthCallback callback) { return(false); }
/// <summary> /// Called on the IO thread to optionally filter resource response content. /// |request| and |response| represent the request and response respectively /// and cannot be modified in this callback. /// </summary> protected virtual CefResponseFilter GetResourceResponseFilter(CefBrowser browser, CefFrame frame, CefRequest request, CefResponse response) { return(null); }
/// <summary> /// Called on the IO thread when a resource response is received. To allow the /// resource to load normally return false. To redirect or retry the resource /// modify |request| (url, headers or post body) and return true. The /// |response| object cannot be modified in this callback. /// </summary> protected virtual bool OnResourceResponse(CefBrowser browser, CefFrame frame, CefRequest request, CefResponse response) { return(false); }
/// <summary> /// Called on the IO thread when a resource load is redirected. The |request| /// parameter will contain the old URL and other request-related information. /// The |new_url| parameter will contain the new URL and can be changed if /// desired. The |request| object cannot be modified in this callback. /// </summary> protected virtual void OnResourceRedirect(CefBrowser browser, CefFrame frame, CefRequest request, ref string newUrl) { }
/// <summary> /// Called when a frame's address has changed. /// </summary> protected virtual void OnAddressChange(CefBrowser browser, CefFrame frame, string url) { }
/// <summary> /// Called on the UI thread before OnBeforeBrowse in certain limited cases /// where navigating a new or different browser might be desirable. This /// includes user-initiated navigation that might open in a special way (e.g. /// links clicked via middle-click or ctrl + left-click) and certain types of /// cross-origin navigation initiated from the renderer process (e.g. /// navigating the top-level frame to/from a file URL). The |browser| and /// |frame| values represent the source of the navigation. The /// |target_disposition| value indicates where the user intended to navigate /// the browser based on standard Chromium behaviors (e.g. current tab, /// new tab, etc). The |user_gesture| value will be true if the browser /// navigated via explicit user gesture (e.g. clicking a link) or false if it /// navigated automatically (e.g. via the DomContentLoaded event). Return true /// to cancel the navigation or false to allow the navigation to proceed in the /// source browser's top-level frame. /// </summary> protected virtual bool OnOpenUrlFromTab(CefBrowser browser, CefFrame frame, string targetUrl, CefWindowOpenDisposition targetDisposition, bool userGesture) { return(false); }
/// <summary> /// Returns the main (top-level) frame for the browser window. /// </summary> public CefFrame GetMainFrame() { return(CefFrame.FromNative( cef_browser_t.get_main_frame(_self) )); }
/// <summary> /// Called on the IO thread before a new popup browser is created. The /// |browser| and |frame| values represent the source of the popup request. The /// |target_url| and |target_frame_name| values indicate where the popup /// browser should navigate and may be empty if not specified with the request. /// The |target_disposition| value indicates where the user intended to open /// the popup (e.g. current tab, new tab, etc). The |user_gesture| value will /// be true if the popup was opened via explicit user gesture (e.g. clicking a /// link) or false if the popup opened automatically (e.g. via the /// DomContentLoaded event). The |popupFeatures| structure contains additional /// information about the requested popup window. To allow creation of the /// popup browser optionally modify |windowInfo|, |client|, |settings| and /// |no_javascript_access| and return false. To cancel creation of the popup /// browser return true. The |client| and |settings| values will default to the /// source browser's values. If the |no_javascript_access| value is set to /// false the new browser will not be scriptable and may not be hosted in the /// same renderer process as the source browser. /// </summary> protected virtual bool OnBeforePopup(CefBrowser browser, CefFrame frame, string targetUrl, string targetFrameName, CefWindowOpenDisposition targetDisposition, bool userGesture, CefPopupFeatures popupFeatures, CefWindowInfo windowInfo, ref CefClient client, CefBrowserSettings settings, ref bool noJavascriptAccess) { return(false); }
/// <summary> /// Returns the frame with the specified identifier, or NULL if not found. /// </summary> public CefFrame GetFrame(long identifier) { return(CefFrame.FromNativeOrNull( cef_browser_t.get_frame_byident(_self, identifier) )); }
/// <summary> /// Called on the IO thread before a resource request is loaded. The |request| /// object may be modified. Return RV_CONTINUE to continue the request /// immediately. Return RV_CONTINUE_ASYNC and call CefRequestCallback:: /// Continue() at a later time to continue or cancel the request /// asynchronously. Return RV_CANCEL to cancel the request immediately. /// </summary> protected virtual CefReturnValue OnBeforeResourceLoad(CefBrowser browser, CefFrame frame, CefRequest request, CefRequestCallback callback) { return(CefReturnValue.Continue); }