Add ProxyController support for Windows (WebView2)
## Description
ProxyController is currently implemented for Android, iOS 17+, macOS 14+, and Linux, but **Windows is missing**. On Windows, `ProxyController.setProxyOverride()` throws `UnimplementedError`.
## Proposed Solution
WebView2 supports proxy via `--proxy-server` and `--proxy-bypass-list` browser arguments passed through `additionalBrowserArguments` in `ICoreWebView2EnvironmentOptions`.
The implementation:
1. **Native C++ `ProxyManager`** — listens on method channel `com.pichillilorenzo/flutter_inappwebview_proxycontroller`, stores proxy settings, and injects `--proxy-server`/`--proxy-bypass-list` into `CoreWebView2EnvironmentOptions` when `WebViewEnvironment::create()` is called.
2. **Dart `WindowsProxyController`** — extends `PlatformProxyController` with `ChannelController` mixin, registered in `WindowsInAppWebViewPlatform`.
3. **Default environment routing** — `InAppWebView.createInAppWebViewEnv()` fallback changed from raw `CreateCoreWebView2EnvironmentWithOptions(nullptr, nullptr, nullptr, ...)` to `WebViewEnvironmentManager::createOrGetDefaultWebViewEnvironment()`, so proxy args are picked up even when no explicit `WebViewEnvironment` is passed.
4. **Platform Interface** — `WindowsPlatform` added to `@SupportedPlatforms` annotations for `ProxyController`, `ProxySettings`, `setProxyOverride`, `clearProxyOverride`, `bypassRules`, and `proxyRules`.
## Limitations
- Proxy is set via browser arguments at environment creation time. It cannot be changed at runtime for an already-created WebView2 environment (WebView2 limitation).
- `setProxyOverride()` must be called **before** the WebView is created.
## Platform Support After This Change
| Platform | Status | API |
|----------|--------|-----|
| Android | ✅ | `androidx.webkit.ProxyController` |
| iOS 17+ | ✅ | `WKWebsiteDataStore.proxyConfigurations` |
| macOS 14+ | ✅ | `WKWebsiteDataStore.proxyConfigurations` |
| Linux | ✅ | `WebKitNetworkProxySettings` |
| **Windows** | **✅ (new)** | `WebView2 --proxy-server` |
I have a working implementation ready and will open a PR.
0 条评论