private @NotNull CefBrowser createOsrBrowser(@NotNull JBCefOSRHandlerFactory factory,
                                                             @NotNull CefClient client,
                                                             @Nullable String url,
                                                             @Nullable CefRequestContext context,
                                                             // not-null parentBrowser creates a DevTools browser for it
                                                             @Nullable CefBrowser parentBrowser,
                                                             @Nullable Point inspectAt,
                                                             boolean isMouseWheelEventEnabled,
                                                             CefBrowserSettings settings) {
    JComponent comp = factory.createComponent(isMouseWheelEventEnabled);
    CefRenderHandler handler = factory.createCefRenderHandler(comp);
    if (IS_REMOTE_ENABLED) {
      CefBrowser browser = client.createBrowser(validateUrl(url), new CefRendering.CefRenderingWithHandler(handler, comp), true/*unused*/, context);
      if (comp instanceof JBCefOsrComponent)
        ((JBCefOsrComponent)comp).setBrowser(browser);
      return browser;
    }

    CefBrowserOsrWithHandler browser =
      new CefBrowserOsrWithHandler(client, validateUrl(url), context, handler, comp, parentBrowser, inspectAt, settings) {
        @Override
        protected CefBrowser createDevToolsBrowser(CefClient client,
                                                   String url,
                                                   CefRequestContext context,
                                                   CefBrowser parent,
                                                   Point inspectAt) {
          return createOsrBrowser(factory, client, getUrl(), getRequestContext(), this, inspectAt, isMouseWheelEventEnabled);
        }
      };
    if (comp instanceof JBCefOsrComponent) ((JBCefOsrComponent)comp).setBrowser(browser);
    return browser;
  }
private @NotNull CefBrowser createOsrBrowser(@NotNull JBCefOSRHandlerFactory factory,
                                                             @NotNull CefClient client,
                                                             @Nullable String url,
                                                             @Nullable CefRequestContext context,
                                                             // not-null parentBrowser creates a DevTools browser for it
                                                             @Nullable CefBrowser parentBrowser,
                                                             @Nullable Point inspectAt,
                                                             boolean isMouseWheelEventEnabled,
                                                             CefBrowserSettings settings)