Skip to content

Commit aeeb6ae

Browse files
authored
Add JCEF browser (#6787)
We want to add this as an option for users who are experiencing problems with the embedded DevTools window, e.g. #6759. I'm not sure if the JCEF browser will be better for cases that are causing problems in the JxBrowser implementation, but I figure we want to start gathering info on how JCEF performs anyway if we want to eventually move away from JxBrowser and its file downloads. @AlexV525 I've reorganized the management of multiple browsers and content, something you introduced in #6772. I pointed out one spot where I'm not sure if my change will work as expected; if you have a chance, please look over/test and let me know.
1 parent 246f1e0 commit aeeb6ae

18 files changed

+512
-290
lines changed

flutter-idea/src/io/flutter/FlutterBundle.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,8 @@ settings.allow.tests.tooltip=The directory must be marked as a sources root, suc
213213
settings.font.packages=Font Packages
214214
settings.show.all.configs=Show all possible run configurations for apps or tests, even if a created configuration already exists
215215
settings.show.all.configs.tooltip=If there is a defined run configuration to watch a specific test and one to just run it, show both.
216+
settings.jcef.browser=Use JCEF browser to show embedded DevTools
217+
settings.jcef.browser.tooltip=JCEF is a browser included in IntelliJ that is an alternative to using JxBrowser for showing embedded DevTools.
216218
settings.enable.androi.gradle.sync.tooltip=Provides advanced editing capabilities for Java and Kotlin code. Uses Gradle to find Android libraries then links them into the Flutter project.
217219
settings.experiments=Experiments
218220
settings.editor=Editor

flutter-idea/src/io/flutter/FlutterUtils.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,15 @@
3636
import com.intellij.util.PlatformUtils;
3737
import com.jetbrains.lang.dart.DartFileType;
3838
import com.jetbrains.lang.dart.psi.DartFile;
39+
import io.flutter.jxbrowser.EmbeddedJxBrowser;
40+
import io.flutter.jxbrowser.JxBrowserStatus;
3941
import io.flutter.pub.PubRoot;
4042
import io.flutter.pub.PubRootCache;
4143
import io.flutter.settings.FlutterSettings;
4244
import io.flutter.utils.AndroidUtils;
4345
import io.flutter.utils.FlutterModuleUtils;
46+
import io.flutter.view.EmbeddedBrowser;
47+
import io.flutter.view.EmbeddedJcefBrowser;
4448
import org.jetbrains.annotations.NotNull;
4549
import org.jetbrains.annotations.Nullable;
4650
import org.jetbrains.annotations.SystemIndependent;
@@ -622,4 +626,18 @@ private static ModuleSourceOrderEntry findModuleSourceEntry(@NotNull Module modu
622626
}
623627
return null;
624628
}
629+
630+
@Nullable
631+
public static EmbeddedBrowser embeddedBrowser(Project project) {
632+
if (project == null || project.isDisposed()) {
633+
return null;
634+
}
635+
636+
return FlutterSettings.getInstance().isEnableJcefBrowser() ? EmbeddedJcefBrowser.getInstance(project) : EmbeddedJxBrowser.getInstance(project);
637+
}
638+
639+
public static boolean embeddedBrowserAvailable(JxBrowserStatus status) {
640+
return status.equals(JxBrowserStatus.INSTALLED) || status.equals(JxBrowserStatus.INSTALLATION_SKIPPED) && FlutterSettings.getInstance()
641+
.isEnableJcefBrowser();
642+
}
625643
}

flutter-idea/src/io/flutter/jxbrowser/EmbeddedBrowser.java

Lines changed: 0 additions & 269 deletions
This file was deleted.

0 commit comments

Comments
 (0)