// Copyright © 2010-2014 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 { public interface IRequestHandler { /// /// Called before browser navigation. /// If the navigation is allowed and /// will be called. If the navigation is canceled will be called with an ErrorCode /// value of . /// /// the browser object /// the request object - cannot be modified in this callback /// has the request been redirected /// whether the request comes from main frame or not /// Return true to cancel the navigation or false to allow the navigation to proceed. bool OnBeforeBrowse(IWebBrowser browser, IRequest request, bool isRedirect, bool isMainFrame); /// /// Called when a certificate error is thrown. /// /// the browser object /// the error code for this invalid certificate /// the url of the request for the invalid certificate /// Return true to allow the invalid certificate and continue the request. bool OnCertificateError(IWebBrowser browser, CefErrorCode errorCode, string requestUrl); /// /// Called when a plugin has crashed /// /// the browser object /// path of the plugin that crashed void OnPluginCrashed(IWebBrowser browser, string pluginPath); /// /// Called before a resource request is loaded. /// /// the browser object /// the request object - can be modified in this callback. /// whether the request comes from main frame or not /// /// The async features of this method are not currently exposed /// as such returning should be avoided. /// /// To cancel loading of the resource return /// or to allow the resource to load normally. CefReturnValue OnBeforeResourceLoad(IWebBrowser browser, IRequest request, bool isMainFrame); /// /// Called when the browser needs credentials from the user. /// /// the browser object /// indicates whether the host is a proxy server /// hostname /// port number /// realm /// scheme /// requested username /// requested password /// Return true to continue the request and call CefAuthCallback::Continue() when the authentication information is available. Return false to cancel the request. bool GetAuthCredentials(IWebBrowser browser, bool isProxy, string host, int port, string realm, string scheme, ref string username, ref string password); /// /// Called on the browser process IO thread before a plugin is loaded. /// /// the browser object /// URL /// policy URL /// plugin information /// Return true to block loading of the plugin. bool OnBeforePluginLoad(IWebBrowser browser, string url, string policyUrl, WebPluginInfo info); /// /// Called when the render process terminates unexpectedly. /// /// the browser object /// indicates how the process terminated. void OnRenderProcessTerminated(IWebBrowser browser, CefTerminationStatus status); } }