77import { TPromise } from 'vs/base/common/winjs.base' ;
88import Severity from 'vs/base/common/severity' ;
99import { toErrorMessage } from 'vs/base/common/errorMessage' ;
10- import { ILifecycleService , ShutdownEvent } from 'vs/platform/lifecycle/common/lifecycle' ;
10+ import { ILifecycleService , ShutdownEvent , ShutdownReason } from 'vs/platform/lifecycle/common/lifecycle' ;
1111import { IMessageService } from 'vs/platform/message/common/message' ;
1212import { IWindowIPCService } from 'vs/workbench/services/window/electron-browser/windowService' ;
1313import { ipcRenderer as ipc } from 'electron' ;
@@ -21,7 +21,6 @@ export class LifecycleService implements ILifecycleService {
2121 private _onShutdown = new Emitter < void > ( ) ;
2222
2323 private _willShutdown : boolean ;
24- private _quitRequested : boolean ;
2524
2625 constructor (
2726 @IMessageService private messageService : IMessageService ,
@@ -34,10 +33,6 @@ export class LifecycleService implements ILifecycleService {
3433 return this . _willShutdown ;
3534 }
3635
37- public get quitRequested ( ) : boolean {
38- return this . _quitRequested ;
39- }
40-
4136 public get onWillShutdown ( ) : Event < ShutdownEvent > {
4237 return this . _onWillShutdown . event ;
4338 }
@@ -50,13 +45,11 @@ export class LifecycleService implements ILifecycleService {
5045 const windowId = this . windowService . getWindowId ( ) ;
5146
5247 // Main side indicates that window is about to unload, check for vetos
53- ipc . on ( 'vscode:beforeUnload' , ( event , reply : { okChannel : string , cancelChannel : string , quitRequested : boolean } ) => {
48+ ipc . on ( 'vscode:beforeUnload' , ( event , reply : { okChannel : string , cancelChannel : string , reason : ShutdownReason } ) => {
5449 this . _willShutdown = true ;
55- this . _quitRequested = reply . quitRequested ;
5650
5751 // trigger onWillShutdown events and veto collecting
58- this . onBeforeUnload ( reply . quitRequested ) . done ( veto => {
59- this . _quitRequested = false ;
52+ this . onBeforeUnload ( reply . reason ) . done ( veto => {
6053 if ( veto ) {
6154 this . _willShutdown = false ; // reset this flag since the shutdown has been vetoed!
6255 ipc . send ( reply . cancelChannel , windowId ) ;
@@ -68,14 +61,14 @@ export class LifecycleService implements ILifecycleService {
6861 } ) ;
6962 }
7063
71- private onBeforeUnload ( quitRequested : boolean ) : TPromise < boolean > {
64+ private onBeforeUnload ( reason : ShutdownReason ) : TPromise < boolean > {
7265 const vetos : ( boolean | TPromise < boolean > ) [ ] = [ ] ;
7366
7467 this . _onWillShutdown . fire ( {
7568 veto ( value ) {
7669 vetos . push ( value ) ;
7770 } ,
78- quitRequested
71+ reason
7972 } ) ;
8073
8174 if ( vetos . length === 0 ) {
0 commit comments