File tree Expand file tree Collapse file tree 3 files changed +8
-6
lines changed
packages/electron-chrome-extensions/src/browser Expand file tree Collapse file tree 3 files changed +8
-6
lines changed Original file line number Diff line number Diff line change 11import { promises as fs } from 'node:fs'
22import * as path from 'node:path'
3- import { nativeImage } from 'electron'
3+ import { BaseWindow , BrowserWindow , nativeImage } from 'electron'
44
55export interface TabContents extends Electron . WebContents {
66 favicon ?: string
@@ -120,3 +120,5 @@ export const matchesTitlePattern = (pattern: string, title: string) => {
120120 const regexp = new RegExp ( `^${ pattern . split ( '*' ) . map ( escapePattern ) . join ( '.*' ) } $` )
121121 return title . match ( regexp )
122122}
123+
124+ export const getAllWindows = ( ) => [ ...BaseWindow . getAllWindows ( ) , ...BrowserWindow . getAllWindows ( ) ]
Original file line number Diff line number Diff line change 1- import { BrowserWindow } from 'electron'
21import { ExtensionContext } from '../context'
32import { ExtensionEvent } from '../router'
4- import { matchesPattern , matchesTitlePattern , TabContents } from './common'
3+ import { getAllWindows , matchesPattern , matchesTitlePattern , TabContents } from './common'
54import { WindowsAPI } from './windows'
65
76const debug = require ( 'debug' ) ( 'electron-chrome-extensions:tabs' )
@@ -357,7 +356,7 @@ export class TabsAPI {
357356 const windowId = details ? details . windowId : WindowsAPI . WINDOW_ID_NONE
358357 const win =
359358 typeof windowId !== 'undefined' && windowId > - 1
360- ? BrowserWindow . getAllWindows ( ) . find ( ( win ) => win . id === windowId )
359+ ? getAllWindows ( ) . find ( ( win ) => win . id === windowId )
361360 : null
362361
363362 this . ctx . router . broadcastEvent ( 'tabs.onRemoved' , tabId , {
Original file line number Diff line number Diff line change 1- import { BrowserWindow , Session } from 'electron'
1+ import { BaseWindow , BrowserWindow , Session } from 'electron'
2+ import { getAllWindows } from './api/common'
23
34const debug = require ( 'debug' ) ( 'electron-chrome-extensions:popup' )
45
@@ -185,7 +186,7 @@ export class PopupView {
185186 // For extension popups with a login form, the user may need to access a
186187 // program outside of the app. Closing the popup would then add
187188 // inconvenience.
188- if ( ! BrowserWindow . getFocusedWindow ( ) ) {
189+ if ( ! getAllWindows ( ) . some ( ( win ) => win . isFocused ( ) ) ) {
189190 debug ( 'preventing close due to focus residing outside of the app' )
190191 return
191192 }
You can’t perform that action at this time.
0 commit comments