feat: replace BrowserView with WebContentsView (#35658)

This commit is contained in:
Jeremy Rose 2023-12-13 13:01:03 -08:00 committed by GitHub
parent a94fb2cb5d
commit 15c6014324
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
76 changed files with 2987 additions and 1531 deletions

View file

@ -41,6 +41,13 @@ declare namespace Electron {
frameName: string;
on(event: '-touch-bar-interaction', listener: (event: Event, itemID: string, details: any) => void): this;
removeListener(event: '-touch-bar-interaction', listener: (event: Event, itemID: string, details: any) => void): this;
_browserViews: BrowserView[];
}
interface BrowserView {
ownerWindow: BrowserWindow | null
webContentsView: WebContentsView
}
interface BrowserWindowConstructorOptions {
@ -87,6 +94,7 @@ declare namespace Electron {
detachFromOuterFrame(): void;
setEmbedder(embedder: Electron.WebContents): void;
viewInstanceId: number;
_setOwnerWindow(w: BaseWindow | null): void;
}
interface WebFrameMain {
@ -155,21 +163,6 @@ declare namespace Electron {
_replyChannel: ReplyChannel;
}
class View {}
// Experimental views API
class BaseWindow {
constructor(args: {show: boolean})
setContentView(view: View): void
static fromId(id: number): BaseWindow;
static getAllWindows(): BaseWindow[];
isFocused(): boolean;
static getFocusedWindow(): BaseWindow | undefined;
setMenu(menu: Menu): void;
}
class WebContentsView {
constructor(options: BrowserWindowConstructorOptions)
}
// Deprecated / undocumented BrowserWindow methods
interface BrowserWindow {
@ -191,12 +184,6 @@ declare namespace Electron {
registerProtocol(scheme: string, handler: any): boolean;
interceptProtocol(scheme: string, handler: any): boolean;
}
namespace Main {
class BaseWindow extends Electron.BaseWindow {}
class View extends Electron.View {}
class WebContentsView extends Electron.WebContentsView {}
}
}
declare namespace ElectronInternal {