Files
openide/platform/ui.jcef/jcef/JBCefOSRHandlerFactoryImpl.java
Daniil Ovchinnikov 36b34c4e18 extract intellij.platform.ui.jcef module
GitOrigin-RevId: 560932e829c0bbf85d51b22a80963a978cf89553
2024-09-03 17:43:45 +00:00

26 lines
899 B
Java

// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.ui.jcef;
import org.cef.handler.CefRenderHandler;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
public class JBCefOSRHandlerFactoryImpl implements JBCefOSRHandlerFactory {
@Override
@NotNull
public JComponent createComponent(boolean isMouseWheelEventEnabled) {
return new JBCefOsrComponent(isMouseWheelEventEnabled);
}
@Override
public @NotNull CefRenderHandler createCefRenderHandler(@NotNull JComponent component) {
assert component instanceof JBCefOsrComponent;
JBCefOsrComponent osrComponent = (JBCefOsrComponent)component;
JBCefOsrHandler handler = JBCefApp.isRemoteEnabled() ? new JBCefNativeOsrHandler() : new JBCefOsrHandler();
osrComponent.setRenderHandler(handler);
return handler;
}
}