@@ -14,7 +14,6 @@ import {
14
14
} from '@theia/core/lib/electron-main/electron-main-application' ;
15
15
import { SplashServiceImpl } from '../splash/splash-service-impl' ;
16
16
import { URI } from '@theia/core/shared/vscode-uri' ;
17
- import * as electronRemoteMain from '@theia/core/electron-shared/@electron/remote/main' ;
18
17
import { Deferred } from '@theia/core/lib/common/promise-util' ;
19
18
import * as os from '@theia/core/lib/common/os' ;
20
19
import { Restart } from '@theia/core/lib/electron-common/messaging/electron-messages' ;
@@ -37,7 +36,6 @@ const WORKSPACES = 'workspaces';
37
36
38
37
@injectable ( )
39
38
export class ElectronMainApplication extends TheiaElectronMainApplication {
40
- protected _windows : BrowserWindow [ ] = [ ] ;
41
39
protected startup = false ;
42
40
protected openFilePromise = new Deferred ( ) ;
43
41
@@ -182,7 +180,7 @@ export class ElectronMainApplication extends TheiaElectronMainApplication {
182
180
let options = await asyncOptions ;
183
181
options = this . avoidOverlap ( options ) ;
184
182
let electronWindow : BrowserWindow | undefined ;
185
- if ( this . _windows . length ) {
183
+ if ( this . windows . size ) {
186
184
electronWindow = await super . createWindow ( options ) ;
187
185
} else {
188
186
const { bounds } = screen . getDisplayNearestPoint (
@@ -205,7 +203,7 @@ export class ElectronMainApplication extends TheiaElectronMainApplication {
205
203
hasShadow : false ,
206
204
resizable : false ,
207
205
} ;
208
- electronWindow = initSplashScreen (
206
+ electronWindow = await initSplashScreen (
209
207
{
210
208
windowOpts : options ,
211
209
templateUrl : join (
@@ -223,6 +221,7 @@ export class ElectronMainApplication extends TheiaElectronMainApplication {
223
221
minVisible : 2000 ,
224
222
splashScreenOpts,
225
223
} ,
224
+ ( windowOptions ) => super . createWindow ( windowOptions ) ,
226
225
this . splashService . onCloseRequested
227
226
) ;
228
227
}
@@ -254,23 +253,7 @@ export class ElectronMainApplication extends TheiaElectronMainApplication {
254
253
}
255
254
}
256
255
) ;
257
-
258
- this . _windows . push ( electronWindow ) ;
259
- electronWindow . on ( 'closed' , ( ) => {
260
- if ( electronWindow ) {
261
- const index = this . _windows . indexOf ( electronWindow ) ;
262
- if ( index === - 1 ) {
263
- console . warn (
264
- `Could not dispose browser window: '${ electronWindow . title } '.`
265
- ) ;
266
- } else {
267
- this . _windows . splice ( index , 1 ) ;
268
- electronWindow = undefined ;
269
- }
270
- }
271
- } ) ;
272
256
this . attachClosedWorkspace ( electronWindow ) ;
273
- electronRemoteMain . enable ( electronWindow . webContents ) ;
274
257
return electronWindow ;
275
258
}
276
259
@@ -376,6 +359,6 @@ export class ElectronMainApplication extends TheiaElectronMainApplication {
376
359
}
377
360
378
361
get browserWindows ( ) : BrowserWindow [ ] {
379
- return this . _windows ;
362
+ return Array . from ( this . windows . values ( ) ) . map ( ( { window } ) => window ) ;
380
363
}
381
364
}
0 commit comments