Add ProxyController support for Windows (WebView2)#2806
Open
StarProxima wants to merge 9 commits into
Open
Conversation
Для работы через git submodule - все sub-packages ссылаются на локальный flutter_inappwebview_platform_interface вместо pub.dev.
…erface WindowsPlatform добавлен в @SupportedPlatforms для ProxyController, ProxySettings, setProxyOverride, clearProxyOverride, bypassRules, proxyRules. Обновлён .g.dart с TargetPlatform.windows в isClassSupported/isMethodSupported.
ProxyManager хранит proxy settings из Dart method channel и инжектит --proxy-server/--proxy-bypass-list в WebView2 additionalBrowserArguments при создании environment. Поддерживает per-scheme прокси и bypass rules.
WindowsProxyController с MethodChannel bridge, зарегистрирован в WindowsInAppWebViewPlatform. Убрана заглушка _PlatformProxyController.
…Manager InAppWebView без явного webViewEnvironment создавал env напрямую через CreateCoreWebView2EnvironmentWithOptions(nullptr, nullptr, nullptr), минуя WebViewEnvironment::create() где живёт proxy injection. Теперь fallback идёт через createOrGetDefaultWebViewEnvironment().
9 тестов: method channel вызовы (setProxyOverride, clearProxyOverride), ProxySettings toMap/fromMap roundtrip, isClassSupported для всех платформ.
- proxy_manager.cpp: добавлены #include <algorithm> и <cctype> для std::transform/std::tolower - in_app_webview.cpp: добавлен #include webview_environment_manager.h для доступа к createOrGetDefaultWebViewEnvironment()
Pass the plugin into the shared WebViewEnvironment factory so Windows webviews can reuse the proxy-aware default environment without breaking compilation. Made-with: Cursor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2805
Summary
Adds
ProxyControllerimplementation for Windows using WebView2's--proxy-serverbrowser argument.Changes:
ProxyManager(proxy_manager.h/.cpp) — handlessetProxyOverride/clearProxyOverridemethod channel calls, convertsProxySettingsto--proxy-serverand--proxy-bypass-listargsWebViewEnvironment::create()— proxy args are appended toadditionalBrowserArgumentswhen creating the WebView2 environmentin_app_webview.cpp) — fallback from rawCreateCoreWebView2EnvironmentWithOptions(nullptr, nullptr, nullptr)toWebViewEnvironmentManager::createOrGetDefaultWebViewEnvironment()so proxy args are picked upWindowsProxyController— extendsPlatformProxyControllerwith MethodChannel bridge, registered inWindowsInAppWebViewPlatformWindowsPlatformadded to@SupportedPlatformsfor ProxyController, ProxySettings, and related methods/propertiespath:dependencies forflutter_inappwebview_platform_interfaceLimitations
setProxyOverride()must be called before WebView creationTest plan
WindowsProxyController(9 tests: method channel calls, ProxySettings roundtrip, isClassSupported)