Skip to content

platform/electron/browser-window

Defined in: app/src/platform/electron/browser-window.ts:191

One browser window: a BaseWindow with the shell view and one WebContentsView per tab. Tab views are created when a tab opens and destroyed when it closes; only the active tab’s view is attached to the window. Web pages and internal pages use views of different sessions: when a tab switches between them, its view is replaced and the old view’s history is kept for Back and Forward.

new BrowserWindowController(options, place?): BrowserWindowController

Defined in: app/src/platform/electron/browser-window.ts:224

BrowserWindowOptions

Environment of the window.

WindowPlace = {}

BrowserWindowController

readonly isPrivate: boolean

Defined in: app/src/platform/electron/browser-window.ts:215

Whether the window is a private window.

overlay: OverlayHandle | undefined

Defined in: app/src/platform/electron/browser-window.ts:197

The overlay while it shows something; a change of the visible tab closes it.

readonly popup: boolean

Defined in: app/src/platform/electron/browser-window.ts:213

Whether the window is a popup that a page opened.

readonly shell: WebContentsView

Defined in: app/src/platform/electron/browser-window.ts:193

readonly tabs: TabService

Defined in: app/src/platform/electron/browser-window.ts:194

readonly window: BaseWindow

Defined in: app/src/platform/electron/browser-window.ts:192

get activeTabContents(): WebContents | undefined

Defined in: app/src/platform/electron/browser-window.ts:306

The WebContents of the active tab, if any.

WebContents | undefined

get closing(): boolean

Defined in: app/src/platform/electron/browser-window.ts:296

Whether the window closes: a window that closes right after it opened hides first.

boolean

get shellContents(): WebContents

Defined in: app/src/platform/electron/browser-window.ts:301

The shell’s WebContents.

WebContents

adopt(contents, url, activate): string

Defined in: app/src/platform/electron/browser-window.ts:407

Shows the page that a script of another page opened in a new tab, which keeps that page as its opener.

WebContents

The new page, which Chromium made for the script.

string

The address it opens.

boolean

Whether the tab becomes the active one.

string

The tab.

countBlocked(contentsId): boolean

Defined in: app/src/platform/electron/browser-window.ts:349

Counts a request that the content blocker blocked, if it belongs to one of this window’s tabs.

number

Id of the web contents that made the request.

boolean

Whether the request belonged to this window.

create(id, url, lazy?): void

Defined in: app/src/platform/electron/browser-window.ts:382

Creates the view of a tab and loads the URL. A lazy tab gets its view only when it is shown, so restored tabs cost nothing until they are used.

string

string

boolean = false

void

TabViewPort.create

destroy(id): void

Defined in: app/src/platform/electron/browser-window.ts:489

Destroys the view of a tab.

string

void

TabViewPort.destroy

dispose(): void

Defined in: app/src/platform/electron/browser-window.ts:561

Closes the window and every tab view.

void

Disposable.dispose

execute(command): void

Defined in: app/src/platform/electron/browser-window.ts:577

Runs a window command, such as opening a tab.

WindowCommand

The command.

void

find(id, query, forward, next): void

Defined in: app/src/platform/electron/browser-window.ts:693

Looks for text in a tab’s page, or for its next or previous match.

string

The tab.

string

The text.

boolean

Whether to look forward.

boolean

Whether to go on from the current match.

void

focusContent(): void

Defined in: app/src/platform/electron/browser-window.ts:478

Focuses the visible tab, or the shell for the new tab page, where typing goes to the address bar.

void

load(id, url): void

Defined in: app/src/platform/electron/browser-window.ts:505

Loads a URL in a tab.

string

string

void

TabViewPort.load

openPage(page): void

Defined in: app/src/platform/electron/browser-window.ts:762

Shows an internal page: the tab that already shows it, or else the active tab if it shows the new tab page, or else a new tab.

"newtab" | "settings" | "setup" | "history" | "bookmarks"

The page.

void

ownsTab(contents): boolean

Defined in: app/src/platform/electron/browser-window.ts:370

Tells whether a WebContents is one of this window’s tab views.

WebContents

boolean

proceedUnsafely(id, accept): void

Defined in: app/src/platform/electron/browser-window.ts:447

Continues to a page whose certificate was refused, once the certificate is accepted.

string

The tab.

(contents) => boolean

Accepts the certificate that the page’s web contents were refused.

void

refreshShell(): void

Defined in: app/src/platform/electron/browser-window.ts:339

Sends the shell its state again, for example after the layout settings changed.

void

repaintBackground(): void

Defined in: app/src/platform/electron/browser-window.ts:548

