#ifndef JCEF_REMOTEREQUESTHANDLER_H #define JCEF_REMOTEREQUESTHANDLER_H #include #include "include/cef_request_handler.h" class MessageRoutersManager; class ServerHandlerContext; class RemoteBrowser; class RemoteRequestHandler : public CefRequestHandler { public: explicit RemoteRequestHandler(std::shared_ptr ctx, std::shared_ptr routersManager); virtual ~RemoteRequestHandler(); // Called on the UI thread before browser navigation. bool OnBeforeBrowse(CefRefPtr browser, CefRefPtr frame, CefRefPtr request, bool user_gesture, bool is_redirect) override; // Called on the UI thread before OnBeforeBrowse in certain limited cases // where navigating a new or different browser might be desirable. bool OnOpenURLFromTab(CefRefPtr browser, CefRefPtr frame, const CefString& target_url, WindowOpenDisposition target_disposition, bool user_gesture) override; // Called on the browser process IO thread before a resource request is // initiated. CefRefPtr GetResourceRequestHandler( CefRefPtr browser, CefRefPtr frame, CefRefPtr request, bool is_navigation, bool is_download, const CefString& request_initiator, bool& disable_default_handling) override; // Called on the IO thread when the browser needs credentials from the user. // |origin_url| is the origin making this authentication request. bool GetAuthCredentials(CefRefPtr browser, const CefString& origin_url, bool isProxy, const CefString& host, int port, const CefString& realm, const CefString& scheme, CefRefPtr callback) override; // Called on the UI thread to handle requests for URLs with an invalid // SSL certificate. bool OnCertificateError(CefRefPtr browser, cef_errorcode_t cert_error, const CefString& request_url, CefRefPtr ssl_info, CefRefPtr callback) override; // Called on the browser process UI thread when the render process // terminates unexpectedly. void OnRenderProcessTerminated(CefRefPtr browser, TerminationStatus status, int error_code, const CefString& error_string) override; private: const std::shared_ptr myCtx; const std::shared_ptr myRoutersManager; std::set myCallbacks; std::set myAuthCallbacks; IMPLEMENT_REFCOUNTING(RemoteRequestHandler); }; #endif // JCEF_REMOTEREQUESTHANDLER_H