Integrated Browser (#278677)

* [WIP] Integrated Browser

* clean

* refactor

* structure

* focus

* tooltips

* rename

* polish

* start unpinned

* More polish

* commands

* tweaks, new tab support

* clean

* shortcut fixes

* warnings

* Update src/vs/workbench/contrib/browserView/electron-browser/browserEditor.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Telemetry

* load errors

* PR feedback

* PR feedback

* Permissions, unloads, trust

* Storage controls

* Handle render process gone

* devtools

* Screenshot rect

* close

* Fix focused context

* Fix merge

* disposables

* 💄

* Multi-window improvements

* Fix reopen

* PR feedback

* Actions fixes

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Benjamin Pasero <benjamin.pasero@gmail.com>
Co-authored-by: Benjamin Pasero <benjamin.pasero@microsoft.com>
This commit is contained in:
Kyle Cutler
2026-01-08 09:25:34 -08:00
committed by GitHub
parent 2240dcfdcd
commit f85cf0ad0c
17 changed files with 2903 additions and 2 deletions

View File

@@ -36,6 +36,8 @@ import { DialogMainService, IDialogMainService } from '../../platform/dialogs/el
import { IEncryptionMainService } from '../../platform/encryption/common/encryptionService.js';
import { EncryptionMainService } from '../../platform/encryption/electron-main/encryptionMainService.js';
import { NativeBrowserElementsMainService, INativeBrowserElementsMainService } from '../../platform/browserElements/electron-main/nativeBrowserElementsMainService.js';
import { ipcBrowserViewChannelName } from '../../platform/browserView/common/browserView.js';
import { BrowserViewMainService, IBrowserViewMainService } from '../../platform/browserView/electron-main/browserViewMainService.js';
import { NativeParsedArgs } from '../../platform/environment/common/argv.js';
import { IEnvironmentMainService } from '../../platform/environment/electron-main/environmentMainService.js';
import { isLaunchedFromCli } from '../../platform/environment/node/argvHelper.js';
@@ -411,11 +413,15 @@ export class CodeApplication extends Disposable {
this.auxiliaryWindowsMainService?.registerWindow(contents);
}
// Block any in-page navigation
// Handle any in-page navigation
contents.on('will-navigate', event => {
if (BrowserViewMainService.isBrowserViewWebContents(contents)) {
return; // Allow navigation in integrated browser views
}
this.logService.error('webContents#will-navigate: Prevented webcontent navigation');
event.preventDefault();
event.preventDefault(); // Prevent any in-page navigation
});
// All Windows: only allow about:blank auxiliary windows to open
@@ -1021,6 +1027,9 @@ export class CodeApplication extends Disposable {
// Browser Elements
services.set(INativeBrowserElementsMainService, new SyncDescriptor(NativeBrowserElementsMainService, undefined, false /* proxied to other processes */));
// Browser View
services.set(IBrowserViewMainService, new SyncDescriptor(BrowserViewMainService, undefined, false /* proxied to other processes */));
// Keyboard Layout
services.set(IKeyboardLayoutMainService, new SyncDescriptor(KeyboardLayoutMainService));
@@ -1168,6 +1177,10 @@ export class CodeApplication extends Disposable {
mainProcessElectronServer.registerChannel('browserElements', browserElementsChannel);
sharedProcessClient.then(client => client.registerChannel('browserElements', browserElementsChannel));
// Browser View
const browserViewChannel = ProxyChannel.fromService(accessor.get(IBrowserViewMainService), disposables);
mainProcessElectronServer.registerChannel(ipcBrowserViewChannelName, browserViewChannel);
// Signing
const signChannel = ProxyChannel.fromService(accessor.get(ISignService), disposables);
mainProcessElectronServer.registerChannel('sign', signChannel);