Paints the window and the views of internal pages in the current light or dark mode.

void

run(id, action): void

Defined in: app/src/platform/electron/browser-window.ts:521

Runs a history or loading action.

string

"back" | "forward" | "reload" | "stop"

void

TabViewPort.run

setInsets(insets): void

Defined in: app/src/platform/electron/browser-window.ts:364

Updates the space the shell occupies.

Insets

New insets in CSS pixels.

void

show(id): void

Defined in: app/src/platform/electron/browser-window.ts:416

Shows the view of a tab and hides the previously shown one.

string

void

TabViewPort.show

state(): object

Defined in: app/src/platform/electron/browser-window.ts:312

The current shell state, as sent to the shell.

object

activeTabId: string | null

bookmarksBar: object[] | null

downloads: { active: number; progress: number | null; } | null

find: { active: number; matches: number; query: string; } | null

private: boolean

tabs: object[]

tabStrip: "left" | "top" | "bottom" | "right"

stopFind(id): void

Defined in: app/src/platform/electron/browser-window.ts:711

Closes the find bar and leaves the current match selected.

string

The tab.

void

tabIdOf(contents): string | undefined

Defined in: app/src/platform/electron/browser-window.ts:378

Finds the tab that a WebContents shows.

WebContents

A tab view’s WebContents.

string | undefined

zoom(id, direction): void

Defined in: app/src/platform/electron/browser-window.ts:726

Zooms a tab’s page in or out by one step, or back to 100 %. The zoom holds for the page’s site, in every tab, and is remembered for the next visit.

string

The tab.

-1 | 0 | 1

1 to zoom in, -1 to zoom out, 0 for 100 %.

void


Defined in: app/src/platform/electron/browser-window.ts:1136

Keeps track of open windows and routes shell requests to the right one.

new WindowManager(options): WindowManager

Defined in: app/src/platform/electron/browser-window.ts:1150

BrowserWindowOptions

Environment for new windows.

WindowManager

readonly onDidChange: Event<void>

Defined in: app/src/platform/electron/browser-window.ts:1143

Fires after windows opened or closed, or their tabs changed.

readonly onDidMove: Event<void>

Defined in: app/src/platform/electron/browser-window.ts:1146

Fires while a window moves or changes its size.

get all(): readonly BrowserWindowController[]

Defined in: app/src/platform/electron/browser-window.ts:1321

All open windows.

readonly BrowserWindowController[]

get lastUsed(): BrowserWindowController | undefined

Defined in: app/src/platform/electron/browser-window.ts:1288

The open window that had the focus last, or else the newest open window.

BrowserWindowController | undefined

countBlocked(contentsId): void

Defined in: app/src/platform/electron/browser-window.ts:1329

Counts a request that the content blocker blocked in the tab that made it.

number

Id of the web contents that made the request.

void

dispose(): void

Defined in: app/src/platform/electron/browser-window.ts:1350

Closes every window.

void

Disposable.dispose

forShell(sender): BrowserWindowController | undefined

Defined in: app/src/platform/electron/browser-window.ts:1308

Finds the window whose shell sent a request.

WebContents

The sending WebContents.

BrowserWindowController | undefined

forTab(contents): BrowserWindowController | undefined

Defined in: app/src/platform/electron/browser-window.ts:1316

Finds the window that shows a tab view.

WebContents

A tab’s WebContents.

BrowserWindowController | undefined

lastUsedOf(privateWindow): BrowserWindowController | undefined

Defined in: app/src/platform/electron/browser-window.ts:1298

The regular or the private window that had the focus last, or else the newest one; popups are left out, as their pages expect to be alone in them.

boolean

Whether to find a private window.

BrowserWindowController | undefined

open(url?, place?): BrowserWindowController

Defined in: app/src/platform/electron/browser-window.ts:1159

Opens a window with one tab.

string

What the tab shows; a new tab page without it.

WindowPlace

Where the window opens, and whether it is private.

BrowserWindowController

openPopup(contents, url, features, opener, privateWindow): BrowserWindowController

Defined in: app/src/platform/electron/browser-window.ts:1189

Opens a popup that a script of a page opened, where and as large as the page asked, with the new page, which keeps its opener.

WebContents

The new page.

string

The address it opens.

string

The features that the script asked for, such as its size.

BrowserWindowController | undefined

The window of the page that opened it.

boolean

Whether the page that opened it is in a private window.

BrowserWindowController

The popup.

openWith(contents, url, place?): BrowserWindowController

Defined in: app/src/platform/electron/browser-window.ts:1173

