@@ -16,6 +16,7 @@ import { ILifecycleService, LifecycleService } from 'vs/code/electron-main/lifec
1616import { VSCodeMenu } from 'vs/code/electron-main/menus' ;
1717import { ISettingsService , SettingsManager } from 'vs/code/electron-main/settings' ;
1818import { IUpdateService , UpdateManager } from 'vs/code/electron-main/update-manager' ;
19+ import { Server as ElectronIPCServer } from 'vs/base/parts/ipc/common/ipc.electron' ;
1920import { Server , serve , connect } from 'vs/base/parts/ipc/node/ipc.net' ;
2021import { TPromise } from 'vs/base/common/winjs.base' ;
2122import { AskpassChannel } from 'vs/workbench/parts/git/common/gitIpc' ;
@@ -31,6 +32,8 @@ import { ILogService, MainLogService } from 'vs/code/electron-main/log';
3132import { IStorageService , StorageService } from 'vs/code/electron-main/storage' ;
3233import * as cp from 'child_process' ;
3334import { generateUuid } from 'vs/base/common/uuid' ;
35+ import { URLChannel } from 'vs/platform/url/common/urlIpc' ;
36+ import { URLService } from 'vs/platform/url/electron-main/urlService' ;
3437
3538function quit ( accessor : ServicesAccessor , error ?: Error ) ;
3639function quit ( accessor : ServicesAccessor , message ?: string ) ;
@@ -52,7 +55,7 @@ function quit(accessor: ServicesAccessor, arg?: any) {
5255 process . exit ( exitCode ) ; // in main, process.exit === app.exit
5356}
5457
55- function main ( accessor : ServicesAccessor , ipcServer : Server , userEnv : IProcessEnvironment ) : void {
58+ function main ( accessor : ServicesAccessor , mainIpcServer : Server , userEnv : IProcessEnvironment ) : void {
5659 const instantiationService = accessor . get ( IInstantiationService ) ;
5760 const logService = accessor . get ( ILogService ) ;
5861 const envService = accessor . get ( IEnvironmentService ) ;
@@ -93,14 +96,22 @@ function main(accessor: ServicesAccessor, ipcServer: Server, userEnv: IProcessEn
9396 // noop
9497 }
9598
96- // Register IPC services
99+ // Register Main IPC services
97100 const launchService = instantiationService . createInstance ( LaunchService ) ;
98101 const launchChannel = new LaunchChannel ( launchService ) ;
99- ipcServer . registerChannel ( 'launch' , launchChannel ) ;
102+ mainIpcServer . registerChannel ( 'launch' , launchChannel ) ;
100103
101104 const askpassService = new GitAskpassService ( ) ;
102105 const askpassChannel = new AskpassChannel ( askpassService ) ;
103- ipcServer . registerChannel ( 'askpass' , askpassChannel ) ;
106+ mainIpcServer . registerChannel ( 'askpass' , askpassChannel ) ;
107+
108+ // Create Electron IPC Server
109+ const electronIpcServer = new ElectronIPCServer ( ipc ) ;
110+
111+ // Register Electron IPC services
112+ const urlService = instantiationService . createInstance ( URLService ) ;
113+ const urlChannel = new URLChannel ( urlService ) ;
114+ electronIpcServer . registerChannel ( 'url' , urlChannel ) ;
104115
105116 // Used by sub processes to communicate back to the main instance
106117 process . env [ 'VSCODE_PID' ] = '' + process . pid ;
@@ -125,9 +136,9 @@ function main(accessor: ServicesAccessor, ipcServer: Server, userEnv: IProcessEn
125136 global . programStart = envService . cliArgs . programStart ;
126137
127138 function dispose ( ) {
128- if ( ipcServer ) {
129- ipcServer . dispose ( ) ;
130- ipcServer = null ;
139+ if ( mainIpcServer ) {
140+ mainIpcServer . dispose ( ) ;
141+ mainIpcServer = null ;
131142 }
132143
133144 sharedProcess . dispose ( ) ;
@@ -144,12 +155,6 @@ function main(accessor: ServicesAccessor, ipcServer: Server, userEnv: IProcessEn
144155 dispose ( ) ;
145156 } ) ;
146157
147- app . setAsDefaultProtocolClient ( 'vscode' ) ;
148-
149- app . on ( 'open-url' , url => {
150- console . log ( url ) ;
151- } ) ;
152-
153158 // Dispose on vscode:exit
154159 ipc . on ( 'vscode:exit' , ( event , code : number ) => {
155160 logService . log ( 'IPC#vscode:exit' , code ) ;
@@ -356,6 +361,6 @@ getUserEnvironment()
356361
357362 return instantiationService . invokeFunction ( a => a . get ( IEnvironmentService ) . createPaths ( ) )
358363 . then ( ( ) => instantiationService . invokeFunction ( setupIPC ) )
359- . then ( ipcServer => instantiationService . invokeFunction ( main , ipcServer , userEnv ) ) ;
364+ . then ( mainIpcServer => instantiationService . invokeFunction ( main , mainIpcServer , userEnv ) ) ;
360365 } )
361366 . done ( null , err => instantiationService . invokeFunction ( quit , err ) ) ;
0 commit comments