@@ -12,7 +12,10 @@ import * as platform from 'vs/base/common/platform';
1212import { parseMainProcessArgv , ParsedArgs } from 'vs/platform/environment/node/argv' ;
1313import { mkdirp } from 'vs/base/node/pfs' ;
1414import { validatePaths } from 'vs/code/electron-main/paths' ;
15- import { IWindowsService , WindowsManager } from 'vs/code/electron-main/windows' ;
15+ import { IWindowsMainService , WindowsManager } from 'vs/code/electron-main/windows' ;
16+ import { IWindowsService } from 'vs/platform/windows/common/windows' ;
17+ import { WindowsChannel } from 'vs/platform/windows/common/windowsIpc' ;
18+ import { WindowsService } from 'vs/platform/windows/electron-main/windowsService' ;
1619import { WindowEventChannel } from 'vs/code/common/windowsIpc' ;
1720import { ILifecycleService , LifecycleService } from 'vs/code/electron-main/lifecycle' ;
1821import { VSCodeMenu } from 'vs/code/electron-main/menus' ;
@@ -72,11 +75,11 @@ function main(accessor: ServicesAccessor, mainIpcServer: Server, userEnv: platfo
7275 const instantiationService = accessor . get ( IInstantiationService ) ;
7376 const logService = accessor . get ( ILogService ) ;
7477 const environmentService = accessor . get ( IEnvironmentService ) ;
75- const windowsService = accessor . get ( IWindowsService ) ;
78+ const windowsMainService = accessor . get ( IWindowsMainService ) ;
7679 const lifecycleService = accessor . get ( ILifecycleService ) ;
7780 const updateService = accessor . get ( IUpdateService ) ;
7881 const configurationService = accessor . get ( IConfigurationService ) as ConfigurationService < any > ;
79- const windowEventChannel = new WindowEventChannel ( windowsService ) ;
82+ const windowEventChannel = new WindowEventChannel ( windowsMainService ) ;
8083
8184 // We handle uncaught exceptions here to prevent electron from opening a dialog to the user
8285 process . on ( 'uncaughtException' , ( err : any ) => {
@@ -89,7 +92,7 @@ function main(accessor: ServicesAccessor, mainIpcServer: Server, userEnv: platfo
8992 } ;
9093
9194 // handle on client side
92- windowsService . sendToFocused ( 'vscode:reportError' , JSON . stringify ( friendlyError ) ) ;
95+ windowsMainService . sendToFocused ( 'vscode:reportError' , JSON . stringify ( friendlyError ) ) ;
9396 }
9497
9598 console . error ( '[uncaught exception in main]: ' + err ) ;
@@ -130,6 +133,10 @@ function main(accessor: ServicesAccessor, mainIpcServer: Server, userEnv: platfo
130133 const urlChannel = instantiationService . createInstance ( URLChannel , urlService ) ;
131134 electronIpcServer . registerChannel ( 'url' , urlChannel ) ;
132135
136+ const windowsService = accessor . get ( IWindowsService ) ;
137+ const windowsChannel = new WindowsChannel ( windowsService ) ;
138+ electronIpcServer . registerChannel ( 'windows' , windowsChannel ) ;
139+
133140 // Spawn shared process
134141 const initData = { args : environmentService . args } ;
135142 const options = {
@@ -190,7 +197,7 @@ function main(accessor: ServicesAccessor, mainIpcServer: Server, userEnv: platfo
190197 lifecycleService . ready ( ) ;
191198
192199 // Propagate to clients
193- windowsService . ready ( userEnv ) ;
200+ windowsMainService . ready ( userEnv ) ;
194201
195202 // Install Menu
196203 const menu = instantiationService . createInstance ( VSCodeMenu ) ;
@@ -217,12 +224,12 @@ function main(accessor: ServicesAccessor, mainIpcServer: Server, userEnv: platfo
217224 } ) ;
218225
219226 // Recent Folders
220- const folders = windowsService . getRecentPathsList ( ) . folders ;
227+ const folders = windowsMainService . getRecentPathsList ( ) . folders ;
221228 if ( folders . length > 0 ) {
222229 jumpList . push ( {
223230 type : 'custom' ,
224231 name : 'Recent Folders' ,
225- items : windowsService . getRecentPathsList ( ) . folders . slice ( 0 , 7 /* limit number of entries here */ ) . map ( folder => {
232+ items : windowsMainService . getRecentPathsList ( ) . folders . slice ( 0 , 7 /* limit number of entries here */ ) . map ( folder => {
226233 return < Electron . JumpListItem > {
227234 type : 'task' ,
228235 title : getPathLabel ( folder ) ,
@@ -253,11 +260,11 @@ function main(accessor: ServicesAccessor, mainIpcServer: Server, userEnv: platfo
253260
254261 // Open our first window
255262 if ( environmentService . args [ 'new-window' ] && environmentService . args . _ . length === 0 ) {
256- windowsService . open ( { cli : environmentService . args , forceNewWindow : true , forceEmpty : true } ) ; // new window if "-n" was used without paths
263+ windowsMainService . open ( { cli : environmentService . args , forceNewWindow : true , forceEmpty : true } ) ; // new window if "-n" was used without paths
257264 } else if ( global . macOpenFiles && global . macOpenFiles . length && ( ! environmentService . args . _ || ! environmentService . args . _ . length ) ) {
258- windowsService . open ( { cli : environmentService . args , pathsToOpen : global . macOpenFiles } ) ; // mac: open-file event received on startup
265+ windowsMainService . open ( { cli : environmentService . args , pathsToOpen : global . macOpenFiles } ) ; // mac: open-file event received on startup
259266 } else {
260- windowsService . open ( { cli : environmentService . args , forceNewWindow : environmentService . args [ 'new-window' ] , diffMode : environmentService . args . diff } ) ; // default: read paths from cli
267+ windowsMainService . open ( { cli : environmentService . args , forceNewWindow : environmentService . args [ 'new-window' ] , diffMode : environmentService . args . diff } ) ; // default: read paths from cli
261268 }
262269}
263270
@@ -445,7 +452,8 @@ function start(): void {
445452
446453 services . set ( IEnvironmentService , new SyncDescriptor ( EnvironmentService , args , process . execPath ) ) ;
447454 services . set ( ILogService , new SyncDescriptor ( MainLogService ) ) ;
448- services . set ( IWindowsService , new SyncDescriptor ( WindowsManager ) ) ;
455+ services . set ( IWindowsMainService , new SyncDescriptor ( WindowsManager ) ) ;
456+ services . set ( IWindowsService , new SyncDescriptor ( WindowsService ) ) ;
449457 services . set ( ILifecycleService , new SyncDescriptor ( LifecycleService ) ) ;
450458 services . set ( IStorageService , new SyncDescriptor ( StorageService ) ) ;
451459 services . set ( IConfigurationService , new SyncDescriptor ( ConfigurationService ) ) ;
0 commit comments