Opens a window whose only tab shows a page that a script of another page opened, which keeps its opener.

WebContents

The new page.

string

The address it opens.

WindowPlace = {}

Where the window opens.

BrowserWindowController

The window.

refreshShells(): void

Defined in: app/src/platform/electron/browser-window.ts:1336

Sends every shell its state again.

void

repaintBackgrounds(): void

Defined in: app/src/platform/electron/browser-window.ts:1343

Paints every window in the current light or dark mode.

void

restore(session): BrowserWindowController

Defined in: app/src/platform/electron/browser-window.ts:1214

Opens the windows of a stored session. Only the active tab of each window loads; the others load when they are shown.

The windows and their tabs.

1 = ...

object[] = ...

BrowserWindowController

The first window.

snapshot(): object

Defined in: app/src/platform/electron/browser-window.ts:1236

The tabs of every open window, as a session keeps them.

object

version: 1

windows: object[]

toDisposable(): Disposable

Defined in: app/src/platform/electron/browser-window.ts:1358

Returns a disposable that closes all windows.

Disposable

Defined in: app/src/platform/electron/browser-window.ts:65

Everything a window needs from its environment.

readonly appearanceArgument: () => string

Defined in: app/src/platform/electron/browser-window.ts:85

Command line argument that gives a view of the browser’s own UI its design tokens.

string

readonly backgroundColor: (privateWindow) => string

Defined in: app/src/platform/electron/browser-window.ts:83

Window background while the shell loads: for the light or dark mode, or a private window.

boolean

string

readonly blocking: (url) => Blocking

Defined in: app/src/platform/electron/browser-window.ts:91

Whether the content blocker works on a page: none for pages it never touches.

string

Blocking

readonly optional bookmarksBar?: () => object[] | null

Defined in: app/src/platform/electron/browser-window.ts:99

The items of the bookmarks bar, or null while the bar is hidden.

object[] | null

readonly optional certificateOverride?: () => boolean

Defined in: app/src/platform/electron/browser-window.ts:120

Whether people may continue to a site whose certificate is not trusted.

boolean

readonly optional downloads?: (privateWindow) => { active: number; progress: number | null; } | null

Defined in: app/src/platform/electron/browser-window.ts:103

How the downloads button of a regular or a private window looks, or null while it is hidden.

boolean

{ active: number; progress: number | null; } | null

readonly gate: IpcGate

Defined in: app/src/platform/electron/browser-window.ts:114

readonly internalPartition: string

Defined in: app/src/platform/electron/browser-window.ts:75

Partition of the browser’s own views.

readonly optional isBookmarked?: (url) => boolean

Defined in: app/src/platform/electron/browser-window.ts:95

Whether a page has a bookmark, for the star in the address bar.

string

boolean

readonly languageArguments: readonly string[]

Defined in: app/src/platform/electron/browser-window.ts:87

Command line arguments that give the views of the browser’s own UI their language.

readonly logger: Logger

Defined in: app/src/platform/electron/browser-window.ts:116

readonly newTabUrl: string

Defined in: app/src/platform/electron/browser-window.ts:81

URL of a new tab.

readonly optional onContextMenu?: (request) => void

Defined in: app/src/platform/electron/browser-window.ts:118

Shows the context menu of a view; without it, views have none.

ContextMenuRequest

void

readonly optional onFocus?: () => void

Defined in: app/src/platform/electron/browser-window.ts:113

Called when a window gets the focus.

void

readonly optional onPageCommand?: (window, command, contents) => void

Defined in: app/src/platform/electron/browser-window.ts:122

Prints, saves or shows the source of a web page, or opens its developer tools.

BrowserWindowController

PageCommand

WebContents

void

readonly optional onPrivateWindowsClosed?: () => void

Defined in: app/src/platform/electron/browser-window.ts:111

Called after the last private window closed, to forget what private windows kept.

void

readonly optional onUnresponsive?: (window, tabId, contents) => void

Defined in: app/src/platform/electron/browser-window.ts:132

Asks what to do about a web page that stopped responding to input.

BrowserWindowController

string

WebContents

void

readonly optional onVisit?: (url, title, titleOnly) => void

Defined in: app/src/platform/electron/browser-window.ts:93

Called when a tab shows a web page, and again when its title changes.

string

string

boolean

void

readonly optional onZoom?: (url, factor) => void

Defined in: app/src/platform/electron/browser-window.ts:130

Remembers the zoom factor of a site.

string

number

void

readonly optional openPrivateWindow?: () => void

Defined in: app/src/platform/electron/browser-window.ts:109

Opens a new private window, if people may.

void

