JBCefClient (@NotNull CefRequestHandler handler, @NotNull CefBrowser browser) { return myRequestHandler.add(handler, browser, () -> { myCefClient.addRequestHandler(new CefRequestHandler() { @Override public boolean onBeforeBrowse(CefBrowser browser, CefFrame frame, CefRequest request, boolean user_gesture, boolean is_redirect) { return myRequestHandler.handleBoolean(browser, handler -> { return handler.onBeforeBrowse(browser, frame, request, user_gesture, is_redirect); }); } @Override public boolean onOpenURLFromTab(CefBrowser browser, CefFrame frame, String target_url, boolean user_gesture) { return myRequestHandler.handleBoolean(browser, handler -> { return handler.onOpenURLFromTab(browser, frame, target_url, user_gesture); }); } @Override public @Nullable CefResourceRequestHandler getResourceRequestHandler(CefBrowser browser, CefFrame frame, CefRequest request, boolean isNavigation, boolean isDownload, String requestInitiator, BoolRef disableDefaultHandling) { return myRequestHandler.handle(browser, handler -> { return handler.getResourceRequestHandler(browser, frame, request, isNavigation, isDownload, requestInitiator, disableDefaultHandling); }); } @Override public boolean getAuthCredentials(CefBrowser browser, String origin_url, boolean isProxy, String host, int port, String realm, String scheme, CefAuthCallback callback) { return myRequestHandler.handleBoolean(browser, handler -> { return handler.getAuthCredentials(browser, origin_url, isProxy, host, port, realm, scheme, callback); }); } @Override public boolean onCertificateError(CefBrowser browser, CefLoadHandler.ErrorCode cert_error, String request_url, CefSSLInfo sslInfo, CefCallback callback) { List<CefRequestHandler> handlers = myRequestHandler.get(browser); if (handlers == null) { return false; } boolean result = false; for (CefRequestHandler handler: handlers) { result |= handler.onCertificateError(browser, cert_error, request_url, sslInfo, callback); } return result; } @Override public void onRenderProcessTerminated(CefBrowser browser, TerminationStatus status) { myRequestHandler.handle(browser, handler -> { handler.onRenderProcessTerminated(browser, status); }); } }); }); }