readonly optional openWindow?: () => void

Defined in: app/src/platform/electron/browser-window.ts:107

Opens a new window.

void

readonly pagePreload: string

Defined in: app/src/platform/electron/browser-window.ts:73

Path of the preload script of internal pages in tabs.

readonly optional prepareInternalPage?: (page) => Promise<void> | undefined

Defined in: app/src/platform/electron/browser-window.ts:141

Gets the browser process ready for an internal page before the page loads, such as by loading the handlers of its channels; undefined when it is ready already.

"newtab" | "settings" | "setup" | "history" | "bookmarks"

Promise<void> | undefined

readonly privateSession: () => Session

Defined in: app/src/platform/electron/browser-window.ts:79

The session of web tabs in private windows, which keeps their data in memory.

Session

readonly router: IpcRouter

Defined in: app/src/platform/electron/browser-window.ts:115

readonly shellOrigin: string

Defined in: app/src/platform/electron/browser-window.ts:69

Origin the shell page must have.

readonly shellPreload: string

Defined in: app/src/platform/electron/browser-window.ts:71

Path of the shell’s preload script.

readonly shellUrl: string

Defined in: app/src/platform/electron/browser-window.ts:67

URL of the shell page, normally app://shell/.

readonly optional showDownloads?: (window) => void

Defined in: app/src/platform/electron/browser-window.ts:105

Shows the list of downloads of a window, at its button.

BrowserWindowController

void

readonly tabStripPosition: () => "left" | "top" | "bottom" | "right"

Defined in: app/src/platform/electron/browser-window.ts:89

Where the shell shows the tab strip.

"left" | "top" | "bottom" | "right"

readonly optional toggleBookmark?: (url, title) => void

Defined in: app/src/platform/electron/browser-window.ts:97

Adds a bookmark for a page, or removes its bookmarks.

string

string

void

readonly optional toggleBookmarksBar?: () => void

Defined in: app/src/platform/electron/browser-window.ts:101

Shows or hides the bookmarks bar.

void

readonly webPartition: string

Defined in: app/src/platform/electron/browser-window.ts:77

Partition of web tabs.

readonly optional zoomFor?: (url) => number | undefined

Defined in: app/src/platform/electron/browser-window.ts:128

The zoom factor that a site was left at, to give its pages again.

string

number | undefined


Defined in: app/src/platform/electron/browser-window.ts:51

A view’s request for its context menu, with what the menu needs to know about the view.

readonly bounds: Rectangle

Defined in: app/src/platform/electron/browser-window.ts:61

Where the view is in the window, for menus opened with the keyboard.

readonly contents: WebContents

Defined in: app/src/platform/electron/browser-window.ts:57

The view’s web contents.

readonly params: ContextMenuParams

Defined in: app/src/platform/electron/browser-window.ts:59

What was clicked, as Chromium reports it.

readonly tabId: string | undefined

Defined in: app/src/platform/electron/browser-window.ts:55

The tab whose page was clicked; undefined for the shell.

readonly window: BrowserWindowController

Defined in: app/src/platform/electron/browser-window.ts:53

The window that shows the view.


Defined in: app/src/platform/electron/browser-window.ts:43

Space the shell occupies at the window edges.

readonly bottom: number

Defined in: app/src/platform/electron/browser-window.ts:46

readonly left: number

Defined in: app/src/platform/electron/browser-window.ts:47

readonly right: number

Defined in: app/src/platform/electron/browser-window.ts:45

readonly top: number

Defined in: app/src/platform/electron/browser-window.ts:44


Defined in: app/src/platform/electron/browser-window.ts:153

What a window needs of its overlay.

close(): void

Defined in: app/src/platform/electron/browser-window.ts:155

Closes the overlay and gives the focus back to the page or the shell.

void


Defined in: app/src/platform/electron/browser-window.ts:159

Where a window opens, and whether it is a popup that a page opened.

readonly optional bounds?: WindowBounds

Defined in: app/src/platform/electron/browser-window.ts:160

readonly optional maximized?: boolean

Defined in: app/src/platform/electron/browser-window.ts:161

readonly optional popup?: boolean

Defined in: app/src/platform/electron/browser-window.ts:163

A popup closes with its last tab and is not kept in the session.

readonly optional private?: boolean

Defined in: app/src/platform/electron/browser-window.ts:165

A private window keeps no history and no session, and its pages’ data only in memory.

PageCommand = "page.print" | "page.save" | "page.source" | "devtools.toggle"

Defined in: app/src/platform/electron/browser-window.ts:145

The commands that tools outside the window carry out on a